[Sidefx-houdini-list] Adding setConditional to existing parm on node using python

Sandy Sutherland sandy.maillists at gmail.com
Tue Mar 14 06:47:49 EDT 2017


Hi All,

I am working on a tool to modify assets here, so that we can render with
Redshift, so am adding a menu to select which renderer to use.

I wish to add a setConditional to an existing parm on the nodes, but it
does not seem to work.

I have this function, that adds the menu, then attempts to add the
conditional.

def _add_menu_parm(node):
    parm_group = node.parmTemplateGroup()
    vplod = node.parm('viewportlod').parmTemplate()
    if not node.parm('renderengine'):
        rendermenu = hou.MenuParmTemplate("renderengine", "Renderer",
                                          menu_items=(["mantra",
"redshift", "redshift proxy"]),
                                          menu_labels=(["Mantra",
"Redshift", "Redshift Proxy"]),
                                          default_value=0,
                                          icon_names=([]),
                                          item_generator_script="",

item_generator_script_language=hou.scriptLanguage.Python,
                                          menu_type=hou.menuType.Normal)
        parm_group.insertAfter(vplod, rendermenu)
        mpt = parm_group.find('vm_rendervisibility').clone()
        mpt.setConditional(hou.parmCondType.HideWhen, '{ renderengine !=
mantra }')
        parm_group.replace('vm_rendervisibility', mpt)
        node.setParmTemplateGroup(parm_group)

This is not working for me, anyone done this?  Where am I going wrong?  I
originally attempted on the parmTemplate from the .find, but then tried
.clone() to see if it had to be a copy rather than the original.

Thanks for any help.

Cheers

Sandy



More information about the Sidefx-houdini-list mailing list