예제 #1
0
파일: Match.cs 프로젝트: shapediver/Aviary
        /// <summary>
        /// Registers all the input parameters for this component.
        /// </summary>
        protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
        {
            pManager.AddGenericParameter("Source Bitmap", "B", "---", GH_ParamAccess.item);
            pManager[0].Optional = true;

            Param_GenericObject paramGen = (Param_GenericObject)Params.Input[0];

            paramGen.SetPersistentData(new Bitmap(10, 10));

            pManager.AddGenericParameter("Target Bitmap", "T", "---", GH_ParamAccess.item);
            pManager[0].Optional = true;

            Param_GenericObject paramGenA = (Param_GenericObject)Params.Input[1];

            paramGenA.SetPersistentData(new Bitmap(10, 10));

            pManager.AddIntegerParameter("Mode", "M", "...", GH_ParamAccess.item, 0);
            pManager[2].Optional = true;

            Param_Integer paramA = (Param_Integer)Params.Input[2];

            paramA.AddNamedValue("Crop", 0);
            paramA.AddNamedValue("Fit", 1);
            paramA.AddNamedValue("Stretch", 2);
        }
예제 #2
0
        /// <summary>
        /// Registers all the input parameters for this component.
        /// </summary>
        protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
        {
            pManager.AddGenericParameter("Bitmap", "B", "---", GH_ParamAccess.item);
            pManager[0].Optional = true;

            Param_GenericObject paramGen = (Param_GenericObject)Params.Input[0];

            paramGen.SetPersistentData(new GH_ObjectWrapper(new Bitmap(10, 10)));

            pManager.AddIntegerParameter("Mode", "M", "---", GH_ParamAccess.item, 0);
            pManager[1].Optional = true;

            pManager.AddNumberParameter("Adjust Value", "T", "Suggested Range [0,1]", GH_ParamAccess.item, 0);
            pManager[2].Optional = true;

            Param_Integer param = (Param_Integer)Params.Input[1];

            param.AddNamedValue(modes[0], 0);
            param.AddNamedValue(modes[1], 1);
            param.AddNamedValue(modes[2], 2);
            param.AddNamedValue(modes[3], 3);
            param.AddNamedValue(modes[4], 4);
            param.AddNamedValue(modes[5], 5);
            param.AddNamedValue(modes[6], 6);
            param.AddNamedValue(modes[7], 7);
            param.AddNamedValue(modes[8], 8);
            param.AddNamedValue(modes[9], 9);
        }
예제 #3
0
파일: Polar.cs 프로젝트: shapediver/Aviary
        /// <summary>
        /// Registers all the input parameters for this component.
        /// </summary>
        protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
        {
            pManager.AddGenericParameter("Bitmap", "B", "---", GH_ParamAccess.item);
            pManager[0].Optional = true;

            Param_GenericObject paramGen = (Param_GenericObject)Params.Input[0];

            paramGen.SetPersistentData(new Bitmap(10, 10));

            pManager.AddIntegerParameter("Mode", "M", "...", GH_ParamAccess.item, 0);
            pManager[1].Optional = true;
            pManager.AddNumberParameter("Offset", "O", "...", GH_ParamAccess.item, 0);
            pManager[2].Optional = true;
            pManager.AddNumberParameter("Depth", "D", "...", GH_ParamAccess.item, 1);
            pManager[3].Optional = true;
            pManager.AddIntegerParameter("Width", "W", "...", GH_ParamAccess.item, 600);
            pManager[4].Optional = true;
            pManager.AddIntegerParameter("Height", "H", "...", GH_ParamAccess.item, 600);
            pManager[5].Optional = true;

            Param_Integer param = (Param_Integer)Params.Input[1];

            param.AddNamedValue(modes[0], 0);
            param.AddNamedValue(modes[1], 1);
        }
        /// <summary>
        /// Adds a property to the component's inputs.
        /// </summary>
        /// <param name="param"></param>
        private void RegisterPropertyAsInputParameter(ParameterInfo param, int index)
        {
            // get property name and value
              Type propType = param.ParameterType;
              if (propType.IsGenericType && propType.GetGenericTypeDefinition() == typeof(Nullable<>))
            propType = Nullable.GetUnderlyingType(propType);

              string propName = param.Name;
              object propValue = param;

              var inputDesc = param.GetCustomAttribute<SchemaParamInfo>();
              var d = inputDesc != null ? inputDesc.Description : "";
              if (param.IsOptional)
              {
            if (!string.IsNullOrEmpty(d))
              d += ", ";
            var def = param.DefaultValue == null ? "null" : param.DefaultValue.ToString();
            d += "default = " + def;
              }

              // Create new param based on property name
              Param_GenericObject newInputParam = new Param_GenericObject();
              newInputParam.Name = propName;
              newInputParam.NickName = propName;
              newInputParam.MutableNickName = false;

              newInputParam.Description = $"({propType.Name}) {d}";
              newInputParam.Optional = param.IsOptional;
              if (param.IsOptional)
            newInputParam.SetPersistentData(param.DefaultValue);

              // check if input needs to be a list or item access
              bool isCollection = typeof(System.Collections.IEnumerable).IsAssignableFrom(propType) &&
                          propType != typeof(string) && !propType.Name.ToLower().Contains("dictionary");
              if (isCollection == true)
              {
            newInputParam.Access = GH_ParamAccess.list;
              }
              else
              {
            newInputParam.Access = GH_ParamAccess.item;
              }

              Params.RegisterInputParam(newInputParam, index);

              //add dropdown
              if (propType.IsEnum)
              {
            //expire solution so that node gets proper size
            ExpireSolution(true);

            var instance = Activator.CreateInstance(propType);

            var vals = Enum.GetValues(propType).Cast<Enum>().Select(x => x.ToString()).ToList();
            var options = CreateDropDown(propName, vals, Attributes.Bounds.X, Params.Input[index].Attributes.Bounds.Y);
            _document.AddObject(options, false);
            Params.Input[index].AddSource(options);
              }
        }
