Softimage SDK Programmer's Guide > Customizing with the SDK > Building and Deploying Customizations > Add-on Packages >

# Working with Add-ons through the Object Model

You can use the Autodesk Softimage SDK object model to package, install and uninstall Softimage add-ons. These features are available either through a simple script or through a compiled library file:

- To package an add-on through scripting

- To install an add-on package through scripting

- To uninstall an add-on package through the object model

In addition there are several scripting commands which can help you debug v1.0 plug-ins. These simulate some of the tasks you can perform in the Plug-in Manager:

- Update a plug-in

- Unload a plug-in

- Remove a plug-in from the cache

To package an add-on through scripting

The easiest way to package an add-on is to use the PackageAddon command, which packages an entire add-on directory (for example, \myserver\myworkgroup\Addons\MyParticleTool).

You can also create an Addon object and add items one at a time. The basic workflow of using packaging an add-on this way through scripting is very similar to packaging the add-on through the Package Add-on dialog:

1. Get a pointer to the object using XSIApplication.CreateAddon:

       set oAddOn = Application.CreateAddon

2. Add the components of your customization as required. You can add the same types of items as you can through the UI by using the Addon.AddItem:

       oAddOn.AddItem siToolbarAddonItemType, "MyToolbar"
       		oAddOn.AddItem siScriptCmdAddonItemType, "myCmd"

   Tip

   To make your add-on creation script more portable, use the system information to get the user path:

       sPath = InstallationPath( siUserPath )
       		oAddOn.AddItem siOtherAddonItemType, sPath & "\Data\MyHelpPage.html"

   Note

   You can use either the Addon.AddItem method with siOtherAddonItemType or just use the Addon.AddOtherItem method. The difference is that AddOtherItem allows you to specify a destination directory, whereas AddItem does not. The equivalent to the last line above is:

       oAddOn.AddOtherItem sPath & _
       		"\Data\MyHelpPage.html", "Help"

3. If you want to specify a default installation path for your add-on, use the Addon.DefaultInstallationPath property:

       oAddOn.DefaultInstallationPath = siFactoryPath
       		oAddOn.SubDirectory = "ToxicTools"

4. When you are finished adding items, use the Addon.Save method to save the new .xsiaddon file:

       oAddOn.Save sPath & "\addons\myAddOn.xsiaddon"

To install an add-on package through scripting

- You can use the XSIApplication.InstallAddon method which takes the full path of the .xsiaddon file and where you want the add-on to be installed (the Addons\InstalledAddons path—see siInstallationPath):

  Tip

  The target location can be either of these values:

  - 4 or siAddonPath (the Add-on directory path)

  - 5 or siUserAddonPath (the User Add-on directory path)

  - 6 or siWorkgroupAddonPath (the Workgroup Add-on directory path)

      ' Install myAddon.xsiaddon in the workgroup
      		sPath = InstallationPath( siUserPath )
      		InstallAddon "\myAddon.xsiaddon", siWorkgroupAddonPath

  Note

  Since the XSIApplication object is an intrinsic object that represents the running instance of Softimage, you do not need to specify the Application object explicitly inside Softimage.

To uninstall an add-on package through the object model

- You can use the UnInstallAddon (XSIApplication) method which takes the full installation path (the Addons\InstalledAddons path) of the .xsiaddon file:

      ' Uninstall the add-on by name
      		sPath = InstallationPath( siWorkgroupAddonPath )
      		UninstallAddon sPath & "\myAddon.xsiaddon"

To load and unload a single add-on library

- You can use the UnloadAddonLib command to unload a single specified v1.0 plug-in library from memory. This allows you to easily fix and recompile your libraries in your development environment and then load them in again with the ReloadAddonLib command.

These commands both take the full path of the library file as the only argument but return no value.

To load and unload all add-on libraries at once

- You can use the UnloadAllAddonLibs command to unload all currently loaded v1.0 plug-in libraries from memory. This allows you to easily fix and recompile your libraries in your development environment and then load them in again with the ReloadAllAddonLibs command.

  These commands take no arguments and return no values.

To flush COM (ActiveX) DLLs from memory

- You can use the UnloadAllCOMLibs command to explicitly free unused ActiveX libraries.

  This command takes no arguments and does not return a value.