Support token editing within GraphEditor UI#2943
Conversation
…l of node inputs Signed-off-by: mialana <aliu@amyliu.dev>
Signed-off-by: mialana <aliu@amyliu.dev>
Signed-off-by: mialana <aliu@amyliu.dev>
…ring for interface inputs Signed-off-by: mialana <aliu@amyliu.dev>
Signed-off-by: mialana <aliu@amyliu.dev>
Signed-off-by: mialana <aliu@amyliu.dev>
Signed-off-by: mialana <aliu@amyliu.dev>
Signed-off-by: mialana <aliu@amyliu.dev>
Signed-off-by: mialana <aliu@amyliu.dev>
There was a problem hiding this comment.
Hi @mialana,
This looks really good! There are some minor comments on variants to check.
I see you find all parent tokens for the active child node.
You could simplify logic by just getting the tokens for the current (selected) node/nodegraph. The user interaction and display would be simplified as well as a user knows exactly what scope the token change is occurring at. I leave it up to you -- either way is fine.
I didn't run this but have you checked that a token change can indeed cause the image's referenced to update, or is this a second step after the core + edit logic here is added ?
Thanks.
| handleTokenMapping(interfaceElem, currElem); | ||
|
|
||
| // If the node is a nodegraph, also check for tokens on corresponding nodedef | ||
| if (mx::ConstNodeGraphPtr nodegraph = currElem->asA<mx::NodeGraph>()) |
There was a problem hiding this comment.
I believe this logic will need to also handle node instances as the corresponding nodedef could also have exposed tokens. I don't think there is an example such as nodedef so may need to make one. Perhaps a simple example is a nodedef implemented as a image node + a token node, where the image node's filename and the token input are exposed as interface inputs.
There was a problem hiding this comment.
Sure! Do these new additions cover the cases you are thinking of?
| { | ||
| std::string key = token->getName(); | ||
|
|
||
| // Insert into map, but do not allow parent values to override child values |
There was a problem hiding this comment.
Thanks for handling token hierarchies.
I believe you will get the correct ordering if getActiveTokens() maintains child->parent ordering (which it should). Another option would be to use full paths and check if the current token is a parent.
There was a problem hiding this comment.
Right, I did go down the implementation code of getActiveTokens(). If I understand it correctly, it traverses inheritance, calls getChildrenOfType<Token>(), and appends the return tokens to a result vector.
But of course I can also look into the other solution you suggested! Is there a helper function anywhere in the code base for detecting if path strings have parent-child relationships?
There was a problem hiding this comment.
Thanks for checking the logic. If this is ordering than it's fine.
Signed-off-by: mialana <aliu@amyliu.dev>
Great! Yes, here is a demo where I edit a token in the table, and the material preview is updated thereafter.
For the design decision you mention, my initial thought process was that displaying parent tokens is useful as then the table exposes all tokens that are available for use in Does that make sense to you as well? Thank you for the code review! |
kwokcb
left a comment
There was a problem hiding this comment.
This looks good to go.
Just leaving a final test check that the editing values works for the cases in
the token_graph and token_graph_material. A snapshot or short gif/video would be good to show the result. There is a nodedef with token instance so that will check the latest logic you added in to cover that case. Thanks!
| { | ||
| std::string key = token->getName(); | ||
|
|
||
| // Insert into map, but do not allow parent values to override child values |
There was a problem hiding this comment.
Thanks for checking the logic. If this is ordering than it's fine.
| handleTokenMapping(interfaceElem, currElem); | ||
|
|
||
| // If the node is a nodegraph, also check for tokens on corresponding nodedef | ||
| if (mx::ConstNodeGraphPtr nodegraph = currElem->asA<mx::NodeGraph>()) |
…class Signed-off-by: mialana <aliu@amyliu.dev>
e8d5b3e to
3644bd6
Compare
Signed-off-by: mialana <aliu@amyliu.dev>
|
MaterialX Token Editing - 'token_graph_material.mtlx' Functionality Demo MaterialX Token Editing - 'token_graph.mtlx' Functionality Demo @kwokcb Sorry for the delay in getting these videos posted. I will say that the videos demonstrate that the editing process is not yet completely bug-free. Namely:
Given these videos, I am curious whether you'd like to fix these bugs before this PR is approved? I believe that the problems demonstrated should have already existed before my changes, and if possible could be addressed separately. I can also provide some more details on anything if needed! Thank you, hope my update make sense and let me know preferred next steps. |
|
|
kwokcb
left a comment
There was a problem hiding this comment.
Thanks for your work on this Amy. This looks good to go!
If you can log the update issue you found at your convenience that would be much
appreciated. Thx.
| std::ostringstream _affectedInputsStream{}; | ||
|
|
||
| // Track whether changes were made to inputs in order to re-build stream accordingly | ||
| std::atomic<bool> _isAffectedInputsDirty{ true }; |
There was a problem hiding this comment.
Perhaps the introduction of std::atomic to this code is not needed? Assuming this code will only be called from the single-threaded UI of the Graph Editor, I wouldn't imagine we need to bring new thread-safe constructs into this logic.


Hello! This is a PR for Dev Days 2026. It features:
Tokenstable to improve user experience. Namely:Source Elementcolumn, which contains the graph element where the token is declared / was discovered during upwards traversal.Affected Inputscolumn, which lists which of the node's inputs reference the token.Feel free to point out any inefficiencies or inconsistencies I've made in implementation. Thank you!