XPOP Menus are fully customizable popup menus that can be used with all scripting languages available in Softimage.
example for an xPOP menu
download links are at the bottom of the page.
New Features for XPOP V3.0
Greyed out menu items
Icon support (including Checkmark)
Icon collection included
Object oriented API (similar to Patrick Boucher's python extension for XPOP2)
Section headers for more linear grouping than submenus
Visual customization options: margins, spacing, font, fontsize, coloring
1. Installation
Start XSI then drag-and-drop the .xsiaddon file into the application in order to install it into the USER directory.
In case you want to use a different directory for the installation, go to the File menu and select Addon->Install to install the downloaded .xsiaddon file into a directory of your choice.
2. Usage
The addon creates the custom command XPOP(). This command returns an empty menu object that you can populate, one-by-one, with your own menu items, and eventually invoke using the Track() function. Here is an example code snippet for that:
//This is Javascript code. To execute, set your script editor language to JScript and hit the run button.
popup = XPOP();
// create the initial empty menu object
popup.font = "Comic Sans MS";
popup.fontsize = 16;
popup.AddHeader( "Example Popup", 0xBB2222 );
// adds a red header to the popup
popup.AddItem( "Create a Box", "CreatePrim('Cube', 'MeshSurface');" );
// adds a menu item with some callback code
mysubmenu = popup.AddSubmenu( "More items .." );
// adds a Submenu
mysubmenu.SetIcon( "Flag" );
// sets a "flag" icon for the submenu - for icon names see picture below
item1 = mysubmenu.AddItem( "Create a Sphere", "CreatePrim('Sphere', 'MeshSurface');" );
// assign new item to a variable
item1.color = 0x0000FF;
// sets item1's text color to blue
item2 = mysubmenu.AddItem( "Selection", "XYZ();" );
item2.SetIcon( "Checkmark" );
// adds a checkmark to item2
item2.SetIcon( "" );
// clears the checkmark again, for demonstrative purposes xD
item2.EnableItem(0);
// disables and greys out item2
header = popup.AddHeader( "Sub section", 0xAAAAAA );
// adds a grey header to the popup menu
header.spacing_top = 12;
// add 12 pixels of empty space above header
item3 = popup.AddItem("New Scene", "NewScene();");
item3.SetIcon( "Star" );
// adds a star to item3
eval( popup.Track() );
// Track() returns callback string, eval executes it
resulting xPOP menu
Copy/paste this into a script editor and press "run" for an easy way to test the menu and the handlers. As you see, the Track() command only returns the hander string associated with the picked item. This string is executed as code using the JScript "eval" method. (Note that the VBScript equivalent of eval is "ExecuteGlobal", Python equivalent is "exec".)
Such a snippet of code would usually be wrapped inside a custom command, which would then be mapped to a hotkey using the keyboard mapping manager (preferably ALT key combos, just as a suggestion). For an instruction on how to do this, see section 8.
Three example commands, one for each scripting language, are included with the plugin distribution. These examples also demonstrate how to grey out menu items, use toggle menu items, dynamic icons and checkboxes.
3. XPOP() command reference
This is the syntax for the custom command that is installed by the XPOP3 plugin:
myPopup =
XPOP () : Creates an empty Basemenu object
4. Basemenu object reference
The Basemenu object represents the main popup menu. It is created by the XPOP() custom command.
available methods:
myItem = myPopup.
AddItem (strTitle, strCallback) : Adds item and associated callback string to menu - this method returns an Item object (see reference below)
myHeader = myPopup.
AddHeader (strTitle, integerColor) : Adds section header with background color (0xRRGGBB) - this method returns an Item object
mySubmenu = myPopup.
AddSubmenu (strTitle) : Adds a Submenu - this method returns a Submenu object (see reference below)
myPopup.
AddSeparator () : Adds horizontal separator
strCallback = myPopup.
Track () : Main command. Invoke on the finished menu. Displays menu and returns picked item callback string ready to evaluate using eval (Jscript), ExecuteGlobal (VBScript) or exec (Python).
available attributes:
myPopup.
origin_x = integerValue : Offsets popup menu by integerValue pixels in X direction
myPopup.
origin_y = integerValue :Offsets in Y direction - can be used to place mouse pointer on a particular item initially
myPopup.
spacing_right = integerValue :Adjusts the space to the right of the longest menu entry (default=32)
myPopup.
font = integerValue :Set the font that is used by the popup menu
myPopup.
font_size = integerValue :Set the font size for the popup menu
myPopup.
bkrect_radius = integerValue :Pixel radius of section header and selection rectangle corner rounding
5. Item object reference
The Item object represents a menu item. An item object is created by the AddItem/AddHeader method.
available methods:
myItem.
SetIcon (strIconName) : Sets an icon by name for the item (for icon names see the picture below)
myItem.
LoadIcon (strPathToIcoFile) : Loads an icon from a .ico (16*16) file
myItem.
EnableItem (enable) : If enable is 1, enables this menu item; If it's 0 it will be disabled (greyed out)
available attributes:
myItem.
color = integerValue (0xRRGGBB) : Sets the text color for the item title (default = black)
myItem.
color_sel = integerValue (0xRRGGBB) : Sets the text color for the item title when selected (default = white)
myItem.
bkcolor = integerValue (0xRRGGBB) : Sets the background rect color for the item (default = light grey)
myItem.
bkcolor_sel = integerValue (0xRRGGBB) : Sets the background rect color when selected (default = blue)
myItem.
use_systembkcolor = integerValue (0 or 1) : If 1, uses the system background color as the bkcolor ("transparent" background, default=1)
myItem.
bold = integerValue (0 or 1) : If 1, displays the text for this item's title as bold text (default is 0)
myItem.
centered = integerValue (0 or 1) : If 1, displays the text for this item's title as centered text (default is 0)
myItem.
padding_bottom = integerValue: enlarges the bottom of the background rect
myItem.
padding_top = integerValue: enlarges the top of the background rect
myItem.
spacing_bottom = integerValue: adds space below the item and the background rect
myItem.
spacing_top = integerValue: adds space above the item and the background rect
6. Submenu object reference
The Submenu object represents a submenu. It is created by the AddMenu method.
available methods:
myItem = mySubmenu.
AddItem (strTitle, strCallback) : Adds item and associated callback string to menu - AddItem returns an Item object
myHeader = mySubmenu.
AddHeader (strTitle, integerColor) : Adds section header with background color (0xRRGGBB) - AddHeader returns an Item object
mySubmenu2 = mySubmenu.
AddSubmenu (strTitle) : Adds a Submenu - AddSubmenu returns a Submenu object
mySubmenu.
AddSeparator () : Adds horizontal separator
mySubmenu.
SetIcon (strIconName) : Sets an icon by name for the submenu (for icon names see the picture below)
mySubmenu.
LoadIcon (strPathToIcoFile) : Loads an icon from a .ico (16*16) file
mySubmenu.
EnableItem (enable) : If enable is 1, enables this submenu item; If it's 0 it will be disabled (greyed out)
available attributes:
mySubmenu.
color = integerValue (0xRRGGBB) : Sets the text color for the submenu title (default = black)
mySubmenu.
color_sel = integerValue (0xRRGGBB) : Sets the text color for the submenu title when selected (default = white)
mySubmenu.
bkcolor = integerValue (0xRRGGBB) : Sets the background rect color for the submenu title (default = light grey)
mySubmenu.
bkcolor_sel = integerValue (0xRRGGBB) : Sets the background rect color when selected (default = blue)
mySubmenu.
use_systembkcolor = integerValue (0 or 1) : If 1, uses the system background color as the bkcolor ("transparent" background, default=1)
mySubmenu.
bold = integerValue (0 or 1) : If 1, displays the text for this submenu's title as bold text (default is 0)
mySubmenu.
centered = integerValue (0 or 1) : If 1, displays the text for this submenu's title as centered text (default is 0)
mySubmenu.
padding_bottom = integerValue: enlarges the bottom of the background rect
mySubmenu.
padding_top = integerValue: enlarges the top of the background rect
mySubmenu.
spacing_bottom = integerValue: adds space below the item and the background rect
mySubmenu.
spacing_top = integerValue: adds space above the item and the background rect
7. Icons
Usage example:
popup = XPOP();
item = popup.AddItem("New Scene", "NewScene()");
item.SetIcon("Star");
You can use your own icons by using the LoadIcon instead of the SetIcon function. You will need to point it to a 16*16 .ico file
available icons:


Icons by Axialis Team
8. How to create a custom command
Here's how to create a custom command out of the above code snippet:
Start Softimage. Pick File->Plugin Manager
Right-Click User Root, pick New->Add-On Directory... (We will create the command plugin inside its own add-on directory so it can be distributed as an .xsiaddon file later)
Name the add-on exampleXPOPAddon, hit OK.
In the tree view, click the + to open the new exampleXPOPAddon add-on.
Right Click exampleXPOPAddon->Plug-ins, pick New->Command.
Inside the new window, enter exampleXPOP for the command name. Plug-in name will be automatically filled in.
Set Coding Language to JScript, hit Generate Code. A script editor will open.
Copy the code snippet from this web page, paste it into the Softimage script editor into the exampleXPOP_Execute() function, replacing the TODO comments.
Save the code, this will register the command already.
From the Softimage main menu, pick File->Keyboard Mapping, select the Custom Script Commands group.
Scroll down to exampleXPOP, then hold down the ALT key while dragging the exampleXPOP item on the T key.
The new popup is now mapped to ALT+T. Exit the Keyboard Mapping dialog and hit ALT+T to test it.