예제 #1
0
        protected ParamDefinition[] GetAssetDataAsInputs(bool skipUnchangable = false)
        {
            List <ParamDefinition> inputs = new List <ParamDefinition>();

            foreach (var assetPropInfo in _assetData.GetAssetProperties())
            {
                var paramInfo = _assetData.GetGHParameterInfo(assetPropInfo);
                if (paramInfo is null)
                {
                    continue;
                }

                if (skipUnchangable && !paramInfo.Modifiable)
                {
                    continue;
                }

                var param = (IGH_Param)Activator.CreateInstance(paramInfo.ParamType);
                param.Name        = paramInfo.Name;
                param.NickName    = paramInfo.NickName;
                param.Description = paramInfo.Description;
                param.Access      = paramInfo.ParamAccess;
                param.Optional    = paramInfo.Optional;

                inputs.Add(ParamDefinition.FromParam(param));
            }

            return(inputs.ToArray());
        }
        private ParamDefinition[] GetFieldsAsInputs()
        {
            List <ParamDefinition> inputs = new List <ParamDefinition>();

            var param = new Parameters.AppearanceAsset();

            param.Name        = ComponentInfo.Name;
            param.NickName    = ComponentInfo.NickName;
            param.Description = ComponentInfo.Description;
            param.Access      = GH_ParamAccess.item;

            inputs.Add(ParamDefinition.FromParam(param));
            inputs.AddRange(GetAssetDataAsInputs(skipUnchangable: true));
            return(inputs.ToArray());
        }
예제 #3
0
        protected ParamDefinition[] GetAssetDataAsOutputs()
        {
            List <ParamDefinition> outputs = new List <ParamDefinition>();

            foreach (var assetPropInfo in _assetData.GetAssetProperties())
            {
                var paramInfo = _assetData.GetGHParameterInfo(assetPropInfo);
                if (paramInfo is null)
                {
                    continue;
                }

                var param = (IGH_Param)Activator.CreateInstance(paramInfo.ParamType);
                param.Name        = paramInfo.Name;
                param.NickName    = paramInfo.NickName;
                param.Description = paramInfo.Description;
                param.Access      = paramInfo.ParamAccess;

                outputs.Add(ParamDefinition.FromParam(param));
            }

            return(outputs.ToArray());
        }