Skip to content

Add layer node chains, import/export edge connectors, and refactor graph editing to go thru a NodeNetworkInterface #1794

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

Merged
merged 68 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
18c9a76
WIP: NodeNetworkInterface
adamgerhant Jun 21, 2024
c42c301
Organize ModifyInputsContext to use network interface
adamgerhant Jun 21, 2024
477a62a
Improve ClickTarget and Position state
adamgerhant Jun 23, 2024
8b2e76b
Rework ClickTarget state
adamgerhant Jun 23, 2024
4b8e7f8
Continue fixing NodeGraphMessageHandler
adamgerhant Jun 24, 2024
3aebc82
Restructure network_metadata
adamgerhant Jun 25, 2024
3f11c4a
Final(?) NodeNetworkInterface struct
adamgerhant Jun 26, 2024
54cf5cd
Final(??) NodeNetworkInterface
adamgerhant Jun 26, 2024
6d96c14
Final(???) NodeNetworkInterface. Separated persistent and transient data
adamgerhant Jun 27, 2024
773e1dc
Final NodeNetworkInterface data structure. Implemented all basic getters
adamgerhant Jun 28, 2024
0bcfc6b
Continue migrating functionality to network interface
adamgerhant Jun 29, 2024
22b8d75
Migrate all NodeGraphMessage's to use network interface
adamgerhant Jun 29, 2024
2af1ef7
Fix all helper functions in NodeGraphMessageHandler
adamgerhant Jun 30, 2024
3e29826
Move document metadata to network interface, remove various cached fi…
adamgerhant Jun 30, 2024
c8051a5
Move all editor only NodeNetwork implementations to NodeNetworkInterface
adamgerhant Jul 2, 2024
6918d53
Fix all DocumentNodeDefinitions
adamgerhant Jul 3, 2024
a69f943
Rework and migrate GraphOperationMessages to network interface
adamgerhant Jul 4, 2024
ef23e9b
Continue migration to NodeNetworkInterface
adamgerhant Jul 5, 2024
faf6e55
Save point before merging master
adamgerhant Jul 6, 2024
16229ae
Merge branch 'master' into node-network-interface
adamgerhant Jul 7, 2024
75dccf6
Fix all errors in network_interface
adamgerhant Jul 9, 2024
b95b54d
850 -> 160 errors
adamgerhant Jul 11, 2024
db6a7ce
Fix all errors :D
adamgerhant Jul 12, 2024
f69b841
Render default document
adamgerhant Jul 12, 2024
5362aab
Visualize click targets
adamgerhant Jul 13, 2024
235acbe
Merge branch 'master' into node-network-interface
adamgerhant Jul 15, 2024
95eed50
merge conflicts
adamgerhant Jul 15, 2024
d153d6f
Cache transient metadata separately, store entire interface in docume…
adamgerhant Jul 16, 2024
b50764e
Merge branch 'master' into node-network-interface
adamgerhant Jul 16, 2024
2aed989
Start migration to storing selected nodes for each network
adamgerhant Jul 17, 2024
98024b1
Remove selected nodes from document message handler
adamgerhant Jul 18, 2024
0f7eb10
Move outward wires and all nodes bounding box to transient metadata
adamgerhant Jul 19, 2024
79efd55
Fix connecting/disconnecting nodes
adamgerhant Jul 20, 2024
8ee919d
Layer stack organization for disconnecting/connecting nodes
adamgerhant Jul 23, 2024
0de94a5
Basic chain locking
adamgerhant Jul 24, 2024
2af3605
Improve chain positioning
adamgerhant Jul 25, 2024
2de38ab
Add copy/pasting
adamgerhant Jul 26, 2024
d2b38bc
Move upstream nodes on shift+drag
adamgerhant Jul 26, 2024
854bcaa
Merge branch 'master' into node-network-interface
adamgerhant Jul 26, 2024
96f3f48
merge conflict fixes
adamgerhant Jul 26, 2024
7f1e436
Improve Graph.svelte code quality
adamgerhant Jul 27, 2024
ebf4367
Final improvements to Graph.svelte
adamgerhant Jul 27, 2024
3fbe8ef
Fix layer panel
adamgerhant Jul 28, 2024
b0eaf2a
Performance optimizations
adamgerhant Jul 30, 2024
17542da
Bug fixes and derived PTZ
adamgerhant Jul 30, 2024
fb78893
Chain organization improvement and bug fixes
adamgerhant Jul 31, 2024
ab02e19
Bug fixes, remove all warnings
adamgerhant Jul 31, 2024
2c57bc7
Automatic file upgrade
adamgerhant Aug 1, 2024
7939efb
Merge branch 'master' into node-network-interface
adamgerhant Aug 1, 2024
ec06d12
Final code review
adamgerhant Aug 2, 2024
bb640b9
Fix editor tests
adamgerhant Aug 2, 2024
3fd2947
Merge branch 'master' into node-network-interface
Keavon Aug 2, 2024
2fb1298
Merge branch 'master' into node-network-interface
Keavon Aug 2, 2024
8f452b8
Fix compile errors
TrueDoctor Aug 2, 2024
a7f1019
Remove select tool intersection check when panning
adamgerhant Aug 2, 2024
45fea87
Merge branch 'node-network-interface' of https://github.com/GraphiteE…
adamgerhant Aug 2, 2024
4e8068b
WIP: Import/Exports
adamgerhant Aug 3, 2024
178b0f0
Fix JS issues
Keavon Aug 3, 2024
86bd98f
Finish simplified import/export UI
adamgerhant Aug 3, 2024
0c3a155
Merge branch 'node-network-interface' of https://github.com/GraphiteE…
adamgerhant Aug 3, 2024
2768706
Merge branch 'master' into node-network-interface
adamgerhant Aug 4, 2024
b2bc557
Import/Export viewport edge UI
adamgerhant Aug 4, 2024
d6a8f7c
Remove minimum y bound on import/export ports
adamgerhant Aug 4, 2024
5d48ed6
Improve performance while panning graph
Keavon Aug 4, 2024
b5493d4
cargo fmt
Keavon Aug 4, 2024
2bb8f3f
Fix CI code build
adamgerhant Aug 4, 2024
cca4570
Format the demo artwork graph with chains
Keavon Aug 4, 2024
81b5ff7
Code review
Keavon Aug 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix all helper functions in NodeGraphMessageHandler
  • Loading branch information
