SIAddCustomParameter

Description

Adds a custom parameter to a custom parameter set.

Scripting Syntax

SIAddCustomParameter( [InputObj], [ScriptName], [VarType], DefaultValue, [MinValue], [MaxValue], [Classification], [Capabilities], [SuggMin], [SuggMax], [ParamName], [Description] )

Parameters

Parameter

Type

Description

InputObj

String

List of custom parameter sets

Default Value: Current selection

ScriptName [in/out]

String

Script name of the custom parameter to be added. This is normally a short name, like "rotx". A script name cannot have spaces in it.

Default Value: "ParamName"

VarType [in/out]

siVariantType

Type of the parameter

Default Value: siDouble

DefaultValue [in/out]

Variant

Default parameter value

MinValue [in/out]

Double

minimum value of the parameter

Default Value: 0.0

MaxValue [in/out]

Double

maximum value of the parameter

Default Value: 1.0

Classification

siParamClassification

Determines the classification of the parameter (gives XSI some hint about the purpose of the Parameter--see the siParamClassification enum for more details)

Default Value: siClassifUnknown

Capabilities [in/out]

siCapabilities

Determines the capabilities of the parameter (see the siCapabilities enum for more details)

Default Value: 5 (siAnimatable + siPersistable)

SuggMin [in/out]

Double

Suggested minimum value of the parameter (for UI controls)

Default Value: MinValue

SuggMax [in/out]

Double

Suggested maximum value of the parameter (for UI controls)

Default Value: MaxValue

ParamName

String

A name for the parameter that can be more descriptive than the script name. For example "Rotation X" instead of "rotx".

Description

String

Description of the parameter

Examples

1. VBScript Example

'Example showing you a custom pset can be used, in conjunction with the
'InspectObj command to collect information from a user

dim oCustomProperty
dim nbJoints, useCns

'Create a temporary custom property (it is not part of the scene)
Set oPreset = CreatePreset( "CustomProperty", "Properties" )
Set oCustomProperty = CreateObjectFromPreset(oPreset, "Chain_From_Curve" )

'Add parameters to the custom property
SIAddCustomParameter oCustomProperty , _
   "nbJoints", siInt2, 10, 1, 1000, 8, 16, 1, 100, "Bones", "Number of Bones"

SIAddCustomParameter oCustomProperty , _
   "useCns", siBool, FALSE, , , 8, 16, , , "Constrain", "Constrain Chain to Curve"

' Launch the ppg in modal mode, wait for Ok or Cancel to be pressed
On Error Resume Next
InspectObj  oCustomProperty ,,,4

' If the user Clicked Ok, get the values entered in the ppg
if Err.Number = 0 then
   'Get the dialog values
   nbJoints = GetValue( oCustomProperty & ".nbJoints" )
   useCns = GetValue( oCustomProperty & ".useCns" )

   'At this point you could launch a custom command
   'using nbJoints and useCns as 
else
   ' Put your cancel code here
end if

2. VBScript Example

'Example demonstrating how the arguments to SIAddCustomParameter
'are exposed in the Object Model

dim oCustomProperties, oCustomProperty, oParam
SIAddProp "Custom_parameter_list", ActiveSceneRoot , , "DemoProp", oCustomProperties

'We only created a single custom property because we only 
'passed a single object (ActiveSceneRoot) to SIAddProp
set oCustomProperty = oCustomProperties.Item(0)

SIAddCustomParameter oCustomProperty , _
   "nbJoints", siInt4, 10, 1, 1000, 8, 16, 1, 100, "Bones"

set oParam = oCustomProperty.Parameters( "nbJoints" )
logmessage "Parameter Name: " & oParam.Name
logmessage "Parameter Script Name: " & oParam.ScriptName
logmessage "Parameter ValueType: " & oParam.ValueType
logmessage "Parameter Default: " & oParam.Default
logmessage "Parameter Min/Max: " & oParam.Min & "/" & oParam.Max
logmessage "Parameter UI Min/Max: " & oParam.SuggestedMin & "/" & oParam.SuggestedMax


'Output of running this script:
'INFO : "Parameter Name: Bones"
'INFO : "Parameter Script Name: nbJoints"
'INFO : "Parameter ValueType: 3"
'INFO : "Parameter Default: 10"
'INFO : "Parameter Min/Max: 1/1000"
'INFO : "Parameter UI Min/Max: 1/100"

See Also

SIAddCustomParam

CustomProperty.AddParameter

Parameter



SOFTIMAGE|XSI v6.01     

Return to Softimage XSI Index