Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn back_process(&mut self, node: &Value) -> &Vec<Option<Value>> {
- let empty_arr = vec![];
- let id = &node["id"].as_u64().expect("Invalid node ID") as &u64;
- let nodes = self.nodes;
- if self.nodes_output.contains_key(id) == true {
- return &self.nodes_output[id];
- };
- let mut input_data: Vec<Vec<&Option<Value>>> = [].to_vec();
- let inputs = &node["inputs"].as_array().unwrap_or(&empty_arr);
- for i in 0..inputs.len() {
- let mut out_data: Vec<&Option<Value>> = [].to_vec();
- let input = &inputs[i];
- let connections = input["connections"].as_array().unwrap_or(&empty_arr);
- for i2 in 0..connections.len() {
- let c = &connections[i2];
- let nid = c["node"].as_u64().expect("Invalid connection node ID") as u64;
- let nn = &nodes.unwrap()[nid as usize]; // TODO rename
- let out = self.back_process(&nn);
- let out_index = c["output"]
- .as_u64()
- .expect("Invalid connection output index") as u64;
- let val = &out[out_index as usize];
- //val
- out_data.push(val);
- };
- }
- return self.nodes_output.get(&id).unwrap();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement