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

Sandy Sutherland sandy.maillists at gmail.com
Tue Mar 14 17:38:15 EDT 2017


Thanks Andy,

Using Pycharm, so should not be an issue, and the rest of the tool works
100% - I can ADD new parms with setConditional() and it works fine, only on
existing parms on the asset is it a problem.

S.

On Tue, Mar 14, 2017 at 5:22 PM, Andy Nicholas <andy at andynicholas.com>
wrote:

> It's not a unicode issue or something like that is it? You might want to
> double check your text editor is saving your script out as UTF-8.
>
> Copy and paste it into Notepad and save it out from there to see if that
> helps.
>
> Cheers,
> Andy
>
>
> On 14/03/2017 16:56, Sandy Sutherland wrote:
>
>> Thanks Lars,
>>
>> Wonder what the difference is, if I manually enter { renderengine !=
>> mantra
>> } into the hide of the parameter, then it works, just not from my script,
>> even the setting does not appear when I check after completing the asset
>> with the tool, using Type Properties.
>>
>> Cheers
>>
>> Sandy
>>
>> On Tue, Mar 14, 2017 at 11:33 AM, Lars van der Bijl <com48com at gmail.com>
>> wrote:
>>
>> 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
>>>>
>>>> _______________________________________________
>>> Sidefx-houdini-list mailing list
>>> Sidefx-houdini-list at sidefx.com
>>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>>
>>> _______________________________________________
>> Sidefx-houdini-list mailing list
>> Sidefx-houdini-list at sidefx.com
>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>
>
> _______________________________________________
> 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