示例#1
0
        bool IGH_VariableParameterComponent.DestroyParameter(GH_ParameterSide side, int index)
        {
            if(side == GH_ParameterSide.Input && !HiddenCodeInput && index == 0)
              m_inner_codeInput = Code;

              return true;
        }
示例#2
0
 public IGH_Param CreateParameter(GH_ParameterSide side, int index)
 {
     switch (side)
       {
     case GH_ParameterSide.Input:
       {
     return new Param_ScriptVariable
       {
         NickName = GH_ComponentParamServer.InventUniqueNickname("xyzuvwst", this.Params.Input),
         Name = NickName,
         Description = "Script variable " + NickName,
       };
       }
     case GH_ParameterSide.Output:
       {
     return new Param_GenericObject
       {
         NickName = GH_ComponentParamServer.InventUniqueNickname("abcdefghijklmn", this.Params.Output),
         Name = NickName,
         Description = "Script variable " + NickName,
       };
       }
     default:
       {
     return null;
       }
       }
 }
示例#3
0
 public bool CanInsertParameter(GH_ParameterSide side, int index)
 {
     if (side == GH_ParameterSide.Output)
     {
         return false;
     }
     return true;
 }
示例#4
0
        /**
         * CreateParameter: check if the name already exists on the left hand side. If it does, do not create it.
         * Create new parameters on the fly
         */
        public IGH_Param CreateParameter(GH_ParameterSide side, int index)
        {
            Param_String param = new Param_String();

            string name = "Label";
            string compareName = name;
            int iteration = 0;
            bool nameFound = false;

            while (nameFound == false)
            {
                bool NameExists = false;

                if (iteration > 0)
                {
                    compareName = name + "_" + iteration.ToString();
                }

                foreach (IGH_Param Input in this.Params.Input)
                {
                    if (Input.NickName == compareName)
                    {
                        NameExists = true;
                        break;
                    }
                }
                if (NameExists)
                {
                    iteration++;
                } else {
                    nameFound = true;
                }
            }

            param.NickName = compareName;

            return param;
        }
示例#5
0
文件: Target.cs 项目: visose/Robots
 bool IGH_VariableParameterComponent.DestroyParameter(GH_ParameterSide side, int index) => false;
 bool IGH_VariableParameterComponent.CanInsertParameter(GH_ParameterSide side, int index)
 {
     return true;
 }
示例#7
0
文件: Target.cs 项目: visose/Robots
 bool IGH_VariableParameterComponent.CanRemoveParameter(GH_ParameterSide side, int index) => false;
示例#8
0
文件: Target.cs 项目: visose/Robots
 IGH_Param IGH_VariableParameterComponent.CreateParameter(GH_ParameterSide side, int index) => null;
 public IGH_Param CreateParameter(GH_ParameterSide side, int index)
 {
     return new Grasshopper.Kernel.Parameters.Param_GenericObject();
 }
示例#10
0
 bool IGH_VariableParameterComponent.CanInsertParameter(GH_ParameterSide side, int index)
 {
     if (side == GH_ParameterSide.Input && Params.Input.Count < 10 && index == Params.Input.Count) return true;
     return false;
 }
示例#11
0
 public IGH_Param CreateParameter(GH_ParameterSide side, int index)
 {
     index_of_new_param = index;
     total_params_added++;
     if (total_params_added >= alpha.Length) total_params_added = 0;
     return new GHParam_DHr();
 }
 bool IGH_VariableParameterComponent.DestroyParameter(GH_ParameterSide side, int index)
 {
     //Nothing to do here by the moment
     return true;
 }
 bool IGH_VariableParameterComponent.CanRemoveParameter(GH_ParameterSide side, int index)
 {
     // see above.
     return false;
 }
示例#14
0
 public bool CanRemoveParameter(GH_ParameterSide side, int index)
 {
     if (index < min_params) return false;
     if ((side == GH_ParameterSide.Input) && (this.Params.Input.Count > min_params)) return true;
     return false;
 }
 bool IGH_VariableParameterComponent.CanInsertParameter(GH_ParameterSide side, int index)
 {
     // we want this to be false, because we don't want those pesky users adding their own parameters
     // (but what if a cluster is a variable-input one?)
     // well, we'll deal with that later.
     return false;
 }
示例#16
0
        IGH_Param IGH_VariableParameterComponent.CreateParameter(GH_ParameterSide side, int index)
        {
            String ltr = GH_ComponentParamServer.InventUniqueNickname("ABCDEFGHIJKLMNOPQRSTUVWXYZ", Params.Output);

            Param_Number param = new Param_Number {
                NickName = "t" + ltr,
                Name = "Variable" + ltr,
                Description = Name,
                Access = GH_ParamAccess.item
            };
            param.SetPersistentData(0.5);

            Param_Interval dparam = new Param_Interval {
                NickName = "d" + ltr,
                Name = "Domain" + ltr,
                Description = "Domain of Variable "+ltr,
                Access = GH_ParamAccess.item
            };
            dparam.SetPersistentData(new GH_Interval(new Interval(0.0,1.0)));
            Params.RegisterInputParam(dparam, Params.Input.Count);

            Param_Number oparam = new Param_Number {
                NickName = ltr,
                Name = "Variable" + ltr,
                Description = Name,
                Access = GH_ParamAccess.item
            };
            Params.RegisterOutputParam(oparam, Params.Input.Count);

            return param;
        }
示例#17
0
 bool IGH_VariableParameterComponent.CanRemoveParameter(GH_ParameterSide side, int index)
 {
     if (side == GH_ParameterSide.Input && Params.Input.Count > 2 && index%2==0) return true;
     return false;
 }
 bool IGH_VariableParameterComponent.CanRemoveParameter(GH_ParameterSide side, int index)
 {
     //leave two inputs
     if (side == GH_ParameterSide.Input)
     {
         if (Params.Input.Count > 2)
             return true;
         else
             return false;
     }
     else
     {
         if (Params.Output.Count > 0)
             return true;
         else
             return false;
     }
 }
 public bool CanRemoveParameter(GH_ParameterSide side, int index)
 {
     return side == GH_ParameterSide.Output;
 }
        IGH_Param IGH_VariableParameterComponent.CreateParameter(GH_ParameterSide side, int index)
        {
            Param_Number param = new Param_Number();
            param.Name = GH_ComponentParamServer.InventUniqueNickname("ABCDEFGHIJKLMNOPQRSTUVWXYZ", Params.Input);
            param.NickName = param.Name;
            param.Description = "Param" + (Params.Output.Count + 1);
            param.SetPersistentData(0.0);

            return param;
        }
示例#21
0
 bool IGH_VariableParameterComponent.CanRemoveParameter(GH_ParameterSide side, int index)
 {
     return (this as IGH_VariableParameterComponent).CanInsertParameter(side, index);
 }
示例#22
0
 // allways allow the parameter to be destroyed.
 public bool DestroyParameter(GH_ParameterSide side, int index)
 {
     return true;
 }
 public bool DestroyParameter(GH_ParameterSide side, int index)
 {
     return side == GH_ParameterSide.Output;
 }
 public bool CanInsertParameter(GH_ParameterSide side, int index)
 {
     return side == GH_ParameterSide.Output;
 }
示例#25
0
 bool IGH_VariableParameterComponent.DestroyParameter(GH_ParameterSide side, int index)
 {
     Params.UnregisterInputParameter(Params.Input[index + 1]);
     Params.UnregisterOutputParameter(Params.Output[index/2]);
     return true;
 }