Skip to content

Generalize layers as merge nodes to enable adjustment layers #1712

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 47 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
58dd67a
WIP, backward traversal issues
adamgerhant Mar 29, 2024
7cbff5d
Fix some tool issues
0HyperCube Mar 29, 2024
54f0b0d
Remove debugging
Keavon Mar 29, 2024
51c61ba
Change some indices
0HyperCube Mar 29, 2024
c290cbd
WIP: new artboard node
adamgerhant Mar 30, 2024
e1498f8
WIP: add artboard node
adamgerhant Mar 30, 2024
077a1ba
WIP: Artboard node and create_artboard
adamgerhant Apr 3, 2024
769f3f4
WIP: Artboard node implementation complete
adamgerhant Apr 3, 2024
7be8bcb
WIP: Artboards input for output node
adamgerhant Apr 4, 2024
6901f49
Complete Artboard node
adamgerhant Apr 4, 2024
367199e
Generalize LayerNodeIdentifier, monitor_nodes support for Artboard n…
adamgerhant Apr 8, 2024
7a649cc
Fix misaligned artboard click targets
Keavon Apr 8, 2024
c189af3
Generalize/clarify create_layer and insert_between
adamgerhant Apr 9, 2024
e9992a4
non-negative dimensions for resize_artboard
adamgerhant Apr 9, 2024
9589d7f
Show artboards in layer panel
adamgerhant Apr 11, 2024
221440f
Generalize create_layer for layer output node
adamgerhant Apr 13, 2024
36df33b
Generalize delete_layer/delete_artboard to NodeGraphMessage::DeleteNo…
adamgerhant Apr 17, 2024
431f20f
remove old primary_input function
adamgerhant Apr 18, 2024
abbda86
Vertical node visuals, remove is_layer function, rename Layer node to…
adamgerhant Apr 19, 2024
b150486
Fix demo artwork
adamgerhant Apr 20, 2024
f85bd44
Layer display context menu
adamgerhant Apr 20, 2024
89cff28
Automatically select artboard, fix warnings
adamgerhant Apr 21, 2024
da66f57
Improvements to context menu and layer invariant enforcement
adamgerhant Apr 22, 2024
4b7cac7
Remove display_as_layer and update load_structure
adamgerhant Apr 25, 2024
cc0bb44
Improve load_structure to show more layers, improve FlowIter, improve…
adamgerhant Apr 25, 2024
a66e61a
Clean up demo artwork using generalized layers
Keavon Apr 26, 2024
9471ea0
Improve design of Layers panel and graph nodes
Keavon Apr 26, 2024
ab366cf
MoveSelectedLayersTo rewrite to support generalized layer nodes
adamgerhant Apr 27, 2024
6ca4a5d
Include artboards in deepest_common_ancestor, fix resize_artboard/del…
adamgerhant Apr 27, 2024
8a04bc8
MoveSelectedLayersTo adjustments
adamgerhant Apr 27, 2024
43ae283
Sync non layer node visibility with metadata
adamgerhant Apr 27, 2024
a6a35aa
Include non layer nodes when moving/creating layer
adamgerhant Apr 27, 2024
6c9d68b
Fix group layers and get_post_node_with_index
adamgerhant Apr 28, 2024
52546ee
Include non layer nodes in UngroupSelectedLayers
adamgerhant Apr 28, 2024
c2395ef
GroupSelected for all selected nodes, UnGroupSelected position adjust…
adamgerhant Apr 29, 2024
76ec270
Add grouping for layers in different folders
adamgerhant Apr 29, 2024
d96db73
Fix hidden layers
adamgerhant Apr 29, 2024
18449a6
Prevent node from connecting to itself, fix undo automatic node inser…
adamgerhant Apr 30, 2024
ebd3f33
Fix undo CreateEmptyFolder, fix grouping nested layer nodes
adamgerhant Apr 30, 2024
5409e27
Formatting
Keavon Apr 30, 2024
650f6ea
Merge branch 'master' into adjustment-layers
Keavon Apr 30, 2024
531136b
Remove test and check if node is layer from network
adamgerhant Apr 30, 2024
e7ee147
Fix undo group layers
adamgerhant Apr 30, 2024
febb8d0
Check off roadmap
Keavon May 1, 2024
f650566
MoveUpstreamSiblingsToChild adjustments
adamgerhant May 1, 2024
fa2cb39
Replace tabs with spaces, remove mut from argument
adamgerhant May 1, 2024
ceb3fde
Final code review pass
Keavon May 1, 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
Check off roadmap
  • Loading branch information
