fn check_node_visibility(&mut self, context: &ScreenContext) {

        self.visible_node_ids = vec![];

        if self.graph_type == BehaviorType::Regions {
            // Regions all nodes are visible
            for index in 0..self.nodes.len() {
                self.visible_node_ids.push(self.widget_index_to_node_id(index));
            }
            return;
        }

        if let Some(tree_index) = self.curr_behavior_tree_index {

            let tree_id = self.widget_index_to_node_id(tree_index);
            self.visible_node_ids.push(tree_id);
            self.mark_connections_visible(tree_id, context);

            // Find unconnected nodes and mark them visible
            for index in 0..self.nodes.len() {

                let mut connected = false;
                if let Some(behavior) = context.data.get_behavior(self.get_curr_behavior_id(context), self.graph_type) {

                    // Skip behavior tree nodes
                    if let Some(node_data) = behavior.data.nodes.get(&self.widget_index_to_node_id(index)) {
                        if node_data.behavior_type == BehaviorNodeType::BehaviorTree {
                            continue;
                        }
                    }

                    // Check if node is connected
                    for (source_node_id , _source_connector, dest_node_id, _dest_connector) in &behavior.data.connections {
                        if self.nodes[index].id == *source_node_id || self.nodes[index].id == *dest_node_id {
                            connected = true;
                            break;
                        }
                    }
                }

                if connected == false {
                    self.visible_node_ids.push(self.nodes[index].id);
                } else {
                    // If node is connected go up the tree to see if they are standalone nodes (i.e. not connectected to any behavior tree)
                    if self.belongs_to_standalone_branch(self.nodes[index].id, context) {
                        self.visible_node_ids.push(self.nodes[index].id);
                    }
                }
            }
        }
    }
/// Checks the visibility of a node
Checks the visibility of a node
Checks the visibility of a node
fn check_node_visibility(&mut self, context: &ScreenContext) {
        self.visible_node_ids = vec![];
        if self.graph_type == BehaviorType::Regions {
            // Regions all nodes are visible
            for index in 0..self.nodes.len() {
                self.visible_node_ids.push(self.widget_index_to_node_id(index));
            }
            return;
        }
        if let Some(tree_index) = self.curr_behavior_tree_index {
            let tree_id = self.widget_index_to_node_id(tree_index);
            self.visible_node_ids.push(tree_id);
            self.mark_connections_visible(tree_id, context);
            // Find unconnected nodes and mark them visible
            for index in 0..self.nodes.len() {
                let mut connected = false;
                if let Some(behavior) = context.data.get_behavior(self.get_curr_behavior_id(context), self.graph_type) {
                    // Skip behavior tree nodes
                    if let Some(node_data) = behavior.data.nodes.get(&self.widget_index_to_node_id(index)) {
                        if node_data.behavior_type == BehaviorNodeType::BehaviorTree {
                            continue;
                        }
                    }
                    // Check if node is connected
                    for (source_node_id , _source_connector, dest_node_id, _dest_connector) in &behavior.data.connections {
                        if self.nodes[index].id == *source_node_id || self.nodes[index].id == *dest_node_id {
                            connected = true;
                            break;
                        }
                    }
                }
                if connected == false {
                    self.visible_node_ids.push(self.nodes[index].id);
                } else {
                    // If node is connected go up the tree to see if they are standalone nodes (i.e. not connectected to any behavior tree)
                    if self.belongs_to_standalone_branch(self.nodes[index].id, context) {
                        self.visible_node_ids.push(self.nodes[index].id);
                    }
                }
            }
        }
    }
fn check_node_visibility ( & mut self , context : & ScreenContext ) { self . visible_node_ids = vec ! [ ] ; if self . graph_type == BehaviorType :: Regions { // Regions all nodes are visible for index in 0 .. self . nodes . len ( ) { self . visible_node_ids . push ( self . widget_index_to_node_id ( index ) ) ; } return ; } if let Some ( tree_index ) = self . curr_behavior_tree_index { let tree_id = self . widget_index_to_node_id ( tree_index ) ; self . visible_node_ids . push ( tree_id ) ; self . mark_connections_visible ( tree_id , context ) ; // Find unconnected nodes and mark them visible for index in 0 .. self . nodes . len ( ) { let mut connected = false ; if let Some ( behavior ) = context . data . get_behavior ( self . get_curr_behavior_id ( context ) , self . graph_type ) { // Skip behavior tree nodes if let Some ( node_data ) = behavior . data . nodes . get ( & self . widget_index_to_node_id ( index ) ) { if node_data . behavior_type == BehaviorNodeType :: BehaviorTree { continue ; } } // Check if node is connected for ( source_node_id , _source_connector , dest_node_id , _dest_connector ) in & behavior . data . connections { if self . nodes [ index ] . id == * source_node_id || self . nodes [ index ] . id == * dest_node_id { connected = true ; break ; } } } if connected == false { self . visible_node_ids . push ( self . nodes [ index ] . id ) ; } else { // If node is connected go up the tree to see if they are standalone nodes (i.e. not connectected to any behavior tree) if self . belongs_to_standalone_branch ( self . nodes [ index ] . id , context ) { self . visible_node_ids . push ( self . nodes [ index ] . id ) ; } } } } }
Checks the visibility of a node
Checks the visibility of a node
&mut self
context
&ScreenContext
&mut self
context
&ScreenContext