/// <summary> /// convert current selected source to ColibriParam /// </summary> private ColibriParam ConvertToColibriParam(IGH_Param SelectedSource, int AtIteratorPosition) { //var component = SelectedSource; //list of things connected on this input ColibriParam colibriParam = new ColibriParam(SelectedSource, AtIteratorPosition); //Flatten the Panel's data just in case if (colibriParam.GHType == InputType.Panel) { SelectedSource.VolatileData.Flatten(); } return(colibriParam); }
/// <summary> /// Change Iterator's input and output NickName /// </summary> private void checkInputParamNickname(ColibriParam ValidSourceParam) { if (ValidSourceParam != null) { var colibriParam = ValidSourceParam; int atPosition = colibriParam.AtIteratorPosition; var inputParam = this.Params.Input[atPosition]; var outputParam = this.Params.Output[atPosition]; string newNickname = colibriParam.NickName; inputParam.NickName = newNickname; outputParam.NickName = newNickname; outputParam.Description = "This item is one of values from " + colibriParam.GHType.ToString() + "_" + newNickname; this.Attributes.ExpireLayout(); } }
//This is for if any source name changed, NOTE: cannot deteck the edited private void OnSourceNicknameChanged(ColibriParam sender) { //bool isExist = _filteredSources.Exists(_ => _.RawParam.Equals(sender)); bool isExist = _filteredSources.Contains(sender); if (isExist) { //todo: this can be finished inside ColibriParam checkInputParamNickname(sender); //edit the Fly output without expire this component's solution, // only expire the downstream components which connected to the last output "FlyID" int flyIDindex = this.Params.Output.Count; if (this._remoteFly) { flyIDindex = flyIDindex - 2; } else { flyIDindex = flyIDindex - 1; } this.Params.Output[flyIDindex].ExpireSolution(false); this.Params.Output[flyIDindex].ClearData(); this.Params.Output[flyIDindex].AddVolatileDataList(new GH_Path(0, 0), getFlyID()); if (_doc == null) { _doc = GH.Instances.ActiveCanvas.Document; } _doc.NewSolution(false); } else { sender = null; } }