adamgerhant committed Jun 30, 2024
commit 2af1ef7597186aedd5f764bfce10516ce46f764b
Original file line number Diff line number Diff line change
Expand Up @@ -469,14 +469,15 @@ impl MessageHandler<DocumentMessage, DocumentMessageData<'_>> for DocumentMessag
DocumentMessageHandler::get_downstream_node(&self.document_network(), &self.metadata, first_unselected_parent_folder)
.unwrap_or((self.document_network().exports_metadata.0, 0));

responses.add(GraphOperationMessage::InsertNodeBetween {
responses.add(NodeGraphMessage::InsertNodeBetween {
post_node_id: folder_downstream_node_id,
post_node_input_index: folder_downstream_input_index,
insert_node_output_index: 0,
insert_node_id: layer.to_node(),
insert_node_input_index: 0,
pre_node_output_index: 0,
pre_node_id: first_unselected_parent_folder.to_node(),
use_document_network: true,
});

responses.add(GraphOperationMessage::ShiftUpstream {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,6 @@ pub enum GraphOperationMessage {
InsertBooleanOperation {
operation: BooleanOperation,
},
InsertNodeBetween {
// Post node
post_node_id: NodeId,
post_node_input_index: usize,
// Inserted node
insert_node_id: NodeId,
insert_node_output_index: usize,
insert_node_input_index: usize,
// Pre node
pre_node_id: NodeId,
pre_node_output_index: usize,
},
LoadStructure,
MoveSelectedSiblingsToChild {
new_parent: LayerNodeIdentifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,28 +81,30 @@ impl MessageHandler<GraphOperationMessage, GraphOperationMessageData<'_>> for Gr
responses.add(NodeGraphMessage::SelectedNodesAdd { nodes: vec![*new_layer_id] });

match (downstream_node, upstream_node) {
(Some(downstream_node), Some(upstream_node)) => responses.add(GraphOperationMessage::InsertNodeBetween {
(Some(downstream_node), Some(upstream_node)) => responses.add(NodeGraphMessage::InsertNodeBetween {
post_node_id: downstream_node,
post_node_input_index: input_index,
insert_node_output_index: 0,
insert_node_id: *new_layer_id,
insert_node_input_index: 0,
pre_node_output_index: 0,
pre_node_id: upstream_node,
use_document_network: true,
}),
(Some(downstream_node), None) => responses.add(GraphOperationMessage::SetNodeInput {
node_id: downstream_node,
input_index: input_index,
input: NodeInput::node(*new_layer_id, 0),
}),
(None, Some(upstream_node)) => responses.add(GraphOperationMessage::InsertNodeBetween {
(None, Some(upstream_node)) => responses.add(NodeGraphMessage::InsertNodeBetween {
post_node_id: document_network.exports_metadata.0,
post_node_input_index: 0,
insert_node_output_index: 0,
insert_node_id: *new_layer_id,
insert_node_input_index: 0,
pre_node_output_index: 0,
pre_node_id: upstream_node,
use_document_network: true,
}),
(None, None) => {
if let Some(primary_export) = document_network.exports.get_mut(0) {
Expand Down Expand Up @@ -185,23 +187,25 @@ impl MessageHandler<GraphOperationMessage, GraphOperationMessageData<'_>> for Gr
});

match (post_node_id, pre_node_id) {
(Some(post_node_id), Some(pre_node_id)) => responses.add(GraphOperationMessage::InsertNodeBetween {
(Some(post_node_id), Some(pre_node_id)) => responses.add(NodeGraphMessage::InsertNodeBetween {
post_node_id: post_node_id,
post_node_input_index: post_node_input_index,
insert_node_output_index: 0,
insert_node_id: node_id,
insert_node_input_index: 0,
pre_node_output_index: 0,
pre_node_id: pre_node_id,
use_document_network: true,
}),
(None, Some(pre_node_id)) => responses.add(GraphOperationMessage::InsertNodeBetween {
(None, Some(pre_node_id)) => responses.add(NodeGraphMessage::InsertNodeBetween {
post_node_id: document_network.exports_metadata.0,
post_node_input_index: 0,
insert_node_output_index: 0,
insert_node_id: node_id,
insert_node_input_index: 0,
pre_node_output_index: 0,
pre_node_id: pre_node_id,
use_document_network: true,
}),
(Some(post_node_id), None) => responses.add(GraphOperationMessage::SetNodeInput {
node_id: post_node_id,
Expand Down Expand Up @@ -262,14 +266,15 @@ impl MessageHandler<GraphOperationMessage, GraphOperationMessageData<'_>> for Gr
});

// Insert it in the upper layer's chain, right before it enters the upper layer
responses.add(GraphOperationMessage::InsertNodeBetween {
responses.add(NodeGraphMessage::InsertNodeBetween {
post_node_id: upper_layer.to_node(),
post_node_input_index: 1,
insert_node_id: boolean_operation_node_id,
insert_node_output_index: 0,
insert_node_input_index: 0,
pre_node_id: upper_node_id,
pre_node_output_index: upper_output_index,
use_document_network: true,
});

// Connect the lower chain to the Boolean Operation node's lower input
Expand Down Expand Up @@ -304,49 +309,6 @@ impl MessageHandler<GraphOperationMessage, GraphOperationMessageData<'_>> for Gr
// Re-render
responses.add(NodeGraphMessage::RunDocumentGraph);
}
GraphOperationMessage::InsertNodeBetween {
post_node_id,
post_node_input_index,
insert_node_output_index,
insert_node_id,
insert_node_input_index,
pre_node_output_index,
pre_node_id,
} => {
let post_node = document_network.nodes.get(&post_node_id);
let Some((post_node_input_index, _)) = post_node
.map_or(&document_network.exports, |post_node| &post_node.inputs)
.iter()
.enumerate()
.filter(|input| input.1.is_exposed())
.nth(post_node_input_index)
else {
error!("Failed to find input index {post_node_input_index} on node {post_node_id:#?}");
return;
};
let Some(insert_node) = document_network.nodes.get(&insert_node_id) else {
error!("Insert node not found");
return;
};
let Some((insert_node_input_index, _)) = insert_node.inputs.iter().enumerate().filter(|input| input.1.is_exposed()).nth(insert_node_input_index) else {
error!("Failed to find input index {insert_node_input_index} on node {insert_node_id:#?}");
return;
};

let post_input = NodeInput::node(insert_node_id, insert_node_output_index);
responses.add(GraphOperationMessage::SetNodeInput {
node_id: post_node_id,
input_index: post_node_input_index,
input: post_input,
});

let insert_input = NodeInput::node(pre_node_id, pre_node_output_index);
responses.add(GraphOperationMessage::SetNodeInput {
node_id: insert_node_id,
input_index: insert_node_input_index,
input: insert_input,
});
}
GraphOperationMessage::OpacitySet { layer, opacity } => {
if layer == LayerNodeIdentifier::ROOT_PARENT {
log::error!("Cannot run OpacitySet on ROOT_PARENT");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,17 @@ pub enum NodeGraphMessage {
node_template: NodeTemplate,
},
InsertNodeBetween {
// Post node
post_node_id: NodeId,
post_node_input_index: usize,
insert_node_output_index: usize,
// Inserted node
insert_node_id: NodeId,
insert_node_output_index: usize,
insert_node_input_index: usize,
pre_node_output_index: usize,
// Pre node
pre_node_id: NodeId,
pre_node_output_index: usize,
use_document_network: bool,
},
PasteNodes {
serialized_nodes: String,
Expand Down
Loading