pub fn evaluate(&mut self) {
        self.state.clear_weights();

        // TODO: Use smallvec to avoid allocation here.
        let mut stack = vec![GraphTraversalNode {
            node_id: NodeId::ROOT,
            cumulative_weight: 1.0,
        }];

        // Conduct a depth-first traversal of the graph multiplying the weights
        // as it gets deeper into the tree.
        while let Some(current) = stack.pop() {
            let current_node = if let Some(node) = self.nodes.get(current.node_id) {
                node
            } else {
                continue;
            };

            match &current_node {
                Node::Clip { clip } => {
                    self.state.add_weight(*clip, current.cumulative_weight);
                }
                Node::Blend { inputs, .. } => {
                    for input in inputs.iter().filter(|input| input.is_connected()) {
                        let cumulative_weight = input.weight() * current.cumulative_weight;
                        if cumulative_weight != 0.0 {
                            stack.push(GraphTraversalNode {
                                node_id: input.node_id(),
                                cumulative_weight,
                            });
                        }
                    }
                }
            }
        }
    }
/// Evaluates the graph, computing the influences individual results.
Evaluates the graph, computing the influences individual results.
Evaluates the graph computing the influences individual results .
pub fn evaluate(&mut self) {
        self.state.clear_weights();
        // TODO: Use smallvec to avoid allocation here.
        let mut stack = vec![GraphTraversalNode {
            node_id: NodeId::ROOT,
            cumulative_weight: 1.0,
        }];
        // Conduct a depth-first traversal of the graph multiplying the weights
        // as it gets deeper into the tree.
        while let Some(current) = stack.pop() {
            let current_node = if let Some(node) = self.nodes.get(current.node_id) {
                node
            } else {
                continue;
            };
            match &current_node {
                Node::Clip { clip } => {
                    self.state.add_weight(*clip, current.cumulative_weight);
                }
                Node::Blend { inputs, .. } => {
                    for input in inputs.iter().filter(|input| input.is_connected()) {
                        let cumulative_weight = input.weight() * current.cumulative_weight;
                        if cumulative_weight != 0.0 {
                            stack.push(GraphTraversalNode {
                                node_id: input.node_id(),
                                cumulative_weight,
                            });
                        }
                    }
                }
            }
        }
    }
pub fn evaluate ( & mut self ) { self . state . clear_weights ( ) ; // TODO: Use smallvec to avoid allocation here. let mut stack = vec ! [ GraphTraversalNode { node_id NodeId ROOT cumulative_weight 1.0 } ] ; // Conduct a depth-first traversal of the graph multiplying the weights // as it gets deeper into the tree. while let Some ( current ) = stack . pop ( ) { let current_node = if let Some ( node ) = self . nodes . get ( current . node_id ) { node } else { continue ; } ; match & current_node { Node :: Clip { clip } => { self . state . add_weight ( * clip , current . cumulative_weight ) ; } Node :: Blend { inputs , .. } => { for input in inputs . iter ( ) . filter ( | input | input . is_connected ( ) ) { let cumulative_weight = input . weight ( ) * current . cumulative_weight ; if cumulative_weight != 0.0 { stack . push ( GraphTraversalNode { node_id : input . node_id ( ) , cumulative_weight , } ) ; } } } } } }
Evaluates the graph, computing the influences individual results.
Evaluates the graph computing the influences individual results .
&mut self
&mut self