Skip to content

Commit ad71ce0

Browse files
Fix UiEdge node order in Graph Editor (#2770)
This changelist fixes a swapped argument order in the `UiEdge` constructor, where the upstream and downstream nodes were inverted relative to the usage of the constructor in the codebase. Callers of the `UiEdge` constructor have been using the following convention, as seen in the `Graph::createEdge` method: ``` UiEdge newEdge = UiEdge(upNode, downNode, connectingInput); ``` But the constructor itself has been expecting arguments in the reverse order, as seen here: ``` UiEdge(UiNodePtr uiDown, UiNodePtr uiUp, mx::InputPtr input) ``` This changelist updates the arguments of the `UiEdge` constructor and all dependent code, making the semantics of `UiEdge::getUp` and `UiEdge::getDown` consistent across the Graph Editor codebase.
1 parent 0a1b924 commit ad71ce0

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

source/MaterialXGraphEditor/UiNode.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,18 @@ UiNodePtr UiNode::getConnectedNode(const std::string& name)
106106
{
107107
if (edge.getInputName() == name)
108108
{
109-
return edge.getDown();
109+
return edge.getUp();
110110
}
111-
else if (edge.getDown()->getName() == name)
111+
else if (edge.getUp()->getName() == name)
112112
{
113-
return edge.getDown();
113+
return edge.getUp();
114114
}
115115
}
116116
for (const UiEdge& edge : _edges)
117117
{
118118
if (edge.getInputName().empty())
119119
{
120-
return edge.getDown();
120+
return edge.getUp();
121121
}
122122
}
123123
return nullptr;

source/MaterialXGraphEditor/UiNode.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,24 @@ using UiPinPtr = std::shared_ptr<UiPin>;
2323
class UiEdge
2424
{
2525
public:
26-
UiEdge(UiNodePtr uiDown, UiNodePtr uiUp, mx::InputPtr input) :
27-
_uiDown(uiDown),
26+
UiEdge(UiNodePtr uiUp, UiNodePtr uiDown, mx::InputPtr input) :
2827
_uiUp(uiUp),
28+
_uiDown(uiDown),
2929
_input(input)
3030
{
3131
}
3232
mx::InputPtr getInput() const
3333
{
3434
return _input;
3535
}
36-
UiNodePtr getDown() const
37-
{
38-
return _uiDown;
39-
}
4036
UiNodePtr getUp() const
4137
{
4238
return _uiUp;
4339
}
40+
UiNodePtr getDown() const
41+
{
42+
return _uiDown;
43+
}
4444
std::string getInputName() const
4545
{
4646
if (_input != nullptr)
@@ -54,8 +54,8 @@ class UiEdge
5454
}
5555

5656
private:
57-
UiNodePtr _uiDown;
5857
UiNodePtr _uiUp;
58+
UiNodePtr _uiDown;
5959
mx::InputPtr _input;
6060
};
6161

0 commit comments

Comments
 (0)