Skip to main content
Inspiring
March 8, 2022
Question

Accessing Input Parameters through the Python API

  • March 8, 2022
  • 1 reply
  • 145 views
Hi,
 
I’m running into an issue and I’m still fairly new to using the Substance Designer API so I’m hoping someone can clear things up for me.I’ve attached a simple graph that defines two input parameters: Normal Intensity (normal_intensity) and Normal Format (normal_format).
I then have a Normal Sobel node whose intensity and normal format parameters should be driven by the input parameters on the graph.nHowever when I run the following code in Designer’s python console, even though I have the input parameter for Normal Format set to DirectX, when I try to get the value of normal_format it returns OpenGL.
import sd
from sd.api.sdproperty import SDPropertyCategory

# Get the active graph
sd_app = sd.getContext().getSDApplication()
ui_mgr = sd_app.getQtForPythonUIMgr()
graph = ui_mgr.getCurrentGraph()

nodes = graph.getNodes()
for node in nodes:
	prop = node.getPropertyFromId("normal_format", SDPropertyCategory.Input)
	if not prop:
		continue
	value_obj = node.getPropertyValue(prop)
	print(value_obj.getValueId())
Returns:
[MSG][8222][Python]OpenGL
I checked the normal_sobel.sbs file which the Normal Sobel node references and it has OpenGL as the default so I think it’s getting the value from there instead of the input parameter of my graph. Similarly, if I try to get the property for normal_intensity, the property can’t be found. If I look for a property with the label Intensity then it returns the default intensity value defined in normal_sobel.sbs.
 
1) Are the input parameters set up correctly in our graph?
2) Are we using the API correctly to get the value of the properties driven by input parameters?
3) Is there a way to determine if a property should be driven by the graph’s input parameter using the API?
 
Any help would be greatly appreciated. Thanks!
Reuben
This topic has been closed for replies.

1 reply

Inspiring
March 15, 2022

bumping