v1.0
Loads a preset file on the specified objects.
This command is available from every property page, by clicking the "Load" button in the top
right-hand corner.
LoadPreset( [PresetObj], [InputObj] ); |
Parameter | Type | Description |
---|---|---|
PresetObj | String |
Name of the preset to load. If the complete path is not specified then Softimage
searches standard preset locations for the file (see siPresetLocation).
Default Value: If not specified, or the specified file could not be found, then a file browser prompts the user to pick the file. |
InputObj | String |
List of objects or property sets that load the preset. Default Value: Current selection. |
'--------------------------------------------------------- ' Example: Saving an loading a preset file. This example ' demonstrates creating a custom p-set, saving it to a ' preset file, and then re-loading that file. '--------------------------------------------------------- ' Add a custom PSet to the scene root, with a parameter, and set its value to 8. SelectObj ActiveProject.ActiveScene.Root AddProp "Custom_parameter_list", , , "MyPSet" SIAddCustomParameter "MyPSet", "MyParam", siDouble, 5, 0, 10, null, 4, 0, 10, null, null SetValue "MyPSet.MyParam", 8, null ' Now save the 'MyPSet' as a preset file named 'Example'. SavePreset "MyPSet", "Example", null, siUser, null, false, null ' Change the value of the parameter to 6, and then load the example just saved. SetValue "MyPSet.MyParam", 6, null ParamVal = GetValue( "MyPSet.MyParam", null ) LogMessage "Value of MyPSet.MyParam = " & ParamVal PresetFile = Application.InstallationPath( siUserPath ) & "\Data\DSPresets\Properties\Example.Preset" LoadPreset PresetFile, "MyPSet" ' Notice how custom property set has been renamed to the Preset name ParamVal = GetValue( "Example.MyParam", null ) LogMessage "Value of Example.MyParam = " & ParamVal '--------------------------------------------------------- ' Output from this script: 'INFO : "Value of MyPSet.MyParam = 6" 'INFO : "Value of Example.MyParam = 8" ' Object : "Example.MyParam" '--------------------------------------------------------- |