Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation incorrectly categorizes top level inputs connected to graphs as invalid #1832

Open
kwokcb opened this issue May 22, 2024 · 0 comments

Comments

@kwokcb
Copy link
Contributor

kwokcb commented May 22, 2024

Issue

Validation considers a top level input conneted to an interface input on a nodegraph as invalid even though this
should be valid and is accepted by code generation.

Test data

<?xml version="1.0"?>
<materialx version="1.39" colorspace="lin_rec709">
  <input name="input_color4" type="color3" value="0,0,0" xpos="10.094203" ypos="0.439655" />
  <input name="input_float1" type="float" value="0" xpos="9.862319" ypos="1.818966" />
  <nodegraph name="custom_graph_1">
    <input name="matrixIn" type="matrix33" value="1,0.2,0.2,0,1,0,0,0,1" />
    <input name="floatIn" type="float" interfacename="input_float1" />
    <input name="color3In" type="color3" interfacename="input_color4" />
    <output name="output_matrix34" type="matrix33" nodename="dot_matrix34" />
    <output name="floatOut" type="float" nodename="dot_float1" />
    <output name="color3Out" type="color3" nodename="dot_color4" />
    <output name="color3Gamma22Out" type="color3" nodename="colorcorrect_color4" />
    <dot name="dot_float1" type="float">
      <input name="in" type="float" interfacename="floatIn" />
      <input name="note" type="string" value="" />
    </dot>
    <dot name="dot_matrix34" type="matrix33">
      <input name="in" type="matrix33" interfacename="matrixIn" />
      <input name="note" type="string" value="" />
    </dot>
    <dot name="dot_color4" type="color3">
      <input name="in" type="color3" interfacename="color3In" />
      <input name="note" type="string" value="" />
    </dot>
    <colorcorrect name="colorcorrect_color4" type="color3">
      <input name="in" type="color3" interfacename="color3In" />
      <input name="hue" type="float" value="0" />
      <input name="saturation" type="float" value="1" />
      <input name="gamma" type="float" value="2.2" />
      <input name="lift" type="float" value="0" />
      <input name="gain" type="float" value="1" />
      <input name="contrast" type="float" value="1" />
      <input name="contrastpivot" type="float" value="0.5" />
      <input name="exposure" type="float" value="0" />
    </colorcorrect>
  </nodegraph>
  <nodegraph name="ramp_graph">
    <input name="input_vector3" type="vector2" value="0,0" />
    <input name="Left_color" type="color3" value="0, 0, 0" />
    <input name="Right_color" type="color3" output="color3Gamma22Out" nodegraph="custom_graph_1" />
    <output name="out" type="color3" nodename="ramplr_color4" />
    <ramplr name="ramplr_color4" type="color3">
      <input name="valuel" type="color3" interfacename="Left_color" />
      <input name="valuer" type="color3" interfacename="Right_color" />
      <input name="texcoord" type="vector2" interfacename="input_vector3" />
    </ramplr>
  </nodegraph>
  <surface_unlit name="surface_unlit" type="surfaceshader" xpos="20.028986" ypos="0.784483">
    <input name="emission_color" type="color3" output="out" nodegraph="ramp_graph" />
  </surface_unlit>
  <surfacematerial name="surfacematerial" type="material" xpos="22.695652" ypos="0.732759">
    <input name="surfaceshader" type="surfaceshader" nodename="surface_unlit" />
  </surfacematerial>
</materialx>

These interface connections are considered invalid.

  <input name="floatIn" type="float" interfacename="input_float1" />
   <input name="color3In" type="color3" interfacename="input_color4" />

with these errors:

Interface name not found in referenced declaration: <input name="floatIn" type="float" interfacename="input_float1">
Interface name not found in referenced declaration: <input name="color3In" type="color3" interfacename="input_color4">

Code gen and rendering see fine if you ignore the validation error. This is an ESSL render

Proposed Fix

The issue appears to be that when trying to find a parent graph element, the top level document (which is a graph) is
precluded here:

ConstNodeGraphPtr nodeGraph = getAncestorOfType<NodeGraph>();

precludes checking for the document Seems like the fix is to check for GraphElement and not NodeGraph.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant