Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Python API: SDUIMgr.focusGraphNode() issue

Contributor ,
Feb 13, 2025 Feb 13, 2025

Hi, I am experimenting with SDUIMgr.focusGraphNode() and it seems this is not working for items inside a PixelProcessor or an FXMap. Is this a known issue?

Bug Unresolved
TOPICS
Bugs & Crashes , Scripting
249
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , Mar 25, 2025 Mar 25, 2025

Hello Olivier,

 

Thank you for providing this sample script and for your patience. I can reproduce these issues.

 

Indeed, graphs referenced by Pixel Processor and FX-Map nodes cannot be opened using the openResourceInEditor() method, and trying to focus on nodes in these graphs using the focusGraphNode() method results in SDApiError.Undefined exceptions.

 

I have reported these bugs to the team, with a sample graph and script. I will also reference this thread in the bug report.

 

Thank you for

...
Translate
6 Comments
Adobe Employee ,
Feb 13, 2025 Feb 13, 2025

Hello @_Olivier_L,

 

The method appears to work in function graphs and FX-Map graphs in my testing.

Can you share your script and Console output when the method fails to work as expected?

 

As a starting point, I suggest checking that Graph view IDs are tracked and updated reliably before being  passed to the focusGraphNode() method.

 

Best regards.

Luca Giarrizzo | Quality Engineer, 3D & Immersive | Adobe
Translate
Report
Contributor ,
Feb 28, 2025 Feb 28, 2025

Would you have an example code/graph with this working? I have tried many times in my plugin and it won't work for me. This is not the only problem, openResourceInEditor() also fails to open the content of a Pixel Processor or an FX-Map. This is a pre-requisite to use focusGraphNode().

Translate
Report
Contributor ,
Mar 22, 2025 Mar 22, 2025

@Luca Giarrizzo  can you please try with the code below (call "test_openingAndFocusing()" in your plugin) ? You'll need to have open in Designer a single package with a single graph having at least 2 nodes, an FX-Map and an Pixel Processor, with at least one node inside each of them. The code will try to open the FX-Map or Pixel Processor (depending on flag "use_fx_map") in the editor and focus on the first found node inside either of them. You will see there are multiple problems:

- one is the openResourceInEditor call will not open the content of the FX-Map or Pixel Processor

- another is an exception when focusing on the node (the exception does not trigger always, I've seen it for the Pixel Processor, it may depend if graph is open (manually) or not.

[ERR][1050][Python]  File "C:\Program Files/Adobe/Adobe Substance 3D Designer/resources/python\sd\api\sduimgr.py", line 350, in focusGraphNode
[ERR][1051][Python]    raise APIException(SDApiError(_res))
[ERR][1052][Python]sd.api.apiexception.APIException: SDApiError.Undefined

 

The code to insert in your plugin:

 

import sd
from sd.api.sdgraph import SDGraph

def test_graphViewIDFromGraph(graph):
    ui_mgr = sd.getContext().getSDApplication().getUIMgr()
    count = ui_mgr.getGraphViewIDCount()
    for i in range(0, count):
        graphViewID = ui_mgr.getGraphViewIDAt(i)
        g = ui_mgr.getGraphFromGraphViewID(graphViewID)
        if g.getIdentifier() == graph.getIdentifier():
            return graphViewID
    return None

def test_focusFirstNodeInGraph(graph):
    sd_app = sd.getContext().getSDApplication()
    ui_mgr = sd_app.getUIMgr()
    nodes = graph.getNodes()
    for n in range(0, nodes.getSize()):
        node = nodes.getItem(n)
        print('Opening ' + str(graph))
        ui_mgr.openResourceInEditor(graph)
        gvid = test_graphViewIDFromGraph(graph)
        if gvid:
            print('Found graph view ID ' + str(gvid))
            print('Focusing on '+ str(node))
            ui_mgr.focusGraphNode(gvid, node)
        else:
            print('graph view id not found for graph ' + str(graph))
        break

def test_openingAndFocusing():
    use_fx_map = False   # True to open and focus on node in FX-Map, False to open and focus on node in Pixel Processor
    sd_app = sd.getContext().getSDApplication()
    packages = sd_app.getPackageMgr().getUserPackages()
    for p in range(0, packages.getSize()):
        pkg = packages.getItem(p)
        resources = pkg.getChildrenResources(False)
        if resources:
            for r in range(0, resources.getSize()):
                resource = resources.getItem(r)
                if isinstance(resource, SDGraph):
                    nodes = resource.getNodes()
                    for n in range(0, nodes.getSize()):
                        node = nodes.getItem(n)
                        definition_id = node.getDefinition().getId()                         
                        if (use_fx_map and definition_id == 'sbs::compositing::fxmaps') \
                            or (not use_fx_map and definition_id =='sbs::compositing::pixelprocessor'):
                                graph = node.getReferencedResource()
                                test_focusFirstNodeInGraph(graph)
Translate
Report
Adobe Employee ,
Mar 25, 2025 Mar 25, 2025

Hello Olivier,

 

Thank you for providing this sample script and for your patience. I can reproduce these issues.

 

Indeed, graphs referenced by Pixel Processor and FX-Map nodes cannot be opened using the openResourceInEditor() method, and trying to focus on nodes in these graphs using the focusGraphNode() method results in SDApiError.Undefined exceptions.

 

I have reported these bugs to the team, with a sample graph and script. I will also reference this thread in the bug report.

 

Thank you for your help!

 

Luca Giarrizzo | Quality Engineer, 3D & Immersive | Adobe
Translate
Report
Contributor ,
Mar 25, 2025 Mar 25, 2025

Thanks Luca, I also noticed we cannot open parameter function graphs with openResourceInEditor()

Translate
Report
Adobe Employee ,
Mar 25, 2025 Mar 25, 2025
LATEST

Noted, I observed the same. Thank you!

 

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