xPop Wrapped
May 7th, 2006 by Patrick Boucher - Viewed 5692 times - Popularity: 10% [?]Nothing beats a popup menu for having often used funcions close to your mouse pointer.
Reinhard Claus took this to the next level for XSI users when he wrote the fabulous xPop XSI plugin. This nifty little tool allows you build your own custom popup menus in scripts, bind them to a hotkey and have them close at hand when modeling, animating, texturing or whatever it is you do during a normal day of 3D content creation or visual effects work.
The downside to xPop is that you have to feed it strings that look like this…
"cut selection;copy selection;select...[all;none;invert[selected;only components]];---;discard;go[back[1 steps;2 steps];forward];---;help"
To create something that looks like this…

That’s not so bad but when you start creating really fancy dynamic and/or context sensitive popups and you start having to deal with the numerical indices that xPop returns when the user clicks on a menu entry, you start developing a headache.
xPopMenu to the rescue
To aleviate some of these issues, because you have bigger things to worry about when working in XSI, I wrote a little class called xPopMenu that deals with all the ugliness (as little there is) for you.
Create an xPopMenu instance, add some items to it, provide callbacks for these items and call run(). Voila!
Check this code that creates the same structure you saw above. Please note that this code uses one of my stupid python tricks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | def callback(data): Application.LogMessage(data) mnu = xPopMenu() mnu.addItem('Cut Selection') mnu.addItem('Copy Selection') sub1 = mnu.addMenu('Select...');\ sub1.addItem('All');\ sub1.addItem('None');\ sub2 = sub1.addMenu('Invert');\ sub2.addItem('Selected');\ sub2.addItem('Only Components') mnu.addSeparator() mnu.addItem('Discard') sub3 = mnu.addMenu('Go');\ sub4 = sub3.addMenu('Back');\ sub4.addItem('1 Step');\ sub4.addItem('2 Steps');\ sub3.addItem('Forward') mnu.addSeparator() mnu.addItem('Help', callback, 'Help') mnu.run() |
Installing
Download xPop and download xPopMenu.
Install xPop as per its installation instructions.
Put xPopMenu in your python path.
Start your scripts that use xPopMenu with:
1 | from xPopMenu import xPopMenu |
The xPopMenu.py file includes a little bit of documentation and an example usage.
Have fun!
Popularity: 10% [?]




I was just wondering where were you!!!
Keep up the good stuff Patrick!
Ciao!
Andrea
Nice work there Patrick! cheers for thaking care of the usability issue.
[...] IBlog
People and thoughts behind XSI in production…
« xPop Wrapped new xPopMenu May 9th, 2006 by Patrick Boucher [...]
Thanks!!!
[ Nothing beats a popup menu for having often used funcions close to your mouse pointer ]
well let’’s say that’’s true if you ever tried a maya marking menu. :-))
but thanks to rc and you for this smart thing.