How to create custom PDG Python Processor preset

   3129   7   0
User Avatar
Member
26 posts
Joined: Jan. 2018
Offline
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.
User Avatar
Staff
585 posts
Joined: May 2014
Offline
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.
User Avatar
Member
26 posts
Joined: Jan. 2018
Offline
Awesome, I'll try this out. Thanks a lot for your answer @tpetrick.

Cheers,
User Avatar
Member
26 posts
Joined: Jan. 2018
Offline
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
User Avatar
Staff
387 posts
Joined: Aug. 2017
Offline
To clarify – you want to add some custom parameters to the node's interface when your custom preset is selected?
User Avatar
Member
26 posts
Joined: Jan. 2018
Offline
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.
User Avatar
Member
26 posts
Joined: Jan. 2018
Offline
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,
User Avatar
Staff
387 posts
Joined: Aug. 2017
Offline
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)
Edited by BrookeA - July 29, 2020 19:52:01
  • Quick Links