Answered
How to set labels for output nodes in Python
- I would like to set labels for output nodes in Python, but the documentation only tells me how to get them.
If it is possible to set labels, I would like to know how to write them.
Hello @Tantanmen,
You may use the setAnnotationPropertyValueFromId() and use "label" as the first argument – I.e., the target property's identifier.
Here is a simple sample script which assigns the same label to all Output nodes in a Substance compositing graph:
import sd
from sd.api import sdvaluestring
app = sd.getContext().getSDApplication()
ui_mgr = app.getQtForPythonUIMgr()
graph = ui_mgr.getCurrentGraph()
nodes = graph.getNodes()
for node in nodes:
if "output" in node.getDefinition().getId():
node.setAnnotationPropertyValueFromId(
"label",
sdvaluestring.SDValueString.sNew("My Label")
)
I hope this is helpful!
Best regards.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.