/*******************************************/ protected virtual void UpdateOutput(ParamUpdated update) { int index = Params.Output.FindIndex(x => x.Name == update.Name); if (index >= 0) { IGH_Param oldParam = Params.Output[index]; IGH_Param newParam = update.Param.ToGH_Param(); // The Recipient property is still empty at this stage so we need to make sure recipient params are still finding their source newParam.NewInstanceGuid(oldParam.InstanceGuid); newParam.DataMapping = oldParam.DataMapping; newParam.Simplify = oldParam.Simplify; newParam.Reverse = oldParam.Reverse; MoveLinks(oldParam, newParam); oldParam.Recipients.Clear(); Params.UnregisterOutputParameter(oldParam); Params.RegisterOutputParam(newParam, index); } }
/*******************************************/ /**** Output Update Methods ****/ /*******************************************/ protected virtual void UpdateOutput(ParamAdded update) { IGH_Param newParam = update.Param.ToGH_Param(); // If there is already a param with the same name, delete it but keep the wire connections // Same approach as `UpdateOutput(ParamUpdated update)` but with index provided by ParamAdded IGH_Param match = Params.Output.Find(x => x.Name == update.Name); if (match != null) { newParam.NewInstanceGuid(match.InstanceGuid); newParam.DataMapping = match.DataMapping; newParam.Simplify = match.Simplify; newParam.Reverse = match.Reverse; match.Recipients.Clear(); Params.UnregisterOutputParameter(match); } Params.RegisterOutputParam(newParam, update.Index); }