Softimage のユーザ設定はプロパティ セットに格納されるので、他のオブジェクトと同じようにアクセスすることができますが、簡単なアクセスと追加機能を実行できる特殊なクラスも用意されています。
"Interaction.autoinspect"設定は、スクリプトによって恒久的に変更することはできません。 詳細については、「プロパティ エディタの自動検証」を参照してください。
オブジェクトを使用すると、プロパティからオブジェクトに直接アクセスできます。 ここから、によってブラウズしたり、特定の値(および)をターゲットに設定することができます。 以下の例を参照してください。
オブジェクトでは、およびメソッドを使用して、バックアップとしての使用やアドオンパッケージの一部としての配布が可能な外部ファイルに、設定(ネイティブおよびカスタム)を配布できます。 これらのメソッドでは、1 つまたは複数のカテゴリを指定したり、何も指定しないでおくことができます(この場合はすべての設定がインポート/エクスポートされます)。 以下の例を参照してください。
from win32com.client import constants app = Application # Export the current scripting preferences app.Preferences.Export( app.InstallationPath(constants.siFactoryPath) + "/myprefs.xsipref", "scripting" ) # Restore the default values app.Preferences.RestoreDefault( "scripting" ) # Now import back the scripting preferences app.Preferences.Import( app.InstallationPath(constants.siFactoryPath) + "/myprefs.xsipref" )
using namespace XSI; Application app; Preferences prefs = app.GetPreferences(); CString lang; prefs.GetPreferenceValue( L"scripting.language", lang ); app.LogMessage( lang );
/*
This example show how to navigate in preferences object
All categories and all preferences in each category will be printed.
*/
var oPrefs = Application.Preferences;
var oCategories = oPrefs.Categories;
for (var i=0; i<oCategories.Count; i++) {
var oCategory = oCategories.Item(i);
Application.LogMessage( "The preferences for category " + oCategory + " are....." );
var oPrefs = oCategory.Parameters;
for (var j=0; j<oPrefs.Count; j++) {
var opref = oPrefs.Item(j);
Application.LogMessage( "\t-" + opref + " = " + opref.Value );
}
}
// Expected output:
// INFO : The preferences for category preferences.animation_editor are.....
// INFO : -preferences.animation_editor.track_sel = false
// INFO : -preferences.animation_editor.parameter_sort = 1
// INFO : -preferences.animation_editor.max_nb_curves = 0
// INFO : -preferences.animation_editor.auto_select_marked = false
// INFO : -preferences.animation_editor.auto_select_keyed = false
// INFO : -preferences.animation_editor.always_show_root_objects = true
// INFO : -preferences.animation_editor.simplified_mode = true
// INFO : -preferences.animation_editor.prevent_movement_on_lmb = false
// INFO : -preferences.animation_editor.translate_on_mmb = true
// INFO : -preferences.animation_editor.fcurveeditor_multisel_expansion = 1
// INFO : -preferences.animation_editor.dopesheet_multisel_expansion = 0
// ...
//
// INFO : The preferences for category preferences.units are.....
// INFO : -preferences.units.colorspace = 1
// INFO : -preferences.units.length = 2
// INFO : -preferences.units.angle = 2
// INFO : -preferences.units.time = 2
// INFO : -preferences.units.mass = 2