internal override void FixGhInput(Param_ScriptVariable param, bool alsoSetIfNecessary = true)
        {
            param.NickName = Decodes_PythonComponent.cleanNickname(param.NickName);
            param.NickName = param.NickName.Replace("_" + Decodes_PythonComponent.attributes_suffix, "_baduser");
            if (String.Compare(param.NickName, "code", StringComparison.InvariantCultureIgnoreCase) == 0)
            {
                param.NickName = "baduser";
            }

            param.Name = param.NickName; // set name to nickname, omitting array brackets (added below)

            //if (param.Access == GH_ParamAccess.list) NickName = "[" + NickName + "]";

            if (string.IsNullOrEmpty(Description))
            {
                Description = string.Format("Script variable {0}", Name);
            }
            param.Optional  = true;
            param.ShowHints = true;

            param.Hints = Decodes_PythonComponent.GetHints();
            if (param.TypeHint == null)
            {
                param.TypeHint = param.Hints[0];
            }
        }
Esempio n. 2
0
        internal override void FixGhInput(Param_ScriptVariable i, bool alsoSetIfNecessary = true)
        {
            i.Name            = string.Format("Variable {0}", i.NickName);
            i.Description     = string.Format("Script Variable {0}", i.NickName);
            i.AllowTreeAccess = true;
            i.Optional        = true;
            i.ShowHints       = true;

            i.Hints = new List <IGH_TypeHint>();

            i.Hints.Add(new DynamicHint(this));
            i.Hints.AddRange(PossibleHints);
            i.Hints.AddRange(new IGH_TypeHint[]
            {
                new SpecialBoxHint(this),
                new GH_HintSeparator(),
                new SpecialLineHint(this),
                new SpecialCircleHint(this),
                new SpecialArcHint(this),
                new SpecialPolylineHint(this)
            });
            i.Hints.AddRange(AlreadyGeometryBaseHints);

            if (alsoSetIfNecessary && i.TypeHint == null)
            {
                i.TypeHint = i.Hints[0];
            }
        }
Esempio n. 3
0
 IGH_Param ConstructVariable(GH_VarParamSide side, string nickname)
 {
     if (side == GH_VarParamSide.Input)
     {
         var param = new Param_ScriptVariable();
         if (!string.IsNullOrWhiteSpace(nickname))
         {
             param.NickName = nickname;
         }
         FixGhInput(param);
         return(param);
     }
     if (side == GH_VarParamSide.Output)
     {
         var param = new Param_GenericObject();
         if (string.IsNullOrWhiteSpace(nickname))
         {
             param.Name = param.NickName;
         }
         else
         {
             param.NickName = nickname;
             param.Name     = String.Format("Result {0}", nickname);
         }
         param.Description = String.Format("Output parameter {0}", param.NickName);
         return(param);
     }
     return(null);
 }
Esempio n. 4
0
        internal void FixGhInput(Param_ScriptVariable i, bool alsoSetIfNecessary = true)
        {
            i.Name            = i.NickName;
            i.AllowTreeAccess = true;
            i.Optional        = true;
            i.ShowHints       = true;
            i.Hints           = TypeHints.GetHints();

            if (string.IsNullOrEmpty(i.Description))
            {
                i.Description = string.Format("Script variable {0}", i.NickName);
            }

            if (alsoSetIfNecessary && i.TypeHint == null)
            {
                i.TypeHint = i.Hints[1];
            }
        }
Esempio n. 5
0
        public static void ToNewRhinoCommonHint(Param_ScriptVariable sc)
        {
            if (sc == null || sc.TypeHint == null)
            {
                return;
            }

            Type probeType = sc.TypeHint.GetType();

            if (_old_to_common.ContainsKey(probeType))
            {
                var type = _old_to_common[probeType];
                if (type != null)
                {
                    sc.TypeHint = System.Activator.CreateInstance(type) as IGH_TypeHint;
                }
            }
        }
Esempio n. 6
0
        internal override void FixGhInput(Param_ScriptVariable i, bool alsoSetIfNecessary = true)
        {
            i.Name = i.NickName;

            if (string.IsNullOrEmpty(i.Description))
            {
                i.Description = string.Format("Script variable {0}", i.NickName);
            }
            i.AllowTreeAccess = true;
            i.Optional        = true;
            i.ShowHints       = true;
            i.Hints           = GetHints();

            if (alsoSetIfNecessary && i.TypeHint == null)
            {
                i.TypeHint = i.Hints[0]; // ksteinfe: it looks like this is where the default hint is set
            }
        }
