MaterialX: Graph Editor crashes when trying to rename

If you select the name of the element in the property editor and clear it, the Graph Editor will crash as it seems to throw an exception when trying to update the UI.

Side Effect

This is the call stack:

MaterialXGraphEditor.exe!MaterialX_v1_38_8::InheritanceIterator::operator++() Line 209 C++ MaterialXGraphEditor.exe!MaterialX_v1_38_8::InterfaceElement::getActiveInputs() Line 406 C++ MaterialXGraphEditor.exe!MaterialX_v1_38_8::InterfaceElement::hasExactInputMatch(std::shared_ptr<MaterialX_v1_38_8::InterfaceElement const> declaration, std::string * message) Line 616 C++ MaterialXGraphEditor.exe!MaterialX_v1_38_8::Node::getNodeDef(const std::string & target, bool allowRoughMatch) Line 113 C++ MaterialXGraphEditor.exe!Graph::propertyEditor() Line 3206 C++

Seems to think there is a cycle and throws an uncaught exception.

Reproducible Steps:

  1. Start up the editor. The default marble will be shown.
  2. Select the marble shader (SR_marble1). Check that the node’s properties are visible in the Property Editor on the left.
  3. Select the text in the name field and delete the text. `SR_marble1)
  4. An exception will be thrown which can be examined in a debugger.
  5. The call stack is when trying to update the UI attributes in the editor. Namely tying to resolve the name of the input.

Root Cause:

The main issue is that the code does not handle an empty name properly by allowing this to be performed and then not handled properly

Possible Fixes:

  1. Prevent an empty name from being entered (in UI code).
  2. Prevent an empty name from being set in the setName() API.
  3. Fix the code which is throwing this exception as it does not handle empty names properly.

All 3 are actually recommended by as a “first issue” fix, 1, 2 seem reasonable to understand the property editor code (1), and a small bit of the core code. (3) involves understanding more about how unique name resolution is performed but is “doable”.


Bonus Issue 😃

There is also an issue with trying to rename a node to an existing node under the same parent. This results in continuous renaming of the node on every refresh.

Repro Steps

  1. rename SR_marble1 to be NG_marble1
  2. the name of the node will keep on changing between NG_marble2 and NG_marble3.

Root Cause:

This seems to be due to not updating the UI node with the actual node name store on the MaterialX node (which is generated when calling setName().

Note that it would be good to fix this as part of firewalling name setting but can be split out into another issue…

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (9 by maintainers)

Commits related to this issue

Most upvoted comments

There is a general issue that keystrokes and mouse controls are not being captured in the correct panel, or “leak” into all panels. Should probably log separate issues for those not recorded yet.