Hm, yes I could store it in a parameter or another way ... just this feels hacky to get something basic done (granted no refresh happend during the plugin execution).
This should work, like Matt mentioned :/ Oh well. 2012/5/11 Alok Gandhi <[email protected]> > I am not sure whether this works under windows as well, the plugin script > can get refreshed and all your global variables will be re-initialized. The > only good approaches that I have been using is to store the varaibles in > UIITems lists. This works well for the 3D com objects as well. Another idea > would be to pass on objects returning through a safe array from the > commands itself. > > > On Fri, May 11, 2012 at 9:13 PM, Xavier Lapointe <[email protected] > > wrote: > >> >> hit another PPG UI Item *** >> >> ... All happening under the same Property page. >> >> 2012/5/11 Xavier Lapointe <[email protected]> >> >>> Hey guys, >>> >>> This one really surprised me. I tend to avoid global variable in >>> Softimage plugins as much as I can, but sometimes it might be convenient. >>> >>> So basically, I wanted to use a global variable ( simple Python >>> Dictionary ) to keep some stuff in reference while interacting with a PPG. >>> I remember clearly that it was working well under Windows, so >>> I assume this is a python 2.5 Linux issue (if this is an issue - please >>> tell me if this is normal under Soft with python 2.5). >>> >>> Here's basically what I was trying to do: >>> >>> [imports ....] >>>> >>>> # Global Scope >>> >>>> LAST_SELECTION = { >>>> 'project': {}, >>>> 'category': '', >>>> 'entities': [], >>>> } >>>> >>>> def CustomCommand_Execute(): >>>> global LAST_SELECTION >>>> [Do some modifications to LAST_SELECTION] >>>> >>> >>> >>> Following this pattern: >>> >>> - Prompt the PPG >>> - Interact with the UI >>> - The custom command is fired - do some modifications to >>> LAST_SELECTION >>> - hit another PPG UI >>> - Hell the LAST_SELECTION global is back to the inital value! >>> >>> I've been tracing the LAST_SELECTION variable with id(), and it's >>> changing every time I interact with the UI; showing clearly that there is >>> something nasty going on under the hood (?) >>> >>> Any idea to get this working? >>> >>> Alan mentioned the Application.SetGlobal/Application.GetGlobal functions >>> ... but still, this should be working natively, isn't? >>> >>> Thanks! >>> >>> -- >>> Xavier >>> >> >> >> >> -- >> Xavier >> > > > > -- > > -- Xavier

