@@ -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 {
0 commit comments