
How to change solaris pop-up menu parameters with Python
1659 5 1-
- CrisDoesCG
- Member
- 12 posts
- Joined: July 2020
- Offline
Hi, I am working on a HDA in Solaris which uses Python to create multiple rendersettings nodes based on some input... I have a button on the HDA that when pressed creates a new rendersettings node and sets its parameters using the usual node.parm("parameter_name").set("whatever_value")... this works well for "normal" parameters like primpattern and whatnot, but when trying to change a parameter that is locked behind a pop-up menu it all breaks down... I obviously have to switch the menu to "Set or Create" before changing the parameter itself, but I can't find anything online on how to do that. Looking at the parameters of the rendersettings node does not reveal much more. Anybody has a clue?

-
- protean
- Member
- 75 posts
- Joined: July 2006
- Offline
It seems a bit fluffy right?
I'm not sure I do it in any fantastic way but this works
https://www.sidefx.com/forum/topic/86533/?page=1#post-374166 [www.sidefx.com]
I'm not sure I do it in any fantastic way but this works
import hou sel = hou.selectedNodes()[0] sel.parm(hou.text.encode('karma:global:engine_control')).set('set')
https://www.sidefx.com/forum/topic/86533/?page=1#post-374166 [www.sidefx.com]
john @ goodbyekansas
-
- CrisDoesCG
- Member
- 12 posts
- Joined: July 2020
- Offline
protean
It seems a bit fluffy right?
I'm not sure I do it in any fantastic way but this worksimport hou sel = hou.selectedNodes()[0] sel.parm(hou.text.encode('karma:global:engine_control')).set('set')
https://www.sidefx.com/forum/topic/86533/?page=1#post-374166 [www.sidefx.com]
Oh yeah this totally works... very weird indeed...
Many thanks!
-
- mtucker
- Staff
- 4527 posts
- Joined: July 2005
- Offline
-
- protean
- Member
- 75 posts
- Joined: July 2006
- Offline
mtucker
That menu is just a parameter on the node, like any other. Therefore changing the menu just requires setting the corresponding parameter value. What is it that you find weird about this?
I guess because if one would think the parm name is "karma:global:engine_control-xn__karmaglobalengine_control_rhbg" as it appears in the edit parameter interface window?
However it's set referenced in two different ways as far as I can see. No big deal.
parm("xn__karmaglobalengine_control_rhbg").set('set')
or
parm(hou.text.encode('karma:global:engine_control')).set('set')
Edited by protean - June 27, 2023 17:38:44
john @ goodbyekansas
-
- mtucker
- Staff
- 4527 posts
- Joined: July 2005
- Offline
Ah, sorry for the confusion... Houdini doesn't allow ":" in its parameter names, so when we have a parameter that is meant to correspond to a USD attribute name, we need to "encode" the USD attribute name into something that is:
1) a legal Houdini parameter name
2) decode-able back into the original USD attribute name
The hou.text.encode() and matching hou.text.decode() methods provide this bidirectional mapping. We try to hide this discrepancy from most users by showing the USD attribute name in the UI whenever possible, but when you start writing scripts you do need to become aware of this convention.
1) a legal Houdini parameter name
2) decode-able back into the original USD attribute name
The hou.text.encode() and matching hou.text.decode() methods provide this bidirectional mapping. We try to hide this discrepancy from most users by showing the USD attribute name in the UI whenever possible, but when you start writing scripts you do need to become aware of this convention.
-
- Quick Links