fn delete_node(&mut self, id: usize, context: &mut ScreenContext) {
        self.disconnect_node(id, context);

        // Remove node widget
        for index in 0..self.nodes.len() {
            if self.nodes[index].id == id {
                self.nodes.remove(index);
                break
            }
        }

        // Remove node data
        if let Some(behavior) = context.data.get_mut_behavior(self.get_curr_behavior_id(context), self.graph_type) {
            behavior.data.nodes.remove(&id);
            behavior.save_data();
        }

        // If this is an BehaviorTree remove it from the current indices
        if let Some(index) = self.behavior_tree_indices.iter().position(|&x| x == id) {
            self.behavior_tree_indices.remove(index);
        }
    }
/// Disconnect the node from all connections
Disconnect the node from all connections
Disconnect the node from all connections
fn delete_node(&mut self, id: usize, context: &mut ScreenContext) {
        self.disconnect_node(id, context);
        // Remove node widget
        for index in 0..self.nodes.len() {
            if self.nodes[index].id == id {
                self.nodes.remove(index);
                break
            }
        }
        // Remove node data
        if let Some(behavior) = context.data.get_mut_behavior(self.get_curr_behavior_id(context), self.graph_type) {
            behavior.data.nodes.remove(&id);
            behavior.save_data();
        }
        // If this is an BehaviorTree remove it from the current indices
        if let Some(index) = self.behavior_tree_indices.iter().position(|&x| x == id) {
            self.behavior_tree_indices.remove(index);
        }
    }
fn delete_node ( & mut self , id : usize , context : & mut ScreenContext ) { self . disconnect_node ( id , context ) ; // Remove node widget for index in 0 .. self . nodes . len ( ) { if self . nodes [ index ] . id == id { self . nodes . remove ( index ) ; break } } // Remove node data if let Some ( behavior ) = context . data . get_mut_behavior ( self . get_curr_behavior_id ( context ) , self . graph_type ) { behavior . data . nodes . remove ( & id ) ; behavior . save_data ( ) ; } // If this is an BehaviorTree remove it from the current indices if let Some ( index ) = self . behavior_tree_indices . iter ( ) . position ( | & x | x == id ) { self . behavior_tree_indices . remove ( index ) ; } }
Disconnect the node from all connections
Disconnect the node from all connections
&mut self
id
usize
context
&mut ScreenContext
&mut self
id
usize
context
&mut ScreenContext