Making temporary default value for a param in my HDA
520 2 0- PrzemasCGBoi
- Member
- 3 posts
- Joined: 12月 2018
- Offline
In my HDA I would like to have some dynamic default values for one parameter. I tested some approaches. I can change it's default value on HDA's definition object (using parmTemplateGroup). But there is also temporary default. I can set it up via UI by RMB --> Make Current Value Default. How do I create this temporary default via python?
- viklc
- Member
- 143 posts
- Joined: 5月 2017
- Offline
It seems there is no way to do it through python except to restore this to template defaults using parm [www.sidefx.com] or parmTuples [www.sidefx.com] methods.
Additionally you can define the default values using the node type events such as OnCreated and OnLoaded:
This also allows to set multi-parm defaults
Additionally you can define the default values using the node type events such as OnCreated and OnLoaded:
This also allows to set multi-parm defaults
Edited by viklc - 2024年1月29日 09:19:04
- rafaels
- Member
- 696 posts
- Joined: 3月 2009
- Offline
I tested this out in the python shell and it worked:
Basically you have to change the default of the parmTemplate that corresponds to your parameter, then replace it in the parmTemplateGroup, then replace your node's parmTemplateGroup with the modified one.
my_node = hou.node("path-to-your-node") my_parm_templ_grp = my_node.parmTemplateGroup() my_parm = my_node.parm("parm-name") my_parm_templ = my_parm.parmTemplate() my_parm_templ.setDefaultValue((12,)) # the new default has to be a tuple my_parm_tepl_grp.replace(my_parm.name(), my_parm_templ) my_node.setParmTemplateGroup(my_parm_templ_grp
Basically you have to change the default of the parmTemplate that corresponds to your parameter, then replace it in the parmTemplateGroup, then replace your node's parmTemplateGroup with the modified one.
Edited by rafaels - 2024年1月30日 01:07:05
Toronto - ON
My Houdini playground [renderfarm.tumblr.com]
“As technology advances, the rendering time remains constant.”
My Houdini playground [renderfarm.tumblr.com]
“As technology advances, the rendering time remains constant.”
-
- Quick Links