/** * from is the output of and other node and to is the input on this node to update with from's data */ protected bool ProcessOutput(Output from, Input to) { if (!enabled) { return(false); } if (Output.ContainsType(to.GetAllowedDataTypes(), from.GetDataType()))//if the input and output are compatible, proceed { object data = from.GetData(); to.SetData(data, from.GetDataType()); return(true); } else { Debug.LogError("output and input types are not compatible : " + from.host.GetType() + " to : " + to.host.GetType()); return(false); } }
internal abstract object GetData();//give back the data you stored to pass to the inputs of other node (stored inside destinations) //called by the hosting node at the end of his process public virtual bool ConnectTo(Input input) //this is for the UI part { if (GetDataType() == null) //if i don't know what i'am returning dont create link { return(false); } if (!ContainsType(input.GetAllowedDataTypes(), GetDataType()))//if i am not the right data type don't allow connection { return(false); } destinations.Add(input); input.SetIncommingDataType(GetDataType()); input.host.PartialSetup(); input.outputConnectedTo = this; if (onConnect != null) { onConnect(input); } return(true); }