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

Improve Robustness of Input Connection Setting #1770

Open
wants to merge 7 commits into
base: dev_1.39
Choose a base branch
from

Conversation

kwokcb
Copy link
Contributor

@kwokcb kwokcb commented Apr 10, 2024

Issue Addressed

This change adds detection for the case where both a connection and a value are specified, adds and update connection APIs to enforce not creating invalid documents.

Changes

  • Adds a new Input::setInterfaceInput() interface which clears the value attributes to avoid accidently creating invalid documents.
  • Updates other existing connection APIs to also clear the value attribute appropriately.
  • Updates validation on an input to mark when both a value and a connection are created.
  • Update mxvalidate.py to be able to handle a folder as input.

Tests

  • Update invalid documents:
    • Fix existing error in one of the render test suite files (color_management.mtlx).
    • mxvalidate.py and code generation tests caught this error. Ran mxvalidate on everything in libraries and resources.
  • Add a new node unit test to check interface setting and validity checking.
  • Change the node graph editor to use the new interface and remove previous manual value and interfacename clearing calls.

…move the value attribute.

Add new unit test case, and fix invalid color management test case.
@kwokcb
Copy link
Contributor Author

kwokcb commented Apr 10, 2024

@JGamache-autodesk, @zicher3d. I believe the change should address both the lack of validation and make the interface more robust in general and in the node editor.

@@ -1869,7 +1869,6 @@ void Graph::copyInputs()
}

copyNode->inputPins[count]->setConnected(true);
copyNode->inputPins[count]->_input->removeAttribute(mx::ValueElement::VALUE_ATTRIBUTE);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just removing the value can actually leave a state of no value and no connection.

source/MaterialXGraphEditor/Graph.cpp Show resolved Hide resolved
source/MaterialXTest/MaterialXCore/Node.cpp Show resolved Hide resolved
source/MaterialXCore/Interface.cpp Show resolved Hide resolved
source/MaterialXCore/Interface.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@JGamache-autodesk JGamache-autodesk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good. Thanks!

source/MaterialXCore/Interface.cpp Show resolved Hide resolved
source/MaterialXCore/Interface.cpp Outdated Show resolved Hide resolved
@kwokcb kwokcb changed the title Make Interface setting more robust Improve Robustness of Input Connection Setting Apr 10, 2024
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

Successfully merging this pull request may close these issues.

None yet

3 participants