AcademySoftwareFoundation / MaterialX

MaterialX is an open standard for the exchange of rich material and look-development content across applications and renderers.
http://www.materialx.org/
Apache License 2.0
1.87k stars 352 forks source link

Graph Editor: Auto layout is not applied for nodegraph without outputs #1449

Closed marwie closed 1 year ago

marwie commented 1 year ago

It seems like subgraph auto layout is only applied when the graph has one or more outputs

This is the subgraph when opening it. Notice that the nodes should be flipped 20230816-094528_MaterialX_Graph_Editor-needle

Here is the graph

<?xml version="1.0"?>
<materialx name="" version="1.38" >
    <nodegraph name="needle_shadergraph" >
        <input name="_MyColor" type="color4" value="0.8962264, 0.2494215, 0.2494215, 1.0" />
        <constant name="_MyColor_constant" type="color4" >
            <input name="value" type="color4" interfacename="_MyColor" />
        </constant>
    </nodegraph>
    <standard_surface name="needle_standard_surface" type="surfaceshader" >
        <input name="specular_roughness" type="float" value="1.0" />
        <input name="metalness" type="float" value="1.0" />
    </standard_surface>
    <surfacematerial name="Default" type="material" >
        <input name="surfaceshader" type="surfaceshader" nodename="needle_standard_surface" />
    </surfacematerial>
</materialx>

When adding a output node to the needle_shadergraph nodegraph it is properly layouted:

image

Extras

Sometimes the subgraph also looks like this when opening image

in which case auto layout doesnt seem to do anything https://github.com/AcademySoftwareFoundation/MaterialX/assets/5083203/88b7db99-7fc6-47ce-8e12-59ae71bc3d16

sandersteen commented 1 year ago

Starting to look around material X and it's viewer I figured this would be an easy one to start and do my bit for the ASWF dev days. However, it appears this is no longer an issue?

https://github.com/AcademySoftwareFoundation/MaterialX/assets/97490100/d5d60132-1084-4018-8c2c-6858b47a1dfb

jstone-lucasfilm commented 1 year ago

Oh, good catch, @sandersteen.

It sounds like this was fixed as a side effect of other Graph Editor improvements for MaterialX 1.38.8. If that's the case, then feel free to look at other tasks in the Graph Editor space, including any of the subtasks in this multi-part issue:

https://github.com/AcademySoftwareFoundation/MaterialX/issues/1398

jstone-lucasfilm commented 1 year ago

I'll go ahead and remove the Good First Issue label from this one, and we'll validate that we get the same correct results as in your video above.

jstone-lucasfilm commented 1 year ago

I've confirmed the findings of @sandersteen, and this bug is indeed fixed in the main branch, so I'll mark this as resolved.