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

Lars van der Bijl com48com at gmail.com
Tue Mar 14 07:33:09 EDT 2017


I just tested out your code and it seems to work fine on a geo

On Tue, Mar 14, 2017 at 10:47 AM, Sandy Sutherland <
sandy.maillists at gmail.com> wrote:

> 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
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>



More information about the Sidefx-houdini-list mailing list