Python Parameters function?
4536 12 0- Shadowjonny
- Member
- 97 posts
- Joined: May 2015
- Offline
- dom_campbell
- Member
- 8 posts
- Joined: April 2020
- Offline
- Shadowjonny
- Member
- 97 posts
- Joined: May 2015
- Offline
dom_campbell
Are you asking how to get the nested folder params?
If so, say you wanted ‘Rings’ is would be:
For flat parms:node.parmsInFolder(('Poles', 'Rings'))
For tuple params:node.parmTuplesInFolder(('Poles', 'Rings'))
I get an error saying “OperationFailed: The attempted operation failed.
Invalid containing folder name(s)” the parameters are on a Digital Asset.
Edited by Shadowjonny - July 11, 2020 21:17:47
- jsmack
- Member
- 7658 posts
- Joined: Sept. 2011
- Online
- Shadowjonny
- Member
- 97 posts
- Joined: May 2015
- Offline
- dom_campbell
- Member
- 8 posts
- Joined: April 2020
- Offline
Calling from/on a hda is not going to make a difference as long as you are calling on the correct `Node`.
A couple of things to check if you are calling it on a non-nested folder you need to make it clear it is a tuple with a trailing `,`; use
Second thing to check is that you are using the folder's ‘label’ and not it's ‘name’; I know the error says name but for me it sees to require the ‘label’.
In the below you would use ‘First’ not ‘folder0’.
A couple of things to check if you are calling it on a non-nested folder you need to make it clear it is a tuple with a trailing `,`; use
node.parmTuplesInFolder(('Poles', ))
not node.parmTuplesInFolder(('Poles'))
.Second thing to check is that you are using the folder's ‘label’ and not it's ‘name’; I know the error says name but for me it sees to require the ‘label’.
In the below you would use ‘First’ not ‘folder0’.
Edited by dom_campbell - July 12, 2020 05:42:59
- Shadowjonny
- Member
- 97 posts
- Joined: May 2015
- Offline
dom_campbell
Calling from/on a hda is not going to make a difference as long as you are calling on the correct `Node`.
A couple of things to check if you are calling it on a non-nested folder you need to make it clear it is a tuple with a trailing `,`; usenode.parmTuplesInFolder(('Poles', ))
notnode.parmTuplesInFolder(('Poles'))
.
Second thing to check is that you are using the folder's ‘label’ and not it's ‘name’; I know the error says name but for me it sees to require the ‘label’.
In the below you would use ‘First’ not ‘folder0’.
HDAnode = hou.node("/obj/UtilityPole") list = HDAnode.parmTuplesInFolder(("Poles", "Rings"))
I get the Operation failed. That is there name, what do you mean by trailing?
- dom_campbell
- Member
- 8 posts
- Joined: April 2020
- Offline
Shadowjonny
what do you mean by trailing?
For the trailing ‘,’. I just mean that if you had one item in the tuple you needed a `,` at the end (trailing) to make it a tuple containing one string, leaving it out would make it just a string with bracket around it; `(“Poles”) == “Poles”` not `(“Poles”, )`. You have to values in the tuple so it will be fine.
Shadowjonny
That is there name
No “Poles” and “Rings” look like the labels to me which is what you should be using in `parmTuplesInFolder`. Most on the when accessing things you should be using the names, but not in this case; I dont know why but I am a n00b so maybe the reason is obvious to others.
No sure what will is up with your setup `parmTuplesInFolder()` works as fine for me.
Ask which version you are on? (I am new to Houdini so have only used version 18 and maybe there is a difference)
The version changes '#' characters to '_' when I apply so the screen shot you have could not be applied changes; and obviously you would need to apply the changes before anything would work. Maybe there is some issue with using `#` in the names.
Can you confirm
HDAnode
Can you confirm it's type
HDAnode.type()
Where is this python code running from?
I would expect
hou.pwd()
hou.node("/obj/UtilityPole")
Can you access the parms okay? Does
HDAnode.parm('RingPosition#_#x')
HDAnode.parm('RingPosition___x')
If the parm is returned are does it say the containing folders are?
HDAnode.parm('RingPosition#_#x').containingFolders()
HDAnode.parm('RingPosition___x').containingFolders()
Is `parmTuplesInFolder` working in general for you?
Does
HDAnode.parmTuplesInFolder(())
Does
HDAnode.parmTuplesInFolder(('Poles', ))
Sorry, if some of those are a bit obvious and they are a bit confusing. With Houdini a user could some could be an experienced artist but inexperienced programmer, or an experienced programmer but inexperienced artist; those groups don't speak the same language or make the same sort of mistakes.
Edited by dom_campbell - July 12, 2020 14:52:08
- Shadowjonny
- Member
- 97 posts
- Joined: May 2015
- Offline
dom_campbellShadowjonny
what do you mean by trailing?
For the trailing ‘,’. I just mean that if you had one item in the tuple you needed a `,` at the end (trailing) to make it a tuple containing one string, leaving it out would make it just a string with bracket around it; `(“Poles”) == “Poles”` not `(“Poles”, )`. You have to values in the tuple so it will be fine.Shadowjonny
That is there name
No “Poles” and “Rings” look like the labels to me which is what you should be using in `parmTuplesInFolder`. Most on the when accessing things you should be using the names, but not in this case; I dont know why but I am a n00b so maybe the reason is obvious to others.
No sure what will is up with your setup `parmTuplesInFolder()` works as fine for me.
Ask which version you are on? (I am new to Houdini so have only used version 18 and maybe there is a difference)
The version changes '#' characters to '_' when I apply so the screen shot you have could not be applied changes; and obviously you would need to apply the changes before anything would work. Maybe there is some issue with using `#` in the names.
Can you confirmis differently the correct node?HDAnode
Can you confirm it's type?HDAnode.type()
Where is this python code running from?
I would expectto have been used if it was inside the hda;hou.pwd()would only be the right thing to do in session code since it is a scene content path.hou.node("/obj/UtilityPole")
Can you access the parms okay? Doesreturn a value okay? orHDAnode.parm('RingPosition#_#x')if it was renamed on apply?HDAnode.parm('RingPosition___x')
If the parm is returned are does it say the containing folders are?or it the parm was renamed on applyHDAnode.parm('RingPosition#_#x').containingFolders()HDAnode.parm('RingPosition___x').containingFolders()
Is `parmTuplesInFolder` working in general for you?
Doesreturn all the parms? (yes, when there is no values in the tuple it knows it is a tuple, one value is just the odd case)HDAnode.parmTuplesInFolder(())
Doesreturn all everything in the poles folder?HDAnode.parmTuplesInFolder(('Poles', ))
Sorry, if some of those are a bit obvious and they are a bit confusing. With Houdini a user could some could be an experienced artist but inexperienced programmer, or an experienced programmer but inexperienced artist; those groups don't speak the same language or make the same sort of mistakes.
so i tired all of those they work and they print out something only the ‘containingFolders()’ was empty. Also
HDAnode.parmTuplesInFolder(())
HDAnode.parmTuplesInFolder(('Poles', ))
HDAnode.parm("RingPosition_1_1").eval()
- Shadowjonny
- Member
- 97 posts
- Joined: May 2015
- Offline
- dom_campbell
- Member
- 8 posts
- Joined: April 2020
- Offline
- Shadowjonny
- Member
- 97 posts
- Joined: May 2015
- Offline
- dom_campbell
- Member
- 8 posts
- Joined: April 2020
- Offline
Shadowjonny
the folder is a multiparm block
Apologies, I completely misunderstood this and thought you meant parms that are tuples (like a vector3) in a folder. I did not realise multiparm blocks where folder types that automatically created list templates. Sorry, I am new to Houdini
Yes, I can config parmInFolder/parmTuplesInFolder do not return anything for these types (I am guessing that is a bug); so the parms are not in the folders.
The 2 options at I am aware you will have (and I am guessing you may know already) are, globParms or evaluation the folder parm to get the number of instances;
# Probably not what you want given you have a nested multiparm block folders and you will need the indices. # Would be fine for not nested as they are in order ringPositions = HDAnode.globParms("RingPosition*")
# This time you do need to use the folder names NOT THE LABELS for i in range(0, HDAnode.evalParm('polesName')): adjustedI = i + 1 for j in range(0, HDAnode.evalParm('ringsName{}'.format(adjustedI))): adjustedJ = j + 1 ringPosition = HDAnode.evalParm("RingPosition{}_{}".format(adjustedI, adjustedJ)) # etc
Edited by dom_campbell - July 13, 2020 12:01:44
-
- Quick Links