nested python accessible parms ( my_node.custom.parmA )?

   291   2   0
User Avatar
Member
8 posts
Joined: 10月 2010
オフライン
I am trying to recreate a one to one equivalence to a maya/python process so I can have a standard way to access ( houdini/python parameters, maya/python attributes & later Unreal/python...?)
So far I am able to created "visually nested parameters in Houdini, but they are not programmatically acessible as nested params.
IE
I can create a "custom" hou.FolderParmTemplate
and attach inside a "display" hou.IntParmTemplate
but cannot acess it programmatically/python as node.custom.display

So far I have had to "artificially create params "custom_display" ( with a "_" instead of "."
what I am trying to do is recreate the equivalent of ( 1 level nested compound attribute ...
So can you mimic a <node>.setParms( {"custom.display":0} ) ???
Edited by turbolinea - 2025年11月4日 02:44:50
Raffaele Scaduto-Mendola
User Avatar
Member
8 posts
Joined: 10月 2010
オフライン
"
-------------------------------------------------------------------------------------------------------------------------------
# debug code ... 
nd_obj = hou.node("/obj/sceneItems/mrk_status/lbl_status")

use_dot = True
if use_dot != True :
    parm_group = nd_obj.parmTemplateGroup()
    #--------------------------------------
    parm_display = hou.IntParmTemplate("custom_display", 
                                       "display", 
                                       1, 
                                       default_value=(1,), 
                                       min=0, 
                                       max=1, 
                                       min_is_strict=True, 
                                       max_is_strict=True 
                                      )
     parm_text = hou.StringParmTemplate("custom_text", "text", 1, default_value=("process_items",) )
     parm_fldr_01 = hou.FolderParmTemplate( "custom", "custom", parm_templates=[ parm_display, parm_text ] )
     parm_group.append(parm_fldr_01)
     #--------------------------------------
     nd_obj.setParmTemplateGroup(parm_group)

else :
     parm_group = nd_obj.parmTemplateGroup()
     #--------------------------------------
     parm_display = hou.IntParmTemplate("custom.display",
                                        "display", 
                                        1, 
                                        default_value=(1,), 
                                        min=0, 
                                        max=1, 
                                        min_is_strict=True, 
                                        max_is_strict=True 
                                       )
      
      parm_text = hou.StringParmTemplate("custom.text", "text", 1, default_value=("process_items",) )
      parm_fldr_01 = hou.FolderParmTemplate( "custom", "custom", parm_templates=[ parm_display, parm_text ] )
      parm_group.append(parm_fldr_01)
      #--------------------------------------
      nd_obj.setParmTemplateGroup(parm_group)

for item in nd_obj.allParms() :
      log_strng = "--> "+str(item)
      print(log_strng)

# result I get ...
# ...
# --> <hou.Parm custom in /obj/sceneItems/mrk_status/lbl_status>
# --> <hou.Parm xn__customdisplay_gsa in /obj/sceneItems/mrk_status/lbl_status>
# --> <hou.Parm xn__customtext_loa in /obj/sceneItems/mrk_status/lbl_status>
"
Edited by turbolinea - 2025年11月4日 02:46:12
Raffaele Scaduto-Mendola
User Avatar
Member
9372 posts
Joined: 7月 2007
オフライン
while not direct answer to your question

but it should be safe for you to ignore any perceived nesting when accessing the parm as in Houdini the parameter on the node can't have the same name as another parameter no matter how deeply "nested" in folders it is

so node.parm("display") will give you the "display" parm regardless of which folder is visually nested in, as you can't have "display" in "custom" folder and another "display" anywhere else on the node
Tomas Slancik
CG Supervisor
Framestore, NY
  • Quick Links