Esempio n. 7
0
        public Decodes_Param_ScriptVariable(Param_ScriptVariable other)
        {
            this.CopyFrom(other);
            this.Access      = other.Access;
            this.DataMapping = other.DataMapping;
            this.Optional    = other.Optional;
            this.Reverse     = other.Reverse;
            this.Simplify    = other.Simplify;
            this.WireDisplay = other.WireDisplay;

            this.TypeHint  = other.TypeHint;
            this.Hints     = other.Hints;
            this.ShowHints = other.ShowHints;

            this.Name     = other.Name;
            this.NickName = other.NickName;



            FixGhInput();
        }
Esempio n. 8
0
        private object TypeCast(IGH_Goo data, int index)
        {
            Param_ScriptVariable variable = (Param_ScriptVariable)_component.Params.Input[index];

            return(this.TypeCast(data, variable.TypeHint));
        }
Esempio n. 9
0
 IGH_Param ConstructVariable(GH_VarParamSide side, string nickname)
 {
     if (side == GH_VarParamSide.Input)
       {
     var param = new Param_ScriptVariable();
     if (!string.IsNullOrWhiteSpace(nickname))
       param.NickName = nickname;
     FixGhInput(param);
     return param;
       }
       if (side == GH_VarParamSide.Output)
       {
     var param = new Param_GenericObject();
     if (string.IsNullOrWhiteSpace(nickname))
       param.Name = param.NickName;
     else
     {
       param.NickName = nickname;
       param.Name = String.Format("Result {0}", nickname);
     }
     param.Description = String.Format("Output parameter {0}", param.NickName);
     return param;
       }
       return null;
 }
Esempio n. 10
0
        internal override void FixGhInput(Param_ScriptVariable i, bool alsoSetIfNecessary = true)
        {
            i.Name = string.Format("Variable {0}", i.NickName);
              i.Description = string.Format("Script Variable {0}", i.NickName);
              i.AllowTreeAccess = true;
              i.Optional = true;
              i.ShowHints = true;

              i.Hints = new List<IGH_TypeHint>();

              i.Hints.Add(new DynamicHint(this));
              i.Hints.AddRange(PossibleHints);
              i.Hints.AddRange(new IGH_TypeHint[]
            {
                new SpecialBoxHint(this),
                new GH_HintSeparator(),
                new SpecialLineHint(this),
                new SpecialCircleHint(this),
                new SpecialArcHint(this),
                new SpecialPolylineHint(this)
            });
              i.Hints.AddRange(AlreadyGeometryBaseHints);

              if (alsoSetIfNecessary && i.TypeHint == null)
            i.TypeHint = i.Hints[0];
        }
 internal abstract void FixGhInput(Param_ScriptVariable i, bool alsoSetIfNecessary = true);
Esempio n. 12
0
        internal override void FixGhInput(Param_ScriptVariable i, bool alsoSetIfNecessary = true)
        {
            i.Name = i.NickName;

              if (string.IsNullOrEmpty(i.Description))
            i.Description = string.Format("Script variable {0}", i.NickName);
              i.AllowTreeAccess = true;
              i.Optional = true;
              i.ShowHints = true;
              i.Hints = GetHints();

              if (alsoSetIfNecessary && i.TypeHint == null)
            i.TypeHint = i.Hints[1];
        }
 internal abstract void FixGhInput(Param_ScriptVariable i, bool alsoSetIfNecessary = true); // ksteinfe (previously Param_ScriptVariable)
Esempio n. 14
0
        public static void ToNewRhinoCommonHint(Param_ScriptVariable sc)
        {
            if (sc == null || sc.TypeHint == null) return;

              Type probeType = sc.TypeHint.GetType();

              if (_old_to_common.ContainsKey(probeType))
              {
            var type = _old_to_common[probeType];
            if (type != null)
              sc.TypeHint = System.Activator.CreateInstance(type) as IGH_TypeHint;
              }
        }
 internal abstract void FixGhInput(Param_ScriptVariable i, bool alsoSetIfNecessary = true);