Skip to main content
New Participant
January 18, 2023
Answered

How to set labels for output nodes in Python

  • January 18, 2023
  • 1 reply
  • 630 views
  1. 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.
This topic has been closed for replies.
Correct answer Luca Giarrizzo

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.

1 reply

Luca Giarrizzo
Community Manager
Luca GiarrizzoCommunity ManagerCorrect answer
Community Manager
January 19, 2023

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.

Luca Giarrizzo | Quality Engineer, 3D & Immersive | Adobe
TantanmenAuthor
New Participant
January 19, 2023

Resolved!
Thank you so much!

Luca Giarrizzo
Community Manager
Community Manager
January 19, 2023

I am glad, have fun!

 

Luca Giarrizzo | Quality Engineer, 3D & Immersive | Adobe