Keavon committed May 1, 2024
commit febb8d03386505056811cb1795d8bb5bfc3ca1f5
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ impl MessageHandler<GraphOperationMessage, GraphOperationMessageData<'_>> for Gr
}
}
GraphOperationMessage::MoveUpstreamSiblingsToChild { new_parent, mut upstream_sibling_ids } => {
//Start with the furthest upstream node, move it as a child of the new folder, and continue downstream for each layer in vec
// Start with the furthest upstream node, move it as a child of the new folder, and continue downstream for each layer in vec
upstream_sibling_ids.reverse();
for node_to_move in upstream_sibling_ids.clone() {
//Connect pre node to post node, or disconnect pre node if post node doesn't exist
// Connect pre node to post node, or disconnect pre node if post node doesn't exist
let mut pre_node_id = new_parent;
loop {
let Some(NodeInput::Node { node_id, .. }) = document_network.nodes.get(&pre_node_id).expect("Current node should always exist").inputs.get(0) else {
Expand Down Expand Up @@ -137,9 +137,9 @@ impl MessageHandler<GraphOperationMessage, GraphOperationMessageData<'_>> for Gr
return;
};

//Insert upstream_sibling_node at top of group stack
// Insert upstream_sibling_node at top of group stack
if let NodeInput::Node { node_id, .. } = parent_secondary_input {
//If there is already a node at the top of the stack, insert upstream_sibling_node in between
// If there is already a node at the top of the stack, insert upstream_sibling_node in between
let current_child = *node_id;
let Some(upstream_sibling_input) = document_network.nodes.get_mut(&node_to_move).expect("Upstream sibling should always exist").inputs.get_mut(0) else {
log::error!("Could not get upstream sibling node input");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphHandlerData<'a>> for NodeGrap
// that do not feed into the delete_nodes set or the output node will be deleted.
let mut stack = vec![upstream_id];
let mut can_delete = true;
//TODO: Add iteration limit to force break in case of infinite while loop
// TODO: Add iteration limit to force break in case of infinite while loop
while let Some(current_node) = stack.pop() {
if let Some(downstream_nodes) = outward_links.get(&current_node) {
for downstream_node in downstream_nodes {
Expand Down Expand Up @@ -414,7 +414,7 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphHandlerData<'a>> for NodeGrap
node.metadata.position += IVec2::new(displacement_x, displacement_y)
}
}
//Since document structure doesn't change, just update the nodes
// Since document structure doesn't change, just update the nodes
if graph_view_overlay_open {
let links = Self::collect_links(network);
let nodes = self.collect_nodes(&links, network);
Expand Down Expand Up @@ -1022,7 +1022,7 @@ impl NodeGraphMessageHandler {
fn send_graph(&self, network: &NodeNetwork, graph_open: bool, metadata: &mut DocumentMetadata, selected_nodes: &mut SelectedNodes, collapsed: &CollapsedLayers, responses: &mut VecDeque<Message>) {
responses.add(DocumentMessage::DocumentStructureChanged);
responses.add(PropertiesPanelMessage::Refresh);
//TODO: Move update_layer_panel into message so load structure here can be removed, since load structure is already called in DocumentStructureChanged
// TODO: Move update_layer_panel into message so load structure here can be removed, since load structure is already called in DocumentStructureChanged
metadata.load_structure(network, selected_nodes);
Self::update_layer_panel(network, metadata, collapsed, responses);
if graph_open {
Expand Down Expand Up @@ -1152,7 +1152,7 @@ impl NodeGraphMessageHandler {
let input_count = node_input_count + exposed_value_count;
let Some(definition) = resolve_document_node_type(&node.name) else { return false };
let output_count = definition.outputs.len();
//TODO: Eventually allow nodes at the bottom of a stack to be layers, where `input_count` is 0
// TODO: Eventually allow nodes at the bottom of a stack to be layers, where `input_count` is 0
if !node.has_primary_output || output_count != 1 || input_count == 0 || input_count > 2 {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion website/content/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Always on the bleeding edge and built to last— Graphite is written on a robust
<div class="informational ongoing heading" title="Began February 2024" data-year="2024">
<h3>— Alpha 3 —</h3>
</div>
<div class="informational ongoing" title="Development Ongoing">
<div class="informational complete" title="Development Complete">
<img class="atlas" style="--atlas-index: 3" src="https://static.graphite.rs/icons/icon-atlas-roadmap__2.png" alt="" />
<span>Stackable adjustment layers</span>
</div>
Expand Down