Guest User

Untitled

a guest
Jun 8th, 2018
68
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   fn back_process(&mut self, node: &Value) -> &Vec<Option<Value>> {
  2.     let empty_arr = vec![];
  3.     let id = &node["id"].as_u64().expect("Invalid node ID") as &u64;
  4.     let nodes = self.nodes;
  5.  
  6.     if self.nodes_output.contains_key(id) == true {
  7.       return &self.nodes_output[id];
  8.     };
  9.  
  10.     let mut input_data: Vec<Vec<&Option<Value>>> = [].to_vec();
  11.     let inputs = &node["inputs"].as_array().unwrap_or(&empty_arr);
  12.  
  13.     for i in 0..inputs.len() {
  14.       let mut out_data: Vec<&Option<Value>> = [].to_vec();
  15.       let input = &inputs[i];
  16.       let connections = input["connections"].as_array().unwrap_or(&empty_arr);
  17.      
  18.  
  19.       for i2 in 0..connections.len() {
  20.         let c = &connections[i2];
  21.         let nid = c["node"].as_u64().expect("Invalid connection node ID") as u64;
  22.         let nn = &nodes.unwrap()[nid as usize]; // TODO rename
  23.         let out = self.back_process(&nn);
  24.         let out_index = c["output"]
  25.           .as_u64()
  26.           .expect("Invalid connection output index") as u64;
  27.         let val = &out[out_index as usize];
  28.         //val
  29.         out_data.push(val);
  30.       };
  31.  
  32.     }
  33.  
  34.  
  35.     return self.nodes_output.get(&id).unwrap();
  36.   }
RAW Paste Data