Parameter.Default operator

Introduced

v3.0

Description

Returns the default value (Variant) of the parameter. Some parameters have a default value, which defines what the initial value of the parameter is.

Examples

VBScript Example

'
'       This example demonstrates how to use defaults to reset a parameter
'
NewScene , false
dim oRoot, oPropSet, oProp, oProp2
set oRoot = Application.ActiveProject.ActiveScene.Root
set oPropSet = oRoot.AddProperty( "Custom_parameter_list", , "DemoOfDefault" )                          
set oProp = oPropSet.AddParameter( "Var1", siDouble,,siPersistable, , , , _     
                                        1000.0, 0.0, 2000.0 )
' Change the default value 
oProp.Value = 99.0
set oProp2 = oPropSet.AddParameter( "Var2", siBool, , siPersistable, , , , true )
oProp2.Value = false
' Show the values before we reset them
Application.LogMessage oProp.Value & " " & oProp2.Value
' Reset all properties in the pset
ResetPropertySet oPropSet
' Show that the values have been reset
Application.LogMessage oProp.Value & " " & oProp2.Value
' This function will return all numeric parameters in
' a property set back to their default values.
sub ResetPropertySet( in_PSet )
        dim oP
        for each oP in oPropSet.Parameters
                if ( oP.ValueType = siInt4 OR _
                oP.ValueType = siDouble OR _
                oP.ValueType = siUByte OR _
                oP.ValueType = siFloat OR _
                oP.ValueType = siBool ) then
                        ' Assign the default value back
                        oP.Value = oP.Default
                end if
        next
end sub
'Expected results:
'INFO : "99 False"
'INFO : "1000 True"

See Also

CustomProperty.AddParameter