Skip to main content
Participant
April 9, 2025
Open for Voting

Unable to Access Graph Object via Python API in Substance 3D Designer 14.0.0

  • April 9, 2025
  • 1 reply
  • 185 views

Hi everyone,

I'm currently working with Substance 3D Designer 14.0.0 and trying to write a Python script to automatically modify a parameter (e.g., a "Scale" float) and export a sequence of outputs from a specific Output node (with the identifier basecolor).

However, I've run into a major issue: I can't seem to retrieve the graph object via the sd.api module.
Almost every method I tried from the documentation—like sd.getContext(), getPackageMgr(), getGraphFromIdentifier() —returns an error or doesn’t behave as expected.

It seems that either the API structure has changed in this version, or something is missing in how the Python environment is initialized. As a result, I cannot even access the graph object, which blocks all downstream operations like modifying parameters or exporting outputs.

Has anyone successfully used the Python API in 14.0.0 to access the graph and automate exports?
If so, could you please share how you set up the script environment and retrieved the graph?

Thanks in advance!

    1 reply

    Luca Giarrizzo
    Community Manager
    Community Manager
    April 11, 2025

    Hello,

     

    Can you please share your Python code and Console output so we can assess the issue accurately?

     

    As a reference, here is a sample script which prints the non-connectable input properties of all but Output nodes in a Substance graph:

    # -- LIST NODE INPUTS IDS AND TYPES --
    
    import sd
    from sd.api.sdproperty import SDPropertyCategory
    
    # Access core components
    
    app = sd.getContext().getSDApplication()
    ui_mgr = app.getQtForPythonUIMgr()
    
    # Access UI Manager, graph and node
    
    graph = ui_mgr.getCurrentGraph()
    nodes = graph.getNodes()  # Get all nodes in the graph
    
    for node in nodes:
     
     # Ignore Output nodes 
     if node.getDefinition().getId() == "sbs::compositing::output":
      continue
     
     # Get input properties of nodes
     node_props = node.getProperties(SDPropertyCategory.Input)
     print("===")
     print(f"Node: {node.getDefinition().getLabel()}")
     
     for prop in node_props:
      
      if not prop.isConnectable():
       prop_id = prop.getId()  # Get output identifier
       prop_value = node.getInputPropertyValueFromId(prop_id)
    
       if prop_value:
        prop_value = prop_value.get()
       
       # Print the input property identfiers and their values 
       print(f" - {prop_id} = {prop_value}")
    

     

    Best regards.

    Luca Giarrizzo | Quality Engineer - Substance 3D Designer | Adobe