Search - User list
Full Version: How to create custom PDG Python Processor preset
Root » PDG/TOPs » How to create custom PDG Python Processor preset
tung
Hi all,

I am wondering if there is a way to create custom “preset” for PDG's Python Processor node like Parm Evaluation, Clone Upstream Items, etc.?

Thank you.
tpetrick
Yes, that's possible. The presets used on TOP nodes are implemented using Houdini's standard parm preset builder, which will look for file(s) named “PythonScripts.txt” on the Houdini search path. You can add a file with that name to your Houdini Path and put custom preset definitions in there. For example, on Linux you'd save the custom presets file to $HOME/houdini18.0/PythonScript.txt.

The snippet entries should start with the parm name the preset belongs to, then the name of the preset in the menu, and finally the code itself. For example:

Top/pythonprocessor/generate
My Custom Snippet Name
import hou
print(hou.pwd())

Top/pythonprocessor/generate
My Other Snippet Name
print("hello")

You can also check $HH/PythonScripts.txt for reference, which contains all of the parm presets for the various Python nodes shipped with Houdini.
tung
Awesome, I'll try this out. Thanks a lot for your answer @tpetrick.

Cheers,
tung
Hello again,

I am just back to this topic after a while.

I am currently looking for a way to trigger some custom parameters generate when I click on my custom preset. Would that be possible?

Cheers,
Tung
BrookeA
To clarify – you want to add some custom parameters to the node's interface when your custom preset is selected?
tung
BrandonA
To clarify – you want to add some custom parameters to the node's interface when your custom preset is selected?
Hi Brandon, yes. That's what I am after.

Thank you.
tung
Hi @BrandonA,

Do you know if there is a way for such thing in current Houdini?
BrandonA
To clarify – you want to add some custom parameters to the node's interface when your custom preset is selected?

Cheers,
BrookeA
If you are able to trigger a Python callback, you can add spare parameters to your node's interface. To do this you will need to make use of hou.ParmTemplateGroup(https://www.sidefx.com/docs/houdini/hom/hou/ParmTemplateGroup.html).

Here is an example code snippet from the documentation:

node = hou.node("/obj").createNode("geo")
group = node.parmTemplateGroup()
folder = hou.FolderParmTemplate("folder", "My Parms")
folder.addParmTemplate(hou.FloatParmTemplate("myparm", "My Parm", 1))
group.append(folder)
node.setParmTemplateGroup(group)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB