public SpeckleBaseParam(string name, string nickname, string description, string category, string subcategory, GH_ParamAccess access) : base(name, nickname, description, category, subcategory, access) { }
void DefineInputsAndOutputs() { ClearRuntimeMessages(); string description = _remoteDefinition.GetDescription(out System.Drawing.Bitmap customIcon); if (!string.IsNullOrWhiteSpace(description) && !Description.Equals(description)) { Description = description; } var inputs = _remoteDefinition.GetInputParams(); var outputs = _remoteDefinition.GetOutputParams(); bool buildInputs = inputs != null; bool buildOutputs = outputs != null; // check to see if the existing params match Dictionary <string, List <IGH_Param> > inputSources = new Dictionary <string, List <IGH_Param> >(); foreach (var param in Params.Input) { inputSources.Add(param.Name, new List <IGH_Param>(param.Sources)); } if (buildInputs && Params.Input.Count == inputs.Count) { buildInputs = false; foreach (var param in Params.Input.ToArray()) { if (!inputs.ContainsKey(param.Name)) { buildInputs = true; break; } else { // if input param exists, make sure param access is correct var(input, _) = inputs[param.Name]; bool itemAccess = input.AtLeast == 1 && input.AtMost == 1; param.Access = itemAccess ? GH_ParamAccess.item : GH_ParamAccess.list; } } } if (buildOutputs && Params.Output.Count == outputs.Count) { buildOutputs = false; foreach (var param in Params.Output.ToArray()) { if (!outputs.ContainsKey(param.Name)) { buildOutputs = true; break; } } } // Remove all existing inputs and outputs if (buildInputs) { foreach (var param in Params.Input.ToArray()) { Params.UnregisterInputParameter(param); } } if (buildOutputs) { foreach (var param in Params.Output.ToArray()) { Params.UnregisterOutputParameter(param); } } bool recompute = false; if (buildInputs && inputs != null) { bool containsEmptyDefaults = false; var mgr = CreateInputManager(); foreach (var kv in inputs) { string name = kv.Key; var(input, param) = kv.Value; GH_ParamAccess access = GH_ParamAccess.list; if (input.AtLeast == 1 && input.AtMost == 1) { access = GH_ParamAccess.item; } string inputDescription = name; if (!string.IsNullOrWhiteSpace(input.Description)) { inputDescription = input.Description; } if (input.Default == null) { containsEmptyDefaults = true; } string nickname = name; if (!string.IsNullOrWhiteSpace(input.Nickname)) { nickname = input.Nickname; } int paramIndex = -1; switch (param) { case Grasshopper.Kernel.Parameters.Param_Arc _: paramIndex = mgr.AddArcParameter(name, nickname, inputDescription, access); break; case Grasshopper.Kernel.Parameters.Param_Boolean _: if (input.Default == null) { paramIndex = mgr.AddBooleanParameter(name, nickname, inputDescription, access); } else { paramIndex = mgr.AddBooleanParameter(name, nickname, inputDescription, access, Convert.ToBoolean(input.Default)); } break; case Grasshopper.Kernel.Parameters.Param_Box _: paramIndex = mgr.AddBoxParameter(name, nickname, inputDescription, access); break; case Grasshopper.Kernel.Parameters.Param_Brep _: paramIndex = mgr.AddBrepParameter(name, nickname, inputDescription, access); break; case Grasshopper.Kernel.Parameters.Param_Circle _: paramIndex = mgr.AddCircleParameter(name, nickname, inputDescription, access); break; case Grasshopper.Kernel.Parameters.Param_Colour _: paramIndex = mgr.AddColourParameter(name, nickname, inputDescription, access); break; case Grasshopper.Kernel.Parameters.Param_Complex _: paramIndex = mgr.AddComplexNumberParameter(name, nickname, inputDescription, access); break; case Grasshopper.Kernel.Parameters.Param_Culture _: paramIndex = mgr.AddCultureParameter(name, nickname, inputDescription, access); break; case Grasshopper.Kernel.Parameters.Param_Curve _: paramIndex = mgr.AddCurveParameter(name, nickname, inputDescription, access); break; case Grasshopper.Kernel.Parameters.Param_Field _: paramIndex = mgr.AddFieldParameter(name, nickname, inputDescription, access); break; case Grasshopper.Kernel.Parameters.Param_FilePath _: if (input.Default == null) { paramIndex = mgr.AddTextParameter(name, nickname, inputDescription, access); } else { paramIndex = mgr.AddTextParameter(name, nickname, inputDescription, access, input.Default.ToString()); } break; case Grasshopper.Kernel.Parameters.Param_GenericObject _: throw new Exception("generic param not supported"); case Grasshopper.Kernel.Parameters.Param_Geometry _: paramIndex = mgr.AddGeometryParameter(name, nickname, inputDescription, access); break; case Grasshopper.Kernel.Parameters.Param_Group _: throw new Exception("group param not supported"); case Grasshopper.Kernel.Parameters.Param_Guid _: throw new Exception("guid param not supported"); case Grasshopper.Kernel.Parameters.Param_Integer _: if (input.Default == null) { paramIndex = mgr.AddIntegerParameter(name, nickname, inputDescription, access); } else { paramIndex = mgr.AddIntegerParameter(name, nickname, inputDescription, access, Convert.ToInt32(input.Default)); } break; case Grasshopper.Kernel.Parameters.Param_Interval _: paramIndex = mgr.AddIntervalParameter(name, nickname, inputDescription, access); break; case Grasshopper.Kernel.Parameters.Param_Interval2D _: paramIndex = mgr.AddInterval2DParameter(name, nickname, inputDescription, access); break; case Grasshopper.Kernel.Parameters.Param_LatLonLocation _: throw new Exception("latlonlocation param not supported"); case Grasshopper.Kernel.Parameters.Param_Line _: if (input.Default == null) { paramIndex = mgr.AddLineParameter(name, nickname, inputDescription, access); } else { paramIndex = mgr.AddLineParameter(name, nickname, inputDescription, access, JsonConvert.DeserializeObject <Line>(input.Default.ToString())); } break; case Grasshopper.Kernel.Parameters.Param_Matrix _: paramIndex = mgr.AddMatrixParameter(name, nickname, inputDescription, access); break; case Grasshopper.Kernel.Parameters.Param_Mesh _: paramIndex = mgr.AddMeshParameter(name, nickname, inputDescription, access); break; case Grasshopper.Kernel.Parameters.Param_MeshFace _: paramIndex = mgr.AddMeshFaceParameter(name, nickname, inputDescription, access); break; case Grasshopper.Kernel.Parameters.Param_MeshParameters _: throw new Exception("meshparameters paran not supported"); case Grasshopper.Kernel.Parameters.Param_Number _: if (input.Default == null) { paramIndex = mgr.AddNumberParameter(name, nickname, inputDescription, access); } else { paramIndex = mgr.AddNumberParameter(name, nickname, inputDescription, access, Convert.ToDouble(input.Default)); } break; //case Grasshopper.Kernel.Parameters.Param_OGLShader: case Grasshopper.Kernel.Parameters.Param_Plane _: if (input.Default == null) { paramIndex = mgr.AddPlaneParameter(name, nickname, inputDescription, access); } else { paramIndex = mgr.AddPlaneParameter(name, nickname, inputDescription, access, JsonConvert.DeserializeObject <Plane>(input.Default.ToString())); } break; case Grasshopper.Kernel.Parameters.Param_Point _: if (input.Default == null) { paramIndex = mgr.AddPointParameter(name, nickname, inputDescription, access); } else { paramIndex = mgr.AddPointParameter(name, nickname, inputDescription, access, JsonConvert.DeserializeObject <Point3d>(input.Default.ToString())); } break; case Grasshopper.Kernel.Parameters.Param_Rectangle _: paramIndex = mgr.AddRectangleParameter(name, nickname, inputDescription, access); break; //case Grasshopper.Kernel.Parameters.Param_ScriptVariable _: case Grasshopper.Kernel.Parameters.Param_String _: if (input.Default == null) { paramIndex = mgr.AddTextParameter(name, nickname, inputDescription, access); } else { paramIndex = mgr.AddTextParameter(name, nickname, inputDescription, access, input.Default.ToString()); } break; case Grasshopper.Kernel.Parameters.Param_StructurePath _: paramIndex = mgr.AddPathParameter(name, nickname, inputDescription, access); break; case Grasshopper.Kernel.Parameters.Param_SubD _: paramIndex = mgr.AddSubDParameter(name, nickname, inputDescription, access); break; case Grasshopper.Kernel.Parameters.Param_Surface _: paramIndex = mgr.AddSurfaceParameter(name, nickname, inputDescription, access); break; case Grasshopper.Kernel.Parameters.Param_Time _: paramIndex = mgr.AddTimeParameter(name, nickname, inputDescription, access); break; case Grasshopper.Kernel.Parameters.Param_Transform _: paramIndex = mgr.AddTransformParameter(name, nickname, inputDescription, access); break; case Grasshopper.Kernel.Parameters.Param_Vector _: if (input.Default == null) { paramIndex = mgr.AddVectorParameter(name, nickname, inputDescription, access); } else { paramIndex = mgr.AddVectorParameter(name, nickname, inputDescription, access, JsonConvert.DeserializeObject <Vector3d>(input.Default.ToString())); } break; case Grasshopper.Kernel.Special.GH_NumberSlider _: paramIndex = mgr.AddNumberParameter(name, nickname, inputDescription, access); break; } if (paramIndex >= 0 && inputSources.TryGetValue(name, out List <IGH_Param> rehookInputs)) { foreach (var rehookInput in rehookInputs) { Params.Input[paramIndex].AddSource(rehookInput); } } } if (!containsEmptyDefaults) { recompute = true; } } if (buildOutputs && outputs != null) { var mgr = CreateOutputManager(); foreach (var kv in outputs) { string name = kv.Key; var param = kv.Value; string nickname = name; if (!string.IsNullOrWhiteSpace(param.NickName)) { nickname = param.NickName; } string outputDescription = name; if (!string.IsNullOrWhiteSpace(param.Description)) { outputDescription = param.Description; } switch (param) { case Grasshopper.Kernel.Parameters.Param_Arc _: mgr.AddArcParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_Boolean _: mgr.AddBooleanParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_Box _: mgr.AddBoxParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_Brep _: mgr.AddBrepParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_Circle _: mgr.AddCircleParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_Colour _: mgr.AddColourParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_Complex _: mgr.AddComplexNumberParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_Culture _: mgr.AddCultureParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_Curve _: mgr.AddCurveParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_Field _: mgr.AddFieldParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_FilePath _: mgr.AddTextParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_GenericObject _: throw new Exception("generic param not supported"); case Grasshopper.Kernel.Parameters.Param_Geometry _: mgr.AddGeometryParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_Group _: throw new Exception("group param not supported"); case Grasshopper.Kernel.Parameters.Param_Guid _: throw new Exception("guid param not supported"); case Grasshopper.Kernel.Parameters.Param_Integer _: mgr.AddIntegerParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_Interval _: mgr.AddIntervalParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_Interval2D _: mgr.AddInterval2DParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_LatLonLocation _: throw new Exception("latlonlocation param not supported"); case Grasshopper.Kernel.Parameters.Param_Line _: mgr.AddLineParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_Matrix _: mgr.AddMatrixParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_Mesh _: mgr.AddMeshParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_MeshFace _: mgr.AddMeshFaceParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_MeshParameters _: throw new Exception("meshparameters paran not supported"); case Grasshopper.Kernel.Parameters.Param_Number _: mgr.AddNumberParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; //case Grasshopper.Kernel.Parameters.Param_OGLShader: case Grasshopper.Kernel.Parameters.Param_Plane _: mgr.AddPlaneParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_Point _: mgr.AddPointParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_Rectangle _: mgr.AddRectangleParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; //case Grasshopper.Kernel.Parameters.Param_ScriptVariable _: case Grasshopper.Kernel.Parameters.Param_String _: mgr.AddTextParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_StructurePath _: mgr.AddPathParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_SubD _: mgr.AddSubDParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_Surface _: mgr.AddSurfaceParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_Time _: mgr.AddTimeParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_Transform _: mgr.AddTransformParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; case Grasshopper.Kernel.Parameters.Param_Vector _: mgr.AddVectorParameter(name, nickname, outputDescription, GH_ParamAccess.tree); break; } } } if (customIcon != null) { // Draw hops icon overlay on custom icon. We can add an option // to the data returned from a server to skip this overlay in // the future. // Create a slightly large image so we can cram the hops overlay // deeper into the lower right corner //var bmp = new System.Drawing.Bitmap(28, 28); //using(var graphics = System.Drawing.Graphics.FromImage(bmp)) //{ // // use fill to debug // //graphics.FillRectangle(System.Drawing.Brushes.PowderBlue, 0, 0, 28, 28); // var rect = new System.Drawing.Rectangle(2, 2, 24, 24); // graphics.DrawImage(customIcon, rect); // rect = new System.Drawing.Rectangle(16, 14, 14, 14); // graphics.DrawImage(Hops24Icon(), rect); //} SetIconOverride(customIcon); } if (buildInputs || buildOutputs) { Params.OnParametersChanged(); Grasshopper.Instances.ActiveCanvas?.Invalidate(); if (recompute) { var doc = OnPingDocument(); if (doc != null) { doc.NewSolution(true); } } } }
public SpeckleBaseParam(string name, string nickname, string description, GH_ParamAccess access) : this(name, nickname, description, ComponentCategories.PRIMARY_RIBBON, "Params", access) { }
private void paramColor(int index, string name, string nickName, string description, GH_ParamAccess access, System.Drawing.Color Value) { if ((Params.Input.Count - 1) < index) { Params.RegisterInputParam(new Param_Colour(), index); Params.OnParametersChanged(); } else { if (Params.Input[index].GetType() != new Param_Colour().GetType()) { Params.Input[index].RemoveAllSources(); Params.Input[index] = new Param_Colour(); Params.OnParametersChanged(); } } Params.Input[index].ClearData(); Param_Colour param = (Param_Colour)Params.Input[index]; param.PersistentData.ClearData(); param.PersistentData.Clear(); param.SetPersistentData(Value); SetParamProperties(index, name, nickName, description, access); }
protected ParameterValue(string name, string nickname, string description, string category, string subcategory, GH_ParamAccess access) : base(name, nickname, description, category, subcategory, access) { }
private void SetParamProperties(int index, string name, string nickName, string description, GH_ParamAccess access) { Params.Input[index].Name = name; Params.Input[index].NickName = nickName; Params.Input[index].Description = description; Params.Input[index].Access = access; }
public Schema CreateSolveInput(IGH_DataAccess DA, bool cacheSolveOnServer, out List <string> warnings) { warnings = new List <string>(); var schema = new Resthopper.IO.Schema(); schema.CacheSolve = cacheSolveOnServer; var inputs = GetInputParams(); if (inputs != null) { foreach (var kv in inputs) { var(input, param) = kv.Value; string inputName = kv.Key; string computeName = input.Name; GH_ParamAccess access = AccessFromInput(input); var dataTree = new DataTree <Resthopper.IO.ResthopperObject>(); dataTree.ParamName = computeName; schema.Values.Add(dataTree); int inputListCount = 0; switch (param) { case Grasshopper.Kernel.Parameters.Param_Arc _: CollectDataHelper2 <Arc, GH_Arc>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Boolean _: CollectDataHelper2 <bool, GH_Boolean>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Box _: CollectDataHelper2 <Box, GH_Box>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Brep _: CollectDataHelper2 <Brep, GH_Brep>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Circle _: CollectDataHelper2 <Circle, GH_Circle>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Colour _: CollectDataHelper2 <System.Drawing.Color, GH_Colour>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Complex _: CollectDataHelper2 <Complex, GH_ComplexNumber>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Culture _: CollectDataHelper2 <System.Globalization.CultureInfo, GH_Culture>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Curve _: CollectDataHelper2 <Curve, GH_Curve>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Field _: CollectDataHelper <Grasshopper.Kernel.Types.GH_Field>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_FilePath _: CollectDataHelper2 <string, GH_String>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_GenericObject _: throw new Exception("generic param not supported"); case Grasshopper.Kernel.Parameters.Param_Geometry _: CollectDataHelper <GeometryBase>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Group _: throw new Exception("group param not supported"); case Grasshopper.Kernel.Parameters.Param_Guid _: CollectDataHelper2 <Guid, GH_Guid>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Integer _: CollectDataHelper2 <int, GH_Integer>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Interval _: CollectDataHelper2 <Interval, GH_Interval>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Interval2D _: CollectDataHelper2 <UVInterval, GH_Interval2D>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_LatLonLocation _: throw new Exception("latlonlocation param not supported"); case Grasshopper.Kernel.Parameters.Param_Line _: CollectDataHelper2 <Line, GH_Line>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Matrix _: CollectDataHelper2 <Matrix, GH_Matrix>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Mesh _: CollectDataHelper2 <Mesh, GH_Mesh>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_MeshFace _: CollectDataHelper2 <MeshFace, GH_MeshFace>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_MeshParameters _: CollectDataHelper2 <MeshingParameters, GH_MeshingParameters>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Number _: CollectDataHelper2 <double, GH_Number>(DA, inputName, access, ref inputListCount, dataTree); break; //case Grasshopper.Kernel.Parameters.Param_OGLShader: case Grasshopper.Kernel.Parameters.Param_Plane _: CollectDataHelper2 <Plane, GH_Plane>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Point _: // TODO: figure out how Point3d trees should be handled CollectDataHelper <Point3d>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Rectangle _: CollectDataHelper2 <Rectangle3d, GH_Rectangle>(DA, inputName, access, ref inputListCount, dataTree); break; //case Grasshopper.Kernel.Parameters.Param_ScriptVariable _: case Grasshopper.Kernel.Parameters.Param_String _: CollectDataHelper2 <string, GH_String>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_StructurePath _: CollectDataHelper2 <Grasshopper.Kernel.Data.GH_Path, GH_StructurePath>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_SubD _: CollectDataHelper2 <SubD, GH_SubD>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Surface _: CollectDataHelper <Surface>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Time _: CollectDataHelper2 <DateTime, GH_Time>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Transform _: CollectDataHelper2 <Transform, GH_Transform>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Parameters.Param_Vector _: CollectDataHelper2 <Vector3d, GH_Vector>(DA, inputName, access, ref inputListCount, dataTree); break; case Grasshopper.Kernel.Special.GH_NumberSlider _: CollectDataHelper2 <double, GH_Number>(DA, inputName, access, ref inputListCount, dataTree); break; } if (access == GH_ParamAccess.list) { if (inputListCount < input.AtLeast) { warnings.Add($"{input.Name} requires at least {input.AtLeast} items"); } if (inputListCount > input.AtMost) { warnings.Add($"{input.Name} requires at most {input.AtMost} items"); } } } } schema.Pointer = Path; var pathType = GetPathType(); if (pathType == PathType.Server) { string definition = Path.Substring(Path.LastIndexOf('/') + 1); schema.Pointer = definition; } return(schema); }
public SpeckleStreamParam(IGH_InstanceDescription tag, GH_ParamAccess access) : base(tag, access) { }
public GH_InputParamProps(Type type, string name, string nickname, string description, GH_ParamAccess access, object defaultValue, bool optional) { this.dataType = type; this.name = name; this.nickname = nickname; this.description = description; this.access = access; this.defaultValue = defaultValue; this.optional = optional; }
protected IGH_Param NewBooleanParam(string _name, string _nickname, string _desc, GH_ParamAccess paramAccess, bool _default) { Param_Boolean pn = new Param_Boolean(); pn.Name = _name; pn.NickName = _nickname; pn.Description = _desc; pn.Access = paramAccess; pn.SetPersistentData(new GH_Boolean(_default)); Params.RegisterInputParam(pn); return(pn); }