-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Replace node definition string-based lookups with DefinitionIdentifier instances #3451
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
Conversation
f443176 to
0958e50
Compare
e5d9913 to
3ac9dfe
Compare
| RegistryWidgetOverride::Custom(str) => InputMetadata::with_name_description_override(f.name, f.description, WidgetOverride::Custom(str.to_string())), | ||
| }) | ||
| .collect(), | ||
| output_names: vec![output_type.to_string()], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed since the output name of a protonode should not be a single random output type, as this can change and should be based on the current graph state.
| document.network_interface.set_input(&InputConnector::node(*node_id, 2), old_inputs[3].clone(), network_path); | ||
| } | ||
|
|
||
| if reference == "Flatten Vector Elements" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not possible to include this migration since it relies on changing reference to not run again, which is no longer possible.
a17cfc5 to
869967c
Compare
6a32a1a to
e93b3e0
Compare
e93b3e0 to
7a4b398
Compare
...src/messages/portfolio/document/node_graph/document_node_definitions/document_node_derive.rs
Show resolved
Hide resolved
...src/messages/portfolio/document/node_graph/document_node_definitions/document_node_derive.rs
Outdated
Show resolved
Hide resolved
editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs
Show resolved
Hide resolved
|
Marking as a draft while a few issues with crashes on document opening are happening due to some weirdness with migrations. @adamgerhant has the files to reproduce this with in our chat. Also, please help by fixing the tests that are failing, thanks! |
editor/src/messages/portfolio/document/graph_operation/utility_types.rs
Outdated
Show resolved
Hide resolved
editor/src/messages/portfolio/document/graph_operation/utility_types.rs
Outdated
Show resolved
Hide resolved
| let mut last_segment = proto_node_identifier.as_str().split("::").last().unwrap_or_default().to_string(); | ||
| last_segment = last_segment.strip_suffix("Node").unwrap_or(&last_segment).to_string(); | ||
| last_segment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This branch should only be taken if the node is not registered by the node macro right? I don't think we have any nodes which are not registered by the node macro, so this should never be taken. Also if we do take it, the name would be weird, FlattenPath instead of Flatten Path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this branch is for nodes with #[node_macro::node(skip_impl)] like the monitor node. It could have a space added before each capital letter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible for the node macro to add metadata to NODE_METADATA for nodes with #[node_macro::node(skip_impl)] so its purpose is to only not add to the registry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is exactly how the node macro behaves, the metadata is generated regardless of whether the skip_impl is used. Again the only way I see for this branch being taken is if a node is not registered using the node macro
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was confident that was true, but then we looked into it and it seems (maybe due to a logic bug?) that it's surprisingly not actually so. Can you please double-check @adamgerhant's conclusion about this, and maybe suggest how it ought to be fixed if what I'm conveying is indeed accurate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean you could have trusted my comment or double-checked by just looking at the code in codegen.rs but by design the skip_impl attribute only skips the addition of implementation and specifically not the metadata registration / implementation + codgen of the node so you add your own implementations in the node registry.
So adams first suggestion is not relevant since this entire branch is dead code. The only nodes I am aware of which are not generated with the macro are ones which would never be accessible to the user.
Regarding the second suggestion, that is how this feature has worked since I have implemented it
Improves the definition reference system by referencing nodes with
DefinitionIdentifierinstead of strings. This means protonodes use their identifier to reference their definition, instead of an arbitrary string.Sets the foundation for an improved migration system and linking nodes to their definition when serializing.
For example:
instead of
you would do
Another example
to
This PR also moves
from
struct DocumentNodePersistentMetadatato its descendantstruct NodeNetworkPersistentMetadata(but only when it's a network node, not a proto node).