-
Notifications
You must be signed in to change notification settings - Fork 316
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
New logic tree variable system #2439
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Improve tooltips - Move node-related operators above the variable list - Always show operators (poll() takes care of disabling them) to reduce possible user confusion and jumping UI
… exists in target tree
MoritzBrueckner
added
Release Notes: Fixes
A pull request that fixes something. Used to generate release notes.
Release Notes: Changes
A pull request that is a feature change, not a fix. Used to generate release notes.
labels
Feb 21, 2022
Awesome work!! I just wanted to point out that the |
Ah no, this wasn't intentional, thanks for mentioning this :) I will add another commit tomorrow. |
Thanks a lot! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Release Notes: Changes
A pull request that is a feature change, not a fix. Used to generate release notes.
Release Notes: Fixes
A pull request that fixes something. Used to generate release notes.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2434.
What started as an attempt to fix a simple issue became an almost complete rewrite of the logic ID system. Previously it was easily possible to create a few different situations where the correctness of the exported logic tree was completely violated or at least depending on external things such as iteration orders when exporting nodes:
Now, the logic ID is no longer directly accessible, instead the user has to promote variable nodes to tree variable nodes to let them share data. So if a variable node is linked to a tree variable, it shares its values with all other variable nodes that are linked to the same tree variable. A variable node does not have to be linked to a tree variable, in this case it acts for its own, just as before if the logic ID was unset.
In one sentence: if the variable node has no logic ID, all stays as it was before. If it has one set, the logic ID acts as a reference for a tree variable.
Files that are saved before SDK 2022.03 will be automatically upgraded to the new system (assuming that the version number of the SDK in the code will be bumped for the release), apart from the fact that the initial value may be affected by said race conditions.
Technical explanation of the new system:
A tree variable stores the type of the variable node to ensure correctness, and it uses one linked node (internally called the "master node") to actually store the variable values. This node is also used to show the variable values in the UI in the side panel, and the master node automatically synchronizes its values with all other nodes that are linked to the same variable (called "replica nodes" in the code). The user doesn't need to know about this concept, it is all done in the background and it even works to copy tree variable nodes between trees, there is always only one master node for each tree var, and for each variable node with a logic ID in the tree there will be a tree variable automatically. If there is no linked node left for a tree variable, the tree variable is removed.
In case this short paragraph is too briefly explained, there is a more detailed explanation in arm_nodes.py :)
User perspective:
The following operators are relevant for the user:
The tree variables have a color that is automatically synchronized with their linked nodes, and the name of the tree variable is shown in the node's body and header instead of the input sockets and other settings (which are now only editable in the sidebar if the node is linked, because the master node needs to be edited):
The name of a tree variable can be edited by double clicking on it in the sidebar list.
Thanks a lot to @QuantumCoderQC for the helpful discussions and ideas on Discord!