Hi,
Is it possible to set spare parameters value from Python Processor or any other PDG Node?
Thanks
Ostap
Set spare parameters from Python Processor Node
2288 4 0- Ostap
- Member
- 209 posts
- Joined: Nov. 2010
- Offline
- tpetrick
- Staff
- 578 posts
- Joined: May 2014
- Offline
Yep, it's possible to add spare parms to any TOP node. For example, in Python Processor code you can evaluate any params on the node, including spare parms, like so:
# Evaluate a parameter with no work item self['example'].evaluateInt() # Evaluate at a specific index self['example'].evaluateInt(2) # Evaluate the parameter against a specific work item. This is needed if you want @attribute expressions to be evalauted. new_item = itemholder.addWorkItem() self['other_example'].evaluateString(new_item) # Specified work item and index self['other_example'].evaluateString(new_item, 1)
- Ostap
- Member
- 209 posts
- Joined: Nov. 2010
- Offline
- tpetrick
- Staff
- 578 posts
- Joined: May 2014
- Offline
The code in the Python Processor node executes during the cook, within a context that access to the underyling PDG node/API. You can look up the corresponding TOP and set parameters on it like so:
However this isn't recommended, because it means that you'll be modifying the TOP node from PDG, during the cook. What are you trying to do that needs parms to modified during the cook?
import hou node_id = self.customId top_node = hou.nodeBySessionId(node_id) top_node.parm("newparameter").set("test")
However this isn't recommended, because it means that you'll be modifying the TOP node from PDG, during the cook. What are you trying to do that needs parms to modified during the cook?
- Ostap
- Member
- 209 posts
- Joined: Nov. 2010
- Offline
-
- Quick Links