.xsaiaddon ファイルを Softimage にインストールします。アドオンファイルは一連のカスタマイズされたアイテム(レイアウト、ツールバー、プリセットなど)であり、1 つのファイルにパッケージ化されています。アドオンのパッケージング、インストール、アンインストールは Softimage オブジェクトモデルを使用して実行できます。
XSIApplication.InstallAddon( String in_bszFileName, siInstallationPath in_eInstallDir, Boolean in_bBatch ); |
XSIApplication.InstallAddon( FileName, [InstallDir], [NoUI] ); |
| パラメータ | タイプ | 説明 |
|---|---|---|
| FileName | String | インストールするアドオンファイルのファイルパス |
| InstallDir | siInstallationPath |
アドオンがインストールされる先のディレクトリ 推奨値は siUserAddonPath および siWorkgroupAddonPath です。siUnknownPath を指定すると、アドオンファイルに指定されているデフォルトの場所にアドオンがインストールされます。 注:複数のワークグループがある場合、このメソッドはリストの最初のワークグループをインストールします。 デフォルト値:siUnknownPath |
| NoUI | Boolean |
このオプションパラメータを使用すると、アドオンのインストール時に警告メッセージボックスが表示されないようにできます。このパラメータは、Softimage をバッチモードで実行する場合は自動的に設定されます。
デフォルト値: false |
//
// This example demonstrates how to install an add-on package.
//
// Get the first available workgroup as the add-on destination
var sPath = Application.InstallationPath( siWorkgroupPath );
if ( !sPath ) {
// If the workgroup doesn't already exist, then add it
var tmppath = XSIUtils.BuildPath( Application.InstallationPath(siUserPath), "TempWorkgrp" );
var fso = new ActiveXObject( "Scripting.FileSystemObject" );
if ( !fso.FolderExists(tmppath) ) { fso.CreateFolder(tmppath); }
Application.AddWorkgroup( tmppath );
sPath = Application.InstallationPath( siWorkgroupPath );
}
var sHTMLName = makeHTMLPage();
// Create the add-on package object
var oAddOn = Application.CreateAddon();
// Add the HTML page to the add-on package
oAddOn.AddOtherItem( sHTMLName );
// Save the package in the Addons directory
sPath = XSIUtils.BuildPath( sPath, "Addons" );
XSIUtils.EnsureFolderExists( sPath );
var sAddOnFileName = XSIUtils.BuildPath( sPath, "myHelpPkg.xsiaddon" );
oAddOn.Save( sAddOnFileName );
Application.LogMessage( "Created add-on file: " + sAddOnFileName );
// Install the add-on package containing the HTML page
Application.InstallAddOn( sAddOnFileName, siWorkgroupAddonPath );
// Comment out the following line if you want to see the add-on file
// (you will have to uninstall the add-on manually):
Application.UnInstallAddon( sAddOnFileName );
// **********************************
// This function just provide the means to remove the details of
// creating the HTML page.
function makeHTMLPage()
{
// Build the filename & path
var sUserPath = Application.InstallationPath( siUserPath );
var sHelpFileName = XSIUtils.BuildPath( sUserPath, "Data", "HelpMe.html" );
// Create a standard hello world script file
var fso = new ActiveXObject( "Scripting.FileSystemObject" );
var fHWFile = fso.CreateTextFile( sHelpFileName );
fHWFile.WriteLine( "<html>" );
fHWFile.WriteLine( "<head>" );
fHWFile.WriteLine( "\t<title>Help Page for Testing Add-ons</title>" );
fHWFile.WriteLine( "</head>" );
fHWFile.WriteLine( "<body>" );
fHWFile.WriteLine( "\n<p>Help! I'm trapped inside this HTML code!</p>" );
fHWFile.WriteLine( "</body>" );
fHWFile.WriteLine( "</html>" );
fHWFile.Close();
// Return the name of the new html page
return sHelpFileName;
} |