LoadPreset

導入

v1.0

カテゴリ

ファイル プロパティ プリセット

詳細

指定したオブジェクトにプリセット ファイルをロードします。

このコマンドは、右上角の[Load]ボタンをクリックすることにより、すべてのプロパティ ページで使用できます。

スクリプト構文

LoadPreset( [PresetObj], [InputObj] );

パラメータ

パラメータ タイプ 詳細
PresetObj 文字列 ロードするプリセットの名前。 完全パスを指定しないと、Softimageはプリセットの標準の場所(「siPresetLocation」を参照)でファイルを検索します。

デフォルト値:指定されていない場合、または指定のファイルが見つからない場合は、ファイルを選択するようユーザに要求します。

InputObj 文字列 プリセットをロードするオブジェクトまたはプロパティ セットのリスト

デフォルト値: 現在選択されている値

VBScript の例

'---------------------------------------------------------
' 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"
'---------------------------------------------------------

関連項目

SavePreset SILoadPreset CustomProperty.BinaryData