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

Continue adding support for user created subgraphs #2105

Draft
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

adamgerhant
Copy link
Collaborator

@adamgerhant adamgerhant commented Nov 10, 2024

Closes #2043
Allows removing, renaming, and reordering imports/exports.
Input based properties for network nodes to allow useable reordering
Adds Tooltips for acceptable types of a node input
Annotations for both node and input based overrides added to the node macro

Reworks how the properties panel is generated. A full node level override for the entire panel is still possible, which is stored as a lambda in the definition. Modifying the imports/exports means that the reference is lost, and the properties are instead generated individually for each input. By default, this will use the data type/type annotation to generate an appropriate set of widgets. This is done in property_from_type. For custom input overrides, each input has the PropertiesRow struct, which can store a reference to a widget override (a lambda which will generate a custom set of widgets). This lambda is stored in a hashmap, since it would not be possible to serialize it for every node. This also makes it easily extendible, just like how the definitions are stored. This lambda has access to the entire network interface, which it can use to access any information it needs to generate the widget. In addition to the widget override reference, each input also stores a hashmap of serializable data, which can store any information necessary. For the most part this will just contain the input name, but the author of the node could store additional data as they need.

TODO:

  • Rename inputs in properties panel
  • Protonode name at top of properties panel
  • Hiding input should automatically disconnect

Copy link

Found Clippy warnings

Clippy Warnings/Errors

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> editor/src/messages/portfolio/document/utility_types/network_interface.rs:846:15
    |
846 |                 get_ports(&modify_import_export_click_target)
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `modify_import_export_click_target`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
    = note: `-W clippy::needless-borrow` implied by `-W clippy::all`
    = help: to override `-W clippy::all` add `#[allow(clippy::needless_borrow)]`

warning: `graphite-editor` (lib) generated 1 warning (run `cargo clippy --fix --lib -p graphite-editor` to apply 1 suggestion)
warning: `graphite-editor` (lib) generated 1 warning (1 duplicate)
warning: `graphite-editor` (lib test) generated 1 warning (1 duplicate)
    Finished `dev` profile [optimized + debuginfo] target(s) in 4m 42s

    Finished `dev` profile [unoptimized + debuginfo] target(s) in 41.31s

@Keavon Keavon force-pushed the modify-import-export branch from 73e1ae5 to 0fbbffd Compare November 12, 2024 22:32
@Keavon Keavon changed the title Continue adding support for user created node graphs Continue adding support for user created subgraphs Nov 12, 2024
@Keavon
Copy link
Member

Keavon commented Jan 9, 2025

  • Upgrading previous documents
  • Filtering out the primary inputs of autogenerated Properties panel node sections so only secondary inputs are shown (e.g. Ellipse and Merge nodes)

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.

Improved node graph support for user created nodes
2 participants