-
Notifications
You must be signed in to change notification settings - Fork 23
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
1.38 Explicit nodegraph inputs and nodegraph input connections #1053
Changes from 42 commits
6ff89e0
3983d41
4fe36e5
e2260d5
a92ad8a
2e25652
92546db
a68aac2
134fb2d
c5fd321
0189c3c
7ca7460
3f95de6
459c16c
2cc92db
68e97c0
6b68b55
dcc2826
340d957
9c5dc54
bfa2a8c
16693d6
f5eccbc
da83fa9
1b381a4
9258b8d
97da53f
2e8e67a
6a887a4
9026165
8087988
ad320a3
8ad4e98
cf45883
710c654
b7a1ff2
46600e8
acde996
da21e8f
91d6b54
d4e5dcd
a160b32
12c481f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Change Log | ||
|
||
<<<<<<< HEAD | ||
## [1.38] - Development | ||
|
||
### v1.38_adsk_development2 : WIP | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?xml version="1.0"?> | ||
<materialx version="1.37"> | ||
<nodegraph name="upstream3" xpos="10" ypos="153" > | ||
<input name="file" type="filename" uniform="true" value="resources/Images/cloth.png" /> | ||
<input name="file1" type="filename" uniform="true" value="resources/Images/grid.png" /> | ||
<image name="upstream_image" type="color3" xpos="10" ypos="8.86024"> | ||
<input name="file" type="filename" uniform="true" interfacename="file" value="resources/Images/cloth.png" /> | ||
<input name="frameoffset" type="integer" uniform="true" value="0" /> | ||
</image> | ||
<image name="upstream_image1" type="color3" xpos="19.1695" ypos="421"> | ||
<input name="file" type="filename" uniform="true" interfacename="file1" value="resources/Images/grid.png" /> | ||
<input name="frameoffset" type="integer" uniform="true" value="0" /> | ||
</image> | ||
<output name="out" type="color3" nodename="upstream_image" /> | ||
<output name="out1" type="color3" nodename="upstream_image1" /> | ||
</nodegraph> | ||
|
||
|
||
<nodegraph name="upstream2" xpos="315" ypos="82" > | ||
<input name="upstream2_in1" type="color3" nodegraph="upstream3" output="out" value="0, 1, 0" /> | ||
<input name="upstream2_in2" type="color3" nodegraph="upstream3" output="out1" value="0, 1, 0" /> | ||
<multiply name="multiply_by_image" type="color3" xpos="333.028" ypos="-27.8587"> | ||
<input name="in1" type="color3" interfacename="upstream2_in1" value="0, 1, 0" /> | ||
<input name="in2" type="color3" nodename="image" /> | ||
</multiply> | ||
<multiply name="make_red" type="color3" xpos="361.069" ypos="248.883"> | ||
<input name="in1" type="color3" interfacename="upstream2_in2" value="0, 1, 0" /> | ||
<input name="in2" type="color3" value="1, 0.1, 0.1" /> | ||
</multiply> | ||
<image name="image" type="color3" xpos="-30.4805" ypos="-249.603"> | ||
<input name="file" type="filename" uniform="true" value="resources/Images/grid.png" /> | ||
</image> | ||
<output name="upstream2_out1" type="color3" nodename="multiply_by_image" /> | ||
<output name="upstream2_out2" type="color3" nodename="make_red" /> | ||
</nodegraph> | ||
|
||
<nodegraph name="upstream1" xpos="620" ypos="10" > | ||
<input name="upstream1_in1" type="color3" nodegraph="upstream2" output="upstream2_out1" value="0, 1, 0" /> | ||
<input name="upstream1_in2" type="color3" nodegraph="upstream2" output="upstream2_out2" value="0, 1, 0" /> | ||
<multiply name="make_yellow" type="color3" xpos="-77.0636" ypos="-139.845"> | ||
<input name="in1" type="color3" interfacename="upstream1_in1" value="0, 1, 0" /> | ||
<input name="in2" type="color3" value="1, 1, 0" /> | ||
</multiply> | ||
<multiply name="remove_red" type="color3" xpos="-75.6416" ypos="242.103"> | ||
<input name="in1" type="color3" interfacename="upstream1_in2" value="0, 1, 0" /> | ||
<input name="in2" type="color3" value="0, 1, 1" /> | ||
</multiply> | ||
<output name="upstream1_out1" type="color3" nodename="make_yellow" /> | ||
<output name="upstream1_out2" type="color3" nodename="remove_red" /> | ||
</nodegraph> | ||
|
||
<output name="top_upstream1_out1" type="color3" nodename="upstream1" output="upstream1_out1"/> | ||
<output name="top_upstream1_out2" type="color3" nodename="upstream1" output="upstream1_out2"/> | ||
|
||
<standard_surface name="standard_surface" type="surfaceshader" version="1.0.1" xpos="949.876" ypos="-189.576"> | ||
<input name="base_color" type="color3" nodegraph="upstream1" output="upstream1_out1" /> | ||
</standard_surface> | ||
<standard_surface name="standard_surface1" type="surfaceshader" version="1.0.1" xpos="940.476" ypos="307.63"> | ||
<input name="base_color" type="color3" nodegraph="upstream1" output="upstream1_out2" /> | ||
</standard_surface> | ||
<surfacematerial name="surfacematerial" type="material" xpos="1303.4" ypos="-234.282"> | ||
<input name="surfaceshader" type="surfaceshader" nodename="standard_surface" /> | ||
<input name="displacementshader" type="displacementshader" value="" /> | ||
</surfacematerial> | ||
<surfacematerial name="surfacematerial1" type="material" xpos="1325.2" ypos="245.001"> | ||
<input name="surfaceshader" type="surfaceshader" nodename="standard_surface1" /> | ||
<input name="displacementshader" type="displacementshader" value="" /> | ||
</surfacematerial> | ||
</materialx> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<?xml version="1.0"?> | ||
<materialx version="1.37"> | ||
<!-- Nodegraph to nodegraph connections --> | ||
<nodegraph name="upstream_graph" > | ||
<input name="file" type="filename" value="resources/Images/grid.png" /> | ||
<input name="file2" type="filename" value="resources/Images/cloth.png" /> | ||
<image name="image" type="color3"> | ||
<input name="file" type="filename" interfacename="file" value="resources/Images/grid.png" /> | ||
</image> | ||
<image name="image2" type="color3"> | ||
<input name="file" type="filename" interfacename="file2" value="resources/Images/cloth.png" /> | ||
</image> | ||
<output name="graph_out_image" type="color3" nodename="image" /> | ||
<output name="graph_out_image2" type="color3" nodename="image2" /> | ||
</nodegraph> | ||
<nodegraph name="graph_graph" > | ||
<input name="input" type="color3" nodegraph="upstream_graph" output="graph_out_image" value="1, 0, 0" /> | ||
<input name="input2" type="color3" nodegraph="upstream_graph" output="graph_out_image2" value="1, 0, 0" /> | ||
<multiply name="multiply" type="color3"> | ||
<input name="in1" type="color3" interfacename="input" value="1, 0, 0" /> | ||
<input name="in2" type="color3" value="0.4, 0.4, 0.4" /> | ||
</multiply> | ||
<multiply name="multiply2" type="color3"> | ||
<input name="in1" type="color3" interfacename="input2" value="1, 0, 0" /> | ||
<input name="in2" type="color3" value="0.4, 0.4, 0.4" /> | ||
</multiply> | ||
<output name="graph_graph_out" type="color3" nodename="multiply" /> | ||
<output name="graph_graph_out2" type="color3" nodename="multiply2" /> | ||
</nodegraph> | ||
<nodegraph name="surf_graph_graph" > | ||
<input name="input" type="color3" nodegraph="graph_graph" output="graph_graph_out" value="1, 1, 1" /> | ||
<input name="input2" type="color3" nodegraph="graph_graph" output="graph_graph_out2" value="1, 1, 1" /> | ||
<standard_surface name="default_shader" type="surfaceshader"> | ||
<input name="base_color" type="color3" interfacename="input" value="1, 1, 1" /> | ||
</standard_surface> | ||
<standard_surface name="default_shader2" type="surfaceshader"> | ||
<input name="base_color" type="color3" interfacename="input2" value="1, 1, 1" /> | ||
</standard_surface> | ||
<output name="surf_graph_graph_out" type="surfaceshader" nodename="default_shader" /> | ||
<output name="surf_graph_graph_out2" type="surfaceshader" nodename="default_shader2" /> | ||
</nodegraph> | ||
|
||
<!-- Connect node instance with multiple outputs to nodegraph --> | ||
<nodedef name="ND_upstream_graph" node="upstream_graph_def" version="1.0" isdefaultversion="true" nodegroup="procedural2d"> | ||
<input name="nd_file" type="filename" uniform="true" value="resources/Images/grid.png" /> | ||
<input name="nd_file2" type="filename" uniform="true" value="resources/Images/cloth.png" /> | ||
<output name="nd_graph_out_image" type="color3" value="0, 0, 0" /> | ||
<output name="nd_graph_out_image2" type="color3" value="0, 0, 0" /> | ||
</nodedef> | ||
<nodegraph name="NG_upstream_graph" nodedef="ND_upstream_graph" > | ||
<input name="nd_file" type="filename" uniform="true" value="resources/Images/grid.png" /> | ||
<input name="nd_file2" type="filename" uniform="true" value="resources/Images/cloth.png" /> | ||
<image name="image" type="color3" xpos="-79" ypos="-448.596"> | ||
<input name="file" type="filename" uniform="true" interfacename="nd_file" value="resources/Images/grid.png" /> | ||
</image> | ||
<image name="image2" type="color3"> | ||
<input name="file" type="filename" uniform="true" interfacename="nd_file2" value="resources/Images/cloth.png" /> | ||
</image> | ||
<output name="nd_graph_out_image" type="color3" nodename="image" /> | ||
<output name="nd_graph_out_image2" type="color3" nodename="image2" /> | ||
</nodegraph> | ||
<upstream_graph_def name="upstream_graph_instance" type="multioutput"> | ||
<output name="nd_graph_out_image" type="color3" /> | ||
<output name="nd_graph_out_image2" type="color3" /> | ||
</upstream_graph_def> | ||
<nodegraph name="nd_graph_graph" > | ||
<input name="nd_input" type="color3" nodename="upstream_graph_instance" output="nd_graph_out_image" value="1, 0, 0" /> | ||
<input name="nd_input2" type="color3" nodename="upstream_graph_instance" output="nd_graph_out_image2" value="1, 0, 0" /> | ||
<multiply name="multiply" type="color3"> | ||
<input name="in1" type="color3" interfacename="nd_input" value="1, 0, 0" /> | ||
<input name="in2" type="color3" value="0.4, 0.4, 0.4" /> | ||
</multiply> | ||
<multiply name="multiply2" type="color3"> | ||
<input name="in1" type="color3" interfacename="nd_input2" value="1, 0, 0" /> | ||
<input name="in2" type="color3" value="0.4, 0.4, 0.4" /> | ||
</multiply> | ||
<output name="nd_graph_graph_out" type="color3" nodename="multiply" /> | ||
<output name="nd_graph_graph_out2" type="color3" nodename="multiply2" /> | ||
</nodegraph> | ||
<nodegraph name="ng_surf_graph_graph" > | ||
<input name="nd_input" type="color3" nodename="upstream_graph_instance" output="nd_graph_out_image" value="1, 1, 1" /> | ||
<input name="nd_input2" type="color3" nodename="upstream_graph_instance" output="nd_graph_out_image2" value="1, 1, 1" /> | ||
<standard_surface name="default_shader" type="surfaceshader"> | ||
<input name="base_color" type="color3" interfacename="nd_input" value="1, 1, 1" /> | ||
</standard_surface> | ||
<standard_surface name="default_shader2" type="surfaceshader"> | ||
<input name="base_color" type="color3" interfacename="nd_input2" value="1, 1, 1" /> | ||
</standard_surface> | ||
<output name="nd_surf_graph_graph_out" type="surfaceshader" nodename="default_shader" /> | ||
<output name="nd_surf_graph_graph_out2" type="surfaceshader" nodename="default_shader2" /> | ||
</nodegraph> | ||
|
||
<!-- Nodegraph to nodegraph to top level shader and utility node --> | ||
<standard_surface name="default_shader_top" type="surfaceshader"> | ||
<input name="base_color" type="color3" nodegraph="graph_graph" output="graph_graph_out" /> | ||
</standard_surface> | ||
<output name="surf_graph_graph_out_top" type="surfaceshader" nodename="default_shader_top" /> | ||
<multiply name="multiply_top" type="color3"> | ||
<input name="in1" type="color3" nodegraph="graph_graph" output="graph_graph_out" /> | ||
<input name="in2" type="color3" value="0.4, 0.4, 0.4" /> | ||
</multiply> | ||
<output name="graph_graph_out_top" type="color3" nodename="multiply_top" /> | ||
|
||
<!-- Nodegraph to node connection --> | ||
<image name="upstream_image" type="color3"> | ||
<input name="file" type="filename" interfacename="file" value="resources/Images/cloth.png" /> | ||
</image> | ||
<nodegraph name="graph_to_node" > | ||
<input name="input" type="color3" nodename="upstream_image" value="0, 1, 0" /> | ||
<multiply name="multiply" type="color3"> | ||
<input name="in1" type="color3" interfacename="input" value="0, 1, 0" /> | ||
<input name="in2" type="color3" value="0.4, 0.4, 0.4" /> | ||
</multiply> | ||
<output name="node_graph_out" type="color3" nodename="multiply" /> | ||
</nodegraph> | ||
<nodegraph name="surf_graph_node" > | ||
<input name="input" type="color3" nodegraph="graph_to_node" value="1, 1, 1" /> | ||
<standard_surface name="default_shader" type="surfaceshader"> | ||
<input name="base_color" type="color3" interfacename="input" value="1, 1, 1" /> | ||
</standard_surface> | ||
<output name="surf_graph_node_out" type="surfaceshader" nodename="default_shader" /> | ||
</nodegraph> | ||
|
||
</materialx> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,10 @@ | |
<materialx version="1.37"> | ||
<nodegraph name="parameter_as_input" fileprefix="resources/Images/"> | ||
<constant name="constant" type="color3"> | ||
<input name="value" type="color3" interfacename="value1" value="1, 0, 0" /> | ||
<input name="value" type="color3" value="1, 0, 0" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This invalid case of an interfacename w/o a proper input is now caught. |
||
</constant> | ||
<constant name="constant1" type="color3"> | ||
<input name="value" type="color3" interfacename="value" value="0, 1, 0" /> | ||
<input name="value" type="color3" value="0, 1, 0" /> | ||
</constant> | ||
<ramp4 name="ramp4" type="color3"> | ||
<input name="valuetl" type="color3" nodename="ramp5" /> | ||
|
@@ -15,8 +15,8 @@ | |
</ramp4> | ||
<ramp4 name="ramp5" type="color3"> | ||
<input name="valuetl" type="color3" nodename="image" /> | ||
<input name="valuetr" type="color3" interfacename="valuetr" value="0, 1, 1" /> | ||
<input name="valuebl" type="color3" interfacename="valuebl" value="0, 0, 0" /> | ||
<input name="valuetr" type="color3" value="0, 1, 1" /> | ||
<input name="valuebl" type="color3" value="0, 0, 0" /> | ||
<input name="valuebr" type="color3" nodename="image" /> | ||
</ramp4> | ||
<image name="image" type="color3"> | ||
|
@@ -33,12 +33,12 @@ | |
<splitlr name="splitlr" type="color3"> | ||
<input name="valuel" type="color3" nodename="image" /> | ||
<input name="valuer" type="color3" nodename="constant" /> | ||
<input name="center" type="float" interfacename="center" value="0.4" /> | ||
<input name="center" type="float" value="0.4" /> | ||
</splitlr> | ||
<splittb name="splittb" type="color3"> | ||
<input name="valuet" type="color3" nodename="splitlr" /> | ||
<input name="valueb" type="color3" nodename="noise2d" /> | ||
<input name="center" type="float" interfacename="center" value="0.4" /> | ||
<input name="center" type="float" value="0.4" /> | ||
</splittb> | ||
<noise2d name="noise2d" type="color3"> | ||
<input name="pivot" type="float" nodename="noise2d1" /> | ||
|
@@ -63,14 +63,14 @@ | |
<input name="default" type="integer" value="0" uniform="true" /> | ||
</geompropvalue> | ||
<constant name="constant2" type="string"> | ||
<input name="value" type="string" interfacename="my_tangent_name" value="mytangents" /> | ||
<input name="value" type="string" value="mytangents" /> | ||
</constant> | ||
<invert name="invert" type="color3"> | ||
<input name="in" type="color3" nodename="splittb" /> | ||
<input name="amount" type="color3" nodename="noise2d" /> | ||
</invert> | ||
<constant name="constant3" type="filename"> | ||
<input name="value" type="filename" interfacename="file" value="grid.png" /> | ||
<input name="value" type="filename" value="grid.png" /> | ||
</constant> | ||
<output name="out" type="color3" nodename="ramp4" /> | ||
<output name="out1" type="color3" nodename="splittb" /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -238,20 +238,33 @@ OutputPtr Input::getConnectedOutput() const | |
// Look for output on a node | ||
else if (hasNodeName()) | ||
{ | ||
ConstGraphElementPtr graph = getAncestorOfType<GraphElement>(); | ||
NodePtr node = graph ? graph->getNode(getNodeName()) : nullptr; | ||
if (node) | ||
const string& nodeName = getNodeName(); | ||
ConstElementPtr startingElement = getParent(); | ||
if (startingElement) | ||
{ | ||
std::vector<OutputPtr> outputs = node->getOutputs(); | ||
if (!outputs.empty()) | ||
// Look for a node reference above the nodegraph if input is a direct child. | ||
if (startingElement->isA<NodeGraph>()) | ||
{ | ||
if (outputString.empty()) | ||
{ | ||
result = outputs[0]; | ||
} | ||
else | ||
startingElement = startingElement->getParent(); | ||
} | ||
if (startingElement) | ||
{ | ||
ConstGraphElementPtr graph = startingElement->getAncestorOfType<GraphElement>(); | ||
NodePtr node = graph ? graph->getNode(nodeName) : nullptr; | ||
if (node) | ||
{ | ||
result = node->getOutput(outputString); | ||
std::vector<OutputPtr> outputs = node->getOutputs(); | ||
if (!outputs.empty()) | ||
{ | ||
if (outputString.empty()) | ||
{ | ||
result = outputs[0]; | ||
} | ||
else | ||
{ | ||
result = node->getOutput(outputString); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
@@ -264,8 +277,29 @@ OutputPtr Input::getConnectedOutput() const | |
return result; | ||
} | ||
|
||
InputPtr Input::getConnectedInterface() const | ||
{ | ||
const string& interfaceName = getInterfaceName(); | ||
if (!interfaceName.empty()) | ||
{ | ||
ConstNodeGraphPtr graph = getAncestorOfType<NodeGraph>(); | ||
if (graph) | ||
{ | ||
return graph->getInput(interfaceName); | ||
} | ||
} | ||
return nullptr; | ||
} | ||
|
||
NodePtr Input::getConnectedNode() const | ||
{ | ||
// Traverse through interface names to nodegraph input | ||
InputPtr graphInput = getConnectedInterface(); | ||
if (graphInput && (graphInput->hasNodeName() || graphInput->hasNodeGraphString())) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this input has an interfacename, then traverse through to that input to find any upstream connection. |
||
{ | ||
return graphInput->getConnectedNode(); | ||
} | ||
|
||
OutputPtr output = getConnectedOutput(); | ||
if (output) | ||
{ | ||
|
@@ -275,11 +309,24 @@ NodePtr Input::getConnectedNode() const | |
} | ||
if (hasNodeName()) | ||
{ | ||
ConstGraphElementPtr graph = getAncestorOfType<GraphElement>(); | ||
NodePtr node = graph ? graph->getNode(getNodeName()) : nullptr; | ||
if (node) | ||
const string& nodeName = getNodeName(); | ||
ConstElementPtr startingElement = getParent(); | ||
if (startingElement) | ||
{ | ||
return node; | ||
// Look for a node reference above the nodegraph if input is a direct child. | ||
if (startingElement->isA<NodeGraph>()) | ||
{ | ||
startingElement = startingElement->getParent(); | ||
} | ||
if (startingElement) | ||
{ | ||
ConstGraphElementPtr graph = startingElement->getAncestorOfType<GraphElement>(); | ||
NodePtr node = graph ? graph->getNode(nodeName) : nullptr; | ||
if (node) | ||
{ | ||
return node; | ||
} | ||
} | ||
} | ||
} | ||
return PortElement::getConnectedNode(); | ||
|
@@ -303,6 +350,11 @@ bool Input::validate(string* message) const | |
{ | ||
validateRequire(getDefaultGeomProp() != nullptr, res, message, "Invalid defaultgeomprop string"); | ||
} | ||
InputPtr interfaceInput = getConnectedInterface(); | ||
if (interfaceInput) | ||
{ | ||
return interfaceInput->validate() && res; | ||
} | ||
return PortElement::validate(message) && res; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge leftover