예제 #5
0
        /// <summary>
        /// Registers all the input parameters for this component.
        /// </summary>
        protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
        {
            pManager.AddGenericParameter("Bitmap", "B", "---", GH_ParamAccess.item);
            pManager[0].Optional = true;

            Param_GenericObject paramGen = (Param_GenericObject)Params.Input[0];

            paramGen.SetPersistentData(new Bitmap(10, 10));

            pManager.AddIntegerParameter("Alpha", "Ac", "...", GH_ParamAccess.item, 0);
            pManager[1].Optional = true;
            pManager.AddIntegerParameter("Red", "Rc", "...", GH_ParamAccess.item, 1);
            pManager[2].Optional = true;
            pManager.AddIntegerParameter("Green", "Gc", "...", GH_ParamAccess.item, 2);
            pManager[3].Optional = true;
            pManager.AddIntegerParameter("Blue", "Bc", "...", GH_ParamAccess.item, 3);
            pManager[4].Optional = true;

            Param_Integer paramA = (Param_Integer)Params.Input[1];

            paramA.AddNamedValue(modes[0], 0);
            paramA.AddNamedValue(modes[1], 1);
            paramA.AddNamedValue(modes[2], 2);
            paramA.AddNamedValue(modes[3], 3);
            paramA.AddNamedValue(modes[4], 4);
            paramA.AddNamedValue(modes[5], 5);
            paramA.AddNamedValue(modes[6], 6);

            Param_Integer paramR = (Param_Integer)Params.Input[2];

            paramR.AddNamedValue(modes[0], 0);
            paramR.AddNamedValue(modes[1], 1);
            paramR.AddNamedValue(modes[2], 2);
            paramR.AddNamedValue(modes[3], 3);
            paramR.AddNamedValue(modes[4], 4);
            paramR.AddNamedValue(modes[5], 5);
            paramR.AddNamedValue(modes[6], 6);

            Param_Integer paramG = (Param_Integer)Params.Input[3];

            paramG.AddNamedValue(modes[0], 0);
            paramG.AddNamedValue(modes[1], 1);
            paramG.AddNamedValue(modes[2], 2);
            paramG.AddNamedValue(modes[3], 3);
            paramG.AddNamedValue(modes[4], 4);
            paramG.AddNamedValue(modes[5], 5);
            paramG.AddNamedValue(modes[6], 6);

            Param_Integer paramB = (Param_Integer)Params.Input[4];

            paramB.AddNamedValue(modes[0], 0);
            paramB.AddNamedValue(modes[1], 1);
            paramB.AddNamedValue(modes[2], 2);
            paramB.AddNamedValue(modes[3], 3);
            paramB.AddNamedValue(modes[4], 4);
            paramB.AddNamedValue(modes[5], 5);
            paramB.AddNamedValue(modes[6], 6);
        }
예제 #6
0
        /// <summary>
        /// Registers all the input parameters for this component.
        /// </summary>
        protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
        {
            pManager.AddGenericParameter("Bitmap", "B", "---", GH_ParamAccess.item);
            pManager[0].Optional = true;

            Param_GenericObject paramGen = (Param_GenericObject)Params.Input[0];

            paramGen.SetPersistentData(new Bitmap(10, 10));
        }
예제 #7
0
        /// <summary>
        /// Adds to the default deserialization method to retrieve the saved child status so it persists on copy/paste and save/reopen.
        /// </summary>
        public override bool Read(GH_IReader reader)
        {
            ModeIndex = reader.GetInt32("ModeIndex");

            Param_GenericObject paramGen = (Param_GenericObject)Params.Input[0];

            paramGen.SetPersistentData(new Bitmap(10, 10));

            UpdateMessage();
            return(base.Read(reader));
        }
예제 #8
0
파일: Levels.cs 프로젝트: shapediver/Aviary
        /// <summary>
        /// Registers all the input parameters for this component.
        /// </summary>
        protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
        {
            pManager.AddGenericParameter("Bitmap", "B", "---", GH_ParamAccess.item);
            pManager[0].Optional = true;
            Param_GenericObject paramGen = (Param_GenericObject)Params.Input[0];

            paramGen.SetPersistentData(new Bitmap(10, 10));

            pManager.AddIntervalParameter("Gray In", "G0", "---", GH_ParamAccess.item, new Interval(0, 255));
            pManager[1].Optional = true;
            pManager.AddIntervalParameter("Gray Out", "G1", "---", GH_ParamAccess.item, new Interval(0, 255));
            pManager[2].Optional = true;
        }
예제 #9
0
파일: Mirror.cs 프로젝트: shapediver/Aviary
        /// <summary>
        /// Registers all the input parameters for this component.
        /// </summary>
        protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
        {
            pManager.AddGenericParameter("Bitmap", "B", "---", GH_ParamAccess.item);
            pManager[0].Optional = true;

            Param_GenericObject paramGen = (Param_GenericObject)Params.Input[0];

            paramGen.SetPersistentData(new Bitmap(10, 10));

            pManager.AddBooleanParameter("Horizontal", "H", "---", GH_ParamAccess.item, false);
            pManager[1].Optional = true;
            pManager.AddBooleanParameter("Vertical", "V", "---", GH_ParamAccess.item, false);
            pManager[2].Optional = true;
        }
예제 #10
0
파일: Crop.cs 프로젝트: shapediver/Aviary
        /// <summary>
        /// Registers all the input parameters for this component.
        /// </summary>
        protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
        {
            pManager.AddGenericParameter("Bitmap", "B", "---", GH_ParamAccess.item);
            pManager[0].Optional = true;

            Param_GenericObject paramGen = (Param_GenericObject)Params.Input[0];

            paramGen.SetPersistentData(new Bitmap(10, 10));

            pManager.AddColourParameter("Background", "C", "---", GH_ParamAccess.item, Color.Transparent);
            pManager[1].Optional = true;

            pManager.AddRectangleParameter("Rectangle", "R", "---", GH_ParamAccess.item, new Rectangle3d(Plane.WorldXY, 800, 600));
            pManager[2].Optional = true;
        }
예제 #11
0
        /// <summary>
        /// Registers all the input parameters for this component.
        /// </summary>
        protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
        {
            pManager.AddGenericParameter("Bitmap", "B", "---", GH_ParamAccess.item);
            pManager[0].Optional = true;

            Param_GenericObject paramGen = (Param_GenericObject)Params.Input[0];

            paramGen.SetPersistentData(new Bitmap(10, 10));

            pManager.AddColourParameter("Source", "S", "...", GH_ParamAccess.item, System.Drawing.Color.Red);
            pManager[1].Optional = true;
            pManager.AddColourParameter("Target", "T", "...", GH_ParamAccess.item, System.Drawing.Color.Blue);
            pManager[2].Optional = true;
            pManager.AddNumberParameter("Radius", "R", "...", GH_ParamAccess.item, 100);
            pManager[3].Optional = true;
        }
예제 #12
0
        /// <summary>
        /// Registers all the input parameters for this component.
        /// </summary>
        protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
        {
            pManager.AddGenericParameter("Bitmap", "B", "---", GH_ParamAccess.item);
            pManager[0].Optional = true;

            Param_GenericObject paramGen = (Param_GenericObject)Params.Input[0];

            paramGen.SetPersistentData(new Bitmap(10, 10));

            pManager.AddColourParameter("Color", "C", "Replacement Color", GH_ParamAccess.item, Color.Black);
            pManager[1].Optional = true;
            pManager.AddIntervalParameter("Red", "R", "---", GH_ParamAccess.item, new Interval(0, 255));
            pManager[2].Optional = true;
            pManager.AddIntervalParameter("Green", "G", "---", GH_ParamAccess.item, new Interval(0, 255));
            pManager[3].Optional = true;
            pManager.AddIntervalParameter("Blue", "B", "---", GH_ParamAccess.item, new Interval(0, 255));
            pManager[4].Optional = true;
        }
예제 #13
0
        /// <summary>
        /// Registers all the input parameters for this component.
        /// </summary>
        protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
        {
            pManager.AddGenericParameter("Bitmap", "B", "---", GH_ParamAccess.item);
            pManager[0].Optional = true;

            Param_GenericObject paramGen = (Param_GenericObject)Params.Input[0];

            paramGen.SetPersistentData(new Bitmap(10, 10));

            pManager.AddIntervalParameter("Luminance", "LI", "---", GH_ParamAccess.item, new Interval(0.0, 1.0));
            pManager[1].Optional = true;
            pManager.AddIntervalParameter("Luminance", "LO", "---", GH_ParamAccess.item, new Interval(0.0, 1.0));
            pManager[2].Optional = true;
            pManager.AddIntervalParameter("Saturation In", "SI", "---", GH_ParamAccess.item, new Interval(0.0, 1.0));
            pManager[3].Optional = true;
            pManager.AddIntervalParameter("Saturation Out", "SO", "---", GH_ParamAccess.item, new Interval(0.0, 1.0));
            pManager[4].Optional = true;
        }
예제 #14
0
        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

        private void ModeA(Object sender, EventArgs e)
        {
            ClearInput();
            ClearInput();
            ModeIndex = 0;

            Param_GenericObject param = new Param_GenericObject();

            param.Name        = "Bitmap";
            param.NickName    = "B";
            param.Description = "---";
            param.Access      = GH_ParamAccess.item;
            param.SetPersistentData(new Bitmap(10, 10));
            param.Optional = true;

            Params.RegisterInputParam(param, 1);
            Params.OnParametersChanged();

            UpdateMessage();
            ExpireSolution(true);
        }
예제 #15
0
        /// <summary>
        /// Registers all the input parameters for this component.
        /// </summary>
        protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
        {
            pManager.AddGenericParameter("Bitmap", "B", "---", GH_ParamAccess.item);
            pManager[0].Optional = true;

            Param_GenericObject paramGen = (Param_GenericObject)Params.Input[0];

            paramGen.SetPersistentData(new Bitmap(10, 10));

            pManager.AddIntegerParameter("Mode", "M", "...", GH_ParamAccess.item, 2);

            Param_Integer param = (Param_Integer)Params.Input[1];

            param.AddNamedValue(modes[3], 3);
            param.AddNamedValue(modes[2], 2);
            param.AddNamedValue(modes[1], 1);
            param.AddNamedValue(modes[0], 0);
            param.AddNamedValue(modes[5], 5);
            param.AddNamedValue(modes[6], 6);
            param.AddNamedValue(modes[4], 4);
        }
예제 #16
0
        /// <summary>
        /// Registers all the input parameters for this component.
        /// </summary>
        protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
        {
            pManager.AddGenericParameter("Bitmap", "B", "---", GH_ParamAccess.item);
            pManager[0].Optional = true;

            Param_GenericObject paramGen = (Param_GenericObject)Params.Input[0];

            paramGen.SetPersistentData(new Bitmap(10, 10));

            pManager.AddIntegerParameter("Mode", "M", "...", GH_ParamAccess.item, 0);
            pManager[1].Optional = true;
            pManager.AddIntegerParameter("Angle", "A", "...", GH_ParamAccess.item, 90);
            pManager[2].Optional = true;
            pManager.AddBooleanParameter("Fit", "F", "...", GH_ParamAccess.item, true);
            pManager[3].Optional = true;
            pManager.AddColourParameter("Color", "C", "...", GH_ParamAccess.item, System.Drawing.Color.Black);
            pManager[4].Optional = true;

            Param_Integer param = (Param_Integer)Params.Input[1];

            param.AddNamedValue("Bicubic", 0);
            param.AddNamedValue("Bilinear", 1);
            param.AddNamedValue("Neighbor", 2);
        }