Call HDA Tool from script

   2777   4   2
User Avatar
Member
538 posts
Joined: 12月 2006
Offline
I can add tools for my HDA in Type Properties/Tools section.

After than i can use it in shelf anf TAB-menus.

But how to explicitly call this tool script from my custom python functions?

In other words i need to execute Tools/Script (see attached image) section in my functions

https://gumroad.com/alexeyvanzhula [gumroad.com]
User Avatar
Member
617 posts
Joined: 8月 2008
Offline
i wonder the same,
how you can call a shelf button with python :roll:
User Avatar
Member
47 posts
Joined: 1月 2014
Offline
Store your code under the ‘python module’ section on your Scripts tab (as opposed to the Tools/Script you have shown. If you have a method defined like this:
def yourMethod():
print “This method is just like so sweet, you guys.”

Then you can access it later from outside of the HDA itself (like from a shelf button) with something like:
hou.nodeType(“Sop/yourhda”).hdaModule().yourMethod()


Documentation for this here:
http://www.sidefx.com/docs/houdini13.0/hom/assetscripts [sidefx.com]
User Avatar
Member
617 posts
Joined: 8月 2008
Offline
i was wandering more,
let say
if i have a sphere selected, how can i click a pyro shelf button to run with python.
User Avatar
Member
47 posts
Joined: 1月 2014
Offline
Right click on the shelf button. For instance, Flames.
Click Edit Tool
Click Script

This will show you the code used to drive that shelf tool. For flames, you can see it is:

import doptoolutils
import dopsmoketoolutils
import doppyrotoolutils
doppyrotoolutils.burn(kwargs,True)


Then to see what's going on inside of burn, you can do the following:
add a Python Shell Pane and type:
>>> import doppyrotoolutils
>>> help (doppyrotoolutils)

That will show you the docstring for each method in doppyrotoolutils as well as the location of the .py source file.


You could take pieces of that code and add it to your HDA, or simply have the build script call doppyrotoolutils.burn(), but I think it might still do the object selection prompting. You'd probably need to tear into it a little for it to use another object.
  • Quick Links