Search - User list
Full Version: Set spare parameters from Python Processor Node
Root » PDG/TOPs » Set spare parameters from Python Processor Node

Is it possible to set spare parameters value from Python Processor or any other PDG Node?

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

# Evaluate at a specific index

# Evaluate the parameter against a specific work item. This is needed if you want @attribute expressions to be evalauted.
new_item = itemholder.addWorkItem()

# Specified work item and index
self['other_example'].evaluateString(new_item, 1)
But how to set the values? I found only how to evaluate the parms.
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:

import hou

node_id = self.customId
top_node = hou.nodeBySessionId(node_id)

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?
In my case, it is for data visual representation without clicking on workitems.
I agree that we need to be careful with this possibility but anyway, nice that we have this option.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB