Object Hierarchy | 関連する C++クラス:PluginRegistrar
PluginRegistrar
v4.0
 PluginRegistrar オブジェクトは、プラグイン項目をその他の詳細情報とともに softimage に登録するためにプラグインモジュールによって使用されます。オブジェクトは Softimage によって作成され、プラグインをロード/アンロードするディレクトリの場所や、プラグインのファイル名などの情報が含まれています。
Softimage が起動されると、ロードする各プラグインの PluginRegistrar オブジェクトが作成され、プラグインによって公開されている XSILoadPlugin 関数のエントリポイントに渡されます。Softimage によって収集された情報は、ユーザが必要としたときにプラグイン項目の作成に使用されます。
プラグインがアンロードされると、この特定のプラグインについて PluginRegistrar オブジェクトが作成され、プラグインによって公開されているXSIUnloadPlugin関数のエントリポイントに渡されます(「Callbacks for Self-Installing Plug-ins」を参照)。プラグインによって登録された情報には、Plugin オブジェクトからアクセスします。
| IsClassOf   | IsEqualTo   | RegisterCommand | RegisterConverterEvent | 
| RegisterEvent | RegisterFilter | RegisterMenu | RegisterOperator | 
| RegisterProperty | RegisterShader   | RegisterShaderLanguageParser   | RegisterTimerEvent | 
| Application | Author | Categories | |
| Filename | FullName   | Help | Language | 
| Major | Minor | Name   | NestedObjects | 
| Origin | OriginPath | Parent | Type   | 
| URL | UserData | ||
| /*--------------------------------------------------------------------------
	This example demonstrates the how to the use PluginRegistrar object
	README: Copy and paste the example into the script editor and run (F5).
	The filter will now be listed in the Scene Explorer filter list when 
	the "Source/Clips" view context is selected.
--------------------------------------------------------------------------*/
// This function is required to register a plug-in in Softimage
function  XSILoadPlugin( in_reg )
{
	Application.LogMessage( "PluginRegistrar XSILoadPlugin called" );
	// register plug-in information with the PluginRegistrar object
	in_reg.Author = "Softimage Co." ;
	in_reg.Name = "PluginRegistrar Example";
	in_reg.Help = MakeHTMLPage();
	in_reg.URL = "www.softimage.com";
	in_reg.Email = "webmaster@softimage.com";
	//  the version number of this plug-in
	in_reg.Major = 1;
	in_reg.Minor = 0 ;
	Application.LogMessage( "This plug-in language: " + in_reg.Language );
	// register the cone filter plug-in item 
	in_reg.RegisterFilter( "ConePrimitive", siFilterObject );
	return true;
}
// This non-mandatory function is called when the plug-in is unloaded 
function  XSIUnloadPlugin( in_reg )
{
	Application.LogMessage( "PluginRegistrar XSIUnloadPlugin called" );
	Application.LogMessage( "Name: " + in_reg.Name );
	Application.LogMessage( "Author: " + in_reg.Author);
	Application.LogMessage( "Major: " + in_reg.Major);
	Application.LogMessage( "Minor: " + in_reg.Minor);
	Application.LogMessage( "Language: " + in_reg.Language);
	Application.LogMessage( "URL: " + in_reg.URL);
	Application.LogMessage( "Email: " + in_reg.Email);
	Application.LogMessage( "Help: " + in_reg.Help);
	return(true);
}
function  ConePrimitive_Match( in_context )
{
	var obj = in_context.GetAttribute("Input");
	return obj.IsKindOf( siConePrimType );
}
function  MakeHTMLPage()
{
	// Build the filename + path
	var sHelpFileName = XSIUtils.BuildPath( InstallationPath( siUserPath ), "Data", "HelpMe.html" );
	// Create a standard hello world script file
	fso = XSIFactory.CreateActiveXObject( "Scripting.FileSystemObject" );
	var fHWFile = fso.CreateTextFile( sHelpFileName );
	fHWFile.WriteLine( "<html>" );
	fHWFile.WriteLine( "<head>" );
	fHWFile.WriteLine( "\t" + "<title>Help Page for Testing PluginRegistrar</title>" );
	fHWFile.WriteLine( "</head>");
	fHWFile.WriteLine( "<body>");
	fHWFile.WriteLine( "\t" + "<p>Help! I//m trapped inside this HTML code!</p>" );
	fHWFile.WriteLine( "</body>" );
	fHWFile.WriteLine( "</html>" );
	fHWFile.Close();
	// Return the name of the new command
	return sHelpFileName;
}
//--------------------------------------------------------------------
// Code to bootstrap example into system
//--------------------------------------------------------------------
function ExampleSourceCode()
{
	return "//XSISDK Doc Example\n" +
		ConePrimitive_Match.toString() + "\n" + 
		MakeHTMLPage.toString() + "\n" + 
		XSIUnloadPlugin.toString() + "\n" + 
		XSILoadPlugin.toString();
}
// if we are running from script editor save code to 
// examples addon folder in the user's directory.
if (GetUserPref("ScriptingSessionActive"))
{
	var ex_name 		= "ExPluginRegistrar";
	var ex_subfolder 	= "Plugins";
	var ex_folder 		= "XSISDKDocExamples";
	var ex_langsuffix	= ".js";
	CreateAddonDirectories( InstallationPath(siUserPath), ex_folder );
	var fso = XSIFactory.CreateActiveXObject("Scripting.FileSystemObject");
	var filename = XSIUtils.BuildPath( 
		InstallationPath(siUserAddonPath), 
		ex_folder,
		"Application",
		ex_subfolder,
		ex_name+ex_langsuffix );
	if (!fso.FileExists(filename))
	{
		var f = fso.CreateTextFile ( filename );
		f.write( ExampleSourceCode() );
		f.close();
		Application.LoadPlugin(filename);	
	}
} |