Object Hierarchy | Related C++ Class: PluginRegistrar
PluginRegistrar
v4.0
The PluginRegistrar object is used by plug-in modules for registering plug-in items
in Softimage along with other general information. The object is created by Softimage
and contains information such as the directory where the plug-in is being loaded/unloaded
and the filename of the plug-in.
When Softimage starts up, a PluginRegistrar object is created for each plug-in to
load and passed to the XSILoadPlugin function entry point exposed by the
plug-in. The information gathered by Softimage is used for creating the plug-in
items when required by the user.
When a plug-in is unloaded, a PluginRegistrar object is created for this particular plug-in
and passed to the XSIUnloadPlugin function entry
point exposed by the plug-in (see
Callbacks for Self-Installing Plug-ins).
The information registered by the plug-in can be accessed through the Plugin object.
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); } } |