trying to build a callback script on a parametter I cant get the parm.isHidden() method to return the correct state of a parameter (always False)…
Any clue or is this a bug (by the way, i am inable to find a workaround for the moment)
Example file content null with most of parameters hidden and string parm witjh a call to hou.session module fonction printing isHisdden state of all parameters
parm.isHiidden() NOT WORKING
2415 6 2- NAHASSIA
- Member
- 125 posts
- Joined: June 2008
- Offline
- are2d2
- Member
- 79 posts
- Joined: April 2011
- Offline
Hey NAHASSIA,
Yeah, it can get a little confusing. So in Houdini interfaces there are two ways to ‘hide’ parameters - the end result is the same - you don't see them. But in order to get those states in code you have to be pretty strict.
The way you are checking with the parm.isHidden() will only return true when the parm has an expression in the ‘hide when’ option in the interface (the first way of hiding - which none of yours has - hence the ‘false’ result all the time).
The parameters you have hidden in the interface are actually invisible (the second way of ‘hiding’). And to check this you need to call the ‘isHidden()’ method on the parameter template. So for your example if you change the last line in your parm_nm() function to be:
print parm,parm.parmTemplate().isHidden()
you will notice a difference.
Unfortunately it's still not quite that simple….
You'll notice that even then, some of the parms that are invisible are still returning false!
The reason for this is that the folders that contain them are invisible!
So you will need to do two checks (or three if you want to see all invisible parm):
1. Is the parmTemplate invisible.
2. Is one of the folders that the parm is in invisible.
(3. Is the parm hidden - if you want to see all the invisible parms)
I'll let you check the docs about the parmTemplates and finding the containing folders and checking if they are invisible - if you still can't get it post what you've gotten so far and I can help you some more.
I'll warn you - I found parm Templates VERY FRUSTRATING when I first started working with them - but you can do some pretty cool things once you wrap your head around it.
Good Luck!
Yeah, it can get a little confusing. So in Houdini interfaces there are two ways to ‘hide’ parameters - the end result is the same - you don't see them. But in order to get those states in code you have to be pretty strict.
The way you are checking with the parm.isHidden() will only return true when the parm has an expression in the ‘hide when’ option in the interface (the first way of hiding - which none of yours has - hence the ‘false’ result all the time).
The parameters you have hidden in the interface are actually invisible (the second way of ‘hiding’). And to check this you need to call the ‘isHidden()’ method on the parameter template. So for your example if you change the last line in your parm_nm() function to be:
print parm,parm.parmTemplate().isHidden()
you will notice a difference.
Unfortunately it's still not quite that simple….
You'll notice that even then, some of the parms that are invisible are still returning false!
The reason for this is that the folders that contain them are invisible!
So you will need to do two checks (or three if you want to see all invisible parm):
1. Is the parmTemplate invisible.
2. Is one of the folders that the parm is in invisible.
(3. Is the parm hidden - if you want to see all the invisible parms)
I'll let you check the docs about the parmTemplates and finding the containing folders and checking if they are invisible - if you still can't get it post what you've gotten so far and I can help you some more.
I'll warn you - I found parm Templates VERY FRUSTRATING when I first started working with them - but you can do some pretty cool things once you wrap your head around it.
Good Luck!
- NAHASSIA
- Member
- 125 posts
- Joined: June 2008
- Offline
- Tesla_s_fan
- Member
- 129 posts
- Joined: Jan. 2013
- Offline
- are2d2
- Member
- 79 posts
- Joined: April 2011
- Offline
- NAHASSIA
- Member
- 125 posts
- Joined: June 2008
- Offline
Worked fine for me!!!
As I see it, he things to understant are:
A parameter is in fact two diferent class wraped in a third one
the wraping object is = hou.ParmTuple
it contains
a hou.ParmTemplate and a hou.Parm
basicaly you can read infos from hou.parm ans set its value
but UI components are store in the hou.ParmTemplate, hre you can change every UI component but not the value of the parameter.
the workflow for me is:
parm = node.parm('parname')
parm_templ = parm.parmTemplate()
parm_tuple = parm.tuple()
parm_templ.setLabel('newvalue') ## label for example
parm_templ.visible(true) ## set visibility
node.replaceSpareParmTuple('parname',parm_templ)
that's it
BTW the visibility flag and the isHidden method are pertinent to the template
As I see it, he things to understant are:
A parameter is in fact two diferent class wraped in a third one
the wraping object is = hou.ParmTuple
it contains
a hou.ParmTemplate and a hou.Parm
basicaly you can read infos from hou.parm ans set its value
but UI components are store in the hou.ParmTemplate, hre you can change every UI component but not the value of the parameter.
the workflow for me is:
parm = node.parm('parname')
parm_templ = parm.parmTemplate()
parm_tuple = parm.tuple()
parm_templ.setLabel('newvalue') ## label for example
parm_templ.visible(true) ## set visibility
node.replaceSpareParmTuple('parname',parm_templ)
that's it
BTW the visibility flag and the isHidden method are pertinent to the template
- Tesla_s_fan
- Member
- 129 posts
- Joined: Jan. 2013
- Offline
-
- Quick Links