Skip to content

Commit 66f9546

Browse files
jsjgdhhe1senbrg
authored andcommitted
Expose the secondary input for Logical and nodes
1 parent 910fb54 commit 66f9546

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,6 +1958,7 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
19581958

19591959
let shift = ipp.keyboard.get(Key::Shift as usize);
19601960
let alt = ipp.keyboard.get(Key::Alt as usize);
1961+
let control = ipp.keyboard.get(Key::Control as usize);
19611962
let Some(selected_nodes) = network_interface.selected_nodes_in_nested_network(selection_network_path) else {
19621963
log::error!("Could not get selected nodes in UpdateBoxSelection");
19631964
return;
@@ -1983,6 +1984,33 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
19831984
}
19841985
}
19851986
}
1987+
1988+
if control {
1989+
let mut non_layer_nodes = HashSet::new();
1990+
1991+
let layer_nodes = nodes.iter().filter(|node_id| network_interface.is_layer(node_id, selection_network_path));
1992+
for &layer_id in layer_nodes {
1993+
for child_id in network_interface.upstream_flow_back_from_nodes(vec![layer_id], selection_network_path, FlowType::LayerChildrenUpstreamFlow) {
1994+
if nodes.contains(&child_id) && child_id != layer_id {
1995+
non_layer_nodes.insert(child_id);
1996+
}
1997+
}
1998+
}
1999+
2000+
// Remove non-layer nodes from selection
2001+
if alt {
2002+
nodes = previous_selection.difference(&non_layer_nodes).cloned().collect();
2003+
}
2004+
// Add non-layer nodes to selection
2005+
else if shift {
2006+
nodes = previous_selection.union(&non_layer_nodes).cloned().collect();
2007+
}
2008+
// Replace selection with non-layer nodes
2009+
else {
2010+
nodes = non_layer_nodes;
2011+
}
2012+
}
2013+
19862014
if nodes != previous_selection {
19872015
responses.add(NodeGraphMessage::SelectedNodesSet {
19882016
nodes: nodes.into_iter().collect::<Vec<_>>(),
@@ -2770,6 +2798,7 @@ impl NodeGraphMessageHandler {
27702798
HintInfo::mouse(MouseMotion::LmbDrag, "Select Area"),
27712799
HintInfo::keys([Key::Shift], "Extend").prepend_plus(),
27722800
HintInfo::keys([Key::Alt], "Subtract").prepend_plus(),
2801+
HintInfo::keys([Key::Control], "Exclude Layers").prepend_plus(),
27732802
]),
27742803
]);
27752804
if self.has_selection {

node-graph/nodes/math/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,7 @@ fn logical_or(
705705
/// One of the two boolean values, either of which may be true for the node to output true.
706706
value: bool,
707707
/// The other of the two boolean values, either of which may be true for the node to output true.
708+
#[expose]
708709
other_value: bool,
709710
) -> bool {
710711
value || other_value
@@ -717,6 +718,7 @@ fn logical_and(
717718
/// One of the two boolean values, both of which must be true for the node to output true.
718719
value: bool,
719720
/// The other of the two boolean values, both of which must be true for the node to output true.
721+
#[expose]
720722
other_value: bool,
721723
) -> bool {
722724
value && other_value

0 commit comments

Comments
 (0)