Hi,
Need help to fill this python function:
setConditional(type, conditional) from parmTemplate()
Tried to fill by setConditional(hou.parmCondType.DisableWhen, ‘{ range != 0 }’) set without any error but it is not work, and look like something wrong with conditional expression.
I don`t know how to write correct condition.
If I write this ({ range != 0 }) expresiion by hand in field “Desable When” - it works.
Any body knows ?
Best Regards
Ostap
setConditional(type, conditional)
2813 4 0- Ostap
- Member
- 209 posts
- Joined: Nov. 2010
- Offline
- VFXLife
- Member
- 16 posts
- Joined: March 2016
- Offline
- Ostap
- Member
- 209 posts
- Joined: Nov. 2010
- Offline
Hi,
Thanks for your feedback.
This is my code example:
n=hou.node('/obj/').createNode(“geo”, “test_condition”)
n.parm(“ty”).parmTemplate().setConditional(hou.parmCondType.DisableWhen, ‘{ tx == 0 }’)
n.updateParmStates()
n.parm(“ty”).parmTemplate().conditionals()
>>>
{}
But when I use one more temp variable, conditionals() will show correct result.
pt=n.parm(“ty”).parmTemplate()
pt.setConditional(hou.parmCondType.DisableWhen, ‘{ tx == 0 }’)
pt.conditionals()
>>>
{parmCondType.DisableWhen: ‘{ tx == 0 }’}
In both cases I don`t have any feedback to UI.
Maybe is it some bug ? Tested 15.5.717 build
Thanks for your feedback.
This is my code example:
n=hou.node('/obj/').createNode(“geo”, “test_condition”)
n.parm(“ty”).parmTemplate().setConditional(hou.parmCondType.DisableWhen, ‘{ tx == 0 }’)
n.updateParmStates()
n.parm(“ty”).parmTemplate().conditionals()
>>>
{}
But when I use one more temp variable, conditionals() will show correct result.
pt=n.parm(“ty”).parmTemplate()
pt.setConditional(hou.parmCondType.DisableWhen, ‘{ tx == 0 }’)
pt.conditionals()
>>>
{parmCondType.DisableWhen: ‘{ tx == 0 }’}
In both cases I don`t have any feedback to UI.
Maybe is it some bug ? Tested 15.5.717 build
- Ostap
- Member
- 209 posts
- Joined: Nov. 2010
- Offline
Found:
The parmTemplate() function returns a *COPY* of the parameter's template so modifying it won't do anything.
https://houdinitricks.com/adding-parameters-to-the-interface-via-python/ [houdinitricks.com]
The parmTemplate() function returns a *COPY* of the parameter's template so modifying it won't do anything.
https://houdinitricks.com/adding-parameters-to-the-interface-via-python/ [houdinitricks.com]
- graham
- Member
- 1908 posts
- Joined: Nov. 2006
- Offline
Someone asked a similar question on odforce today that reminded me I never responded to this post.
You're correct in that hou.Parm.parmTemplate() returns a copy so you must then replace that node's version with yours as described in the last line of the code example from the odforce post.
http://forums.odforce.net/topic/28700-edit-hide-when-in-edit-paraemter-interface-using-python/ [forums.odforce.net]
You're correct in that hou.Parm.parmTemplate() returns a copy so you must then replace that node's version with yours as described in the last line of the code example from the odforce post.
http://forums.odforce.net/topic/28700-edit-hide-when-in-edit-paraemter-interface-using-python/ [forums.odforce.net]
Graham Thompson, Technical Artist @ Rockstar Games
-
- Quick Links