AddParameter (CustomProperty)

Description

Adds a new custom parameter to the custom property.

Note: For a JScript-compliant version, see CustomProperty.AddParameter2, and for a simplified version see CustomProperty.AddParameter3.

Scripting Syntax

    CustomProperty.AddParameter( ScriptName, ValueType, [Classification], [Capabilities], [Name], [Description], [ObsoleteArg], [DefaultValue], [Min], [Max], [SuggestedMin], [SuggestedMax] )

C# Syntax

    Parameter CustomProperty.AddParameter( String in_ScriptName, siVariantType in_ValueType, siParamClassification in_Classif, Int32 in_Caps, String in_name, String in_LongName, String in_Guid, Object in_DefaultValue, Object in_Min, Object in_Max, Object in_SuggestedMin, Object in_SuggestedMax );

Parameters

Parameter | Type | Description
ScriptName | String | Name of the custom parameter. This argument specifies the ScriptName of a parameter and should not contain any spaces. (See Parameter.ScriptName) If the short name or long name parameters are not specified then this name is also used as the short name and description.
ValueType | siVariantType | Type of the custom parameter. The recommended types are: siString, siBool, siInt4, siUByte, and siDouble. The supported types are: siString, siBool, siDouble, siFloat, siInt4, siInt2, siUInt4, siUInt2, siByte, siUByte (See Parameter.ValueType).
Classification | siParamClassification | Classification of the custom parameter. Default Value: siClassifUnknown
Capabilities | (see Integer) bitfield based on siCapabilities | Capabilities of the custom parameter. If you create a custom property parameter that is not inspectable, it will not appear in the interface, but is still available from scripting. If the parameter is read-only, it is greyed out in the interface, but is also available from scripting. The siPersistable flag optional and assumed to be enabled for all custom parameters. This establishes a the default capability flags for all instances of the parameter, but these flags can be overridden on a per-instance basis via Parameter.Capabilities. Default Value: siPersistable
Name | String | User friendly version of the custom parameter's name. This is the parameter name that appears in in the Scene Explorer (unless Show Script Names is enabled). If this argument is not specified then the ScriptName argument will be visible to users as the parameter's name. (See SIObject.Name and Parameter.ScriptName). This string will appear as the parameter label when the custom property is inspected, unless a specific label is specified in the PPGLayout, see PPGItem.Label. Default Value: ScriptName is used
Description | String | A longer description of the custom parameter. Currently this string is not displayed in the user interface. Default Value: ScriptName is used
ObsoleteArg | String | It is not necessary to specify this argument, it is ignored. Default Value: ""
DefaultValue | Variant | Default value of the custom parameter. A default value for a numerical values including boolean is 0, the string default is "". (See Parameter.Default)
Min | Variant | Minimum value of the custom parameter. siString and siBool types do not require a Min value. For all other numerical type the default will be minimum value possible for the type for example all unsigned values will have a min=0. (See Parameter.Min)
Max | Variant | Maximum value of the custom parameter. siString and siBool types do not require a Max value. For all other numerical type the default will be minimum value possible for the type for example the maximum value for siUByte is 255. (See Parameter.Max)
SuggestedMin | Variant | Suggested minimum value of the custom parameter. siString and siBool types do not require a SuggestedMin value. The default suggested minimum value for numerical values will be 0. The suggested minimum should be equal or larger than the minimum. This value is used to configure the range of UI controls. (See Parameter.SuggestedMin)
SuggestedMax | Variant | Suggested maximum value of the custom parameter. siString and siBool types do not require a SuggestedMax value. The default suggested maximum value for numerical values will be 100. The suggested maximum should be equal or smaller than the Maximum. This value is used to configure the range of UI controls. (See Parameter.SuggestedMax)

Return Value

The newly created Parameter object.

Examples

VBScript Example

    'VBScript example : add custom parameters to a custom property
    MAIN()

    sub main()
       On Error Resume Next

       set oRoot = Application.ActiveProject.ActiveScene.Root
       set oSphere = oRoot.AddGeometry("Sphere","NurbsSurface")
       set oProp = oSphere.AddProperty("Custom_parameter_list",,"FirstCustomProperty")

       AddCustomParams(oProp)
       InspectObj oProp

    end sub

    sub AddCustomParams (in_customprop)

       On Error Resume Next

       ' String custom parameter
       set oParam1 = in_customprop.AddParameter ("StrCustomParam", siString, , , , , , _
                                "the string")
       write_customprop oParam1

       ' Boolean custom parameter
       set oParam2 = in_customprop.AddParameter ("BoolCustomParam", siBool, , , _
                                "ShortName", "LongName", , _
                                true)
       write_customprop oParam2

       ' Integer custom parameter
       set oParam3 = in_customprop.AddParameter ("Int2CustomParam", siInt2, siClassifVisualization , siAnimatable, _
                                "ShortName", "LongName", , _
                                -1, -5, 5)
       write_customprop oParam3

       ' Double custom parameter
       set oParam4 = in_customprop.AddParameter ("DoubleCustomParam", siDouble, , siReadOnly, _
                                "ShortName", "LongName", , _
                                0.695, 0.0123, 10.456)
       write_customprop oParam4

    end sub

    sub write_customprop(in_param)
       LogMessage "Name: " & in_param.Name
       LogMessage "Class: " & typename(in_param)
       LogMessage "Type: " & in_param.Type
       LogMessage "Fullname: " & in_param.FullName
       LogMessage "Parent: " & in_param.Parent.Name
       LogMessage "ScriptName : " & in_param.ScriptName
       LogMessage "Description: " & in_param.Description
       LogMessage "Capabilities : " & in_param.Capabilities
       LogMessage "Value : " & in_param.Value
       LogMessage "ValueType: " & in_param.ValueType
       LogMessage "Default: " & in_param.Default

       if ( in_param.ValueType <> siString ) then
           LogMessage "Min: " & in_param.Min
           LogMessage "Max: " & in_param.Max
           LogMessage "SuggestedMin: " & in_param.SuggestedMin
           LogMessage "SuggestedMax: " & in_param.SuggestedMax
       end if
    end sub

See Also

CustomProperty | CustomProperty.AddParameter2 | CustomProperty.AddParameter3 | Parameter

Autodesk Softimage v7.5