mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-31 10:17:21 +00:00
Node network subgraph editing (#1750)
* Breadcrumb visualization, nested network consistency, create definitions for Merge internal nodes * Add index to network inputs, remove imports usage from flatten network * Replace NodeOutput with NodeInput::Node * Fully remove imports field, remove unnecessary identity nodes, move Output node to encapsulating network * Replace previous_outputs with root_node, fix adding artboard/layer to empty network * Import/Export UI nodes * Display input/output types dynamically from compiled network * Add LayerNodeIdentifer::ROOT_PARENT * Prevent .to_node() on ROOT_PARENT * Separate NodeGraphMessage and GraphOperationMessage * General bug fixes with nested networks * Change layer color, various bug fixes and improvements * Fix disconnect and set node input for proto nodes and UI export node * Dashed line to export for previewed node * Fix deleting proto nodes and nodes that feed into export * Allow modifications to nodes outside of nested network * Get network from Node Id parameter * Change root_node to previous_root_node * Get TaggedValue from proto node implementation type when disconnecting * Improve preview functionality and state * Artboard position and delete children fix * Name inputs/outputs based on DocumentNodeDefinition or type, fix new artboard/layer insertion * replace "Link" with "Wire", adjust previewing * Various bug fixes and improvements * Modify Sample and Poisson-Disk points, fix incorrect input index and deleting currently viewed node * Open demo artwork * Fix opening already upgraded documents and refactor FrontendGraphDataType usages * Fix deleting within network and other bugs * Get default node input from compiled network when copying, fix previews, tests, demo artwork * Code cleanup * Hide EditorApi and add a comment describing unresolved Import node input types * Code review * Replace placeholder ROOT_PARENT NodeId with std::u64::MAX * Breadcrumb padding --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
parent
e4d3faa52a
commit
6d74abb4de
77 changed files with 3924 additions and 2327 deletions
|
@ -532,8 +532,8 @@ impl EditorHandle {
|
|||
/// Set the name for the layer
|
||||
#[wasm_bindgen(js_name = setLayerName)]
|
||||
pub fn set_layer_name(&self, id: u64, name: String) {
|
||||
let id = NodeId(id);
|
||||
let message = NodeGraphMessage::SetName { node_id: id, name };
|
||||
let layer = LayerNodeIdentifier::new_unchecked(NodeId(id));
|
||||
let message = GraphOperationMessage::SetName { layer, name };
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
|
@ -552,11 +552,11 @@ impl EditorHandle {
|
|||
}
|
||||
|
||||
/// Notifies the backend that the user connected a node's primary output to one of another node's inputs
|
||||
#[wasm_bindgen(js_name = connectNodesByLink)]
|
||||
pub fn connect_nodes_by_link(&self, output_node: u64, output_node_connector_index: usize, input_node: u64, input_node_connector_index: usize) {
|
||||
#[wasm_bindgen(js_name = connectNodesByWire)]
|
||||
pub fn connect_nodes_by_wire(&self, output_node: u64, output_node_connector_index: usize, input_node: u64, input_node_connector_index: usize) {
|
||||
let output_node = NodeId(output_node);
|
||||
let input_node = NodeId(input_node);
|
||||
let message = NodeGraphMessage::ConnectNodesByLink {
|
||||
let message = NodeGraphMessage::ConnectNodesByWire {
|
||||
output_node,
|
||||
output_node_connector_index,
|
||||
input_node,
|
||||
|
@ -601,7 +601,7 @@ impl EditorHandle {
|
|||
#[wasm_bindgen(js_name = disconnectNodes)]
|
||||
pub fn disconnect_nodes(&self, node_id: u64, input_index: usize) {
|
||||
let node_id = NodeId(node_id);
|
||||
let message = NodeGraphMessage::DisconnectNodes { node_id, input_index };
|
||||
let message = NodeGraphMessage::DisconnectInput { node_id, input_index };
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
|
@ -649,6 +649,13 @@ impl EditorHandle {
|
|||
self.dispatch(message);
|
||||
}
|
||||
|
||||
/// Go back a certain number of nested levels
|
||||
#[wasm_bindgen(js_name = exitNestedNetwork)]
|
||||
pub fn exit_nested_network(&self, steps_back: usize) {
|
||||
let message = NodeGraphMessage::ExitNestedNetwork { steps_back };
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
/// Notifies the backend that the selected nodes have been moved
|
||||
#[wasm_bindgen(js_name = moveSelectedNodes)]
|
||||
pub fn move_selected_nodes(&self, displacement_x: i32, displacement_y: i32) {
|
||||
|
@ -684,8 +691,16 @@ impl EditorHandle {
|
|||
}
|
||||
|
||||
/// Toggle visibility of a layer or node given its node ID
|
||||
#[wasm_bindgen(js_name = toggleNodeVisibility)]
|
||||
pub fn toggle_node_visibility(&self, id: u64) {
|
||||
#[wasm_bindgen(js_name = toggleNodeVisibilityLayerPanel)]
|
||||
pub fn toggle_node_visibility_layer(&self, id: u64) {
|
||||
let node_id = NodeId(id);
|
||||
let message = GraphOperationMessage::ToggleVisibility { node_id };
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
/// Toggle visibility of a layer or node given its node ID
|
||||
#[wasm_bindgen(js_name = toggleNodeVisibilityGraph)]
|
||||
pub fn toggle_node_visibility_graph(&self, id: u64) {
|
||||
let node_id = NodeId(id);
|
||||
let message = NodeGraphMessage::ToggleVisibility { node_id };
|
||||
self.dispatch(message);
|
||||
|
@ -698,15 +713,15 @@ impl EditorHandle {
|
|||
self.dispatch(message);
|
||||
|
||||
let id = NodeId(id);
|
||||
let message = DocumentMessage::DeleteLayer { id };
|
||||
let message = NodeGraphMessage::DeleteNodes { node_ids: vec![id], reconnect: true };
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
/// Toggle lock state of a layer from the layer list
|
||||
#[wasm_bindgen(js_name = toggleLayerLock)]
|
||||
pub fn toggle_layer_lock(&self, id: u64) {
|
||||
let id = NodeId(id);
|
||||
let message = NodeGraphMessage::ToggleLocked { node_id: id };
|
||||
let node_id = NodeId(id);
|
||||
let message = GraphOperationMessage::ToggleLocked { node_id };
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue