예제 #1
0
        /// <summary>
        /// Registers all the input parameters for this component.
        /// </summary>
        protected override void RegisterInputParams(GH_InputParamManager pManager)
        {
            pManager.AddParameter(new Param_VoxelGrid());
            var param = new Param_Integer();

            DataAccessHelper.AddEnumOptionsToParam <SelectionType>(param);
            param.PersistentData.Append(new GH_Integer(1));
            pManager.AddParameter(new Param_Integer(), "Selection", "S", "0 = all false voxels, 1 = all true voxels (default), -1 = all voxels", GH_ParamAccess.item);
        }
예제 #2
0
        /// <summary>
        /// Upgrade an existing object.
        /// </summary>
        /// <param name="target">Object to upgrade.</param>
        /// <param name="document">Document that contains the object.</param>
        /// <see>https://discourse.mcneel.com/t/how-to-handle-input-output-definition-changes-when-a-component-gets-updated-in-a-new-version/64635/5</see>
        /// <returns>
        /// The newly created object on success, null on failure.
        /// </returns>
        public IGH_DocumentObject Upgrade(IGH_DocumentObject target, GH_Document document)
        {
            // ReSharper disable once UseNegatedPatternMatching
            var component = target as IGH_Component;
            var comp      = GH_UpgradeUtil.SwapComponents(component, UpgradeTo, true);

            if (comp == null)
            {
                return(null);
            }
            var param = new Param_Integer();

            DataAccessHelper.AddEnumOptionsToParam <VoxelGridBoxes.SelectionType>(param);
            param.PersistentData.Append(new GH_Integer(1));
            param.Name        = "Selection";
            param.NickName    = "S";
            param.Description = "0 = all false voxels, 1 = all true voxels(default), -1 = all voxels";
            param.Access      = GH_ParamAccess.item;
            comp.Params.Input.Add(param);
            return(comp);
        }