Re: [Bf-committers] API: How to get a list of running scripts?
how about incrementing a global variable each frame? Can a new instance wait one frame and then actually launch if the value of the variable hasn't changed? my scripts are triggered by Redraw not by Frame change, so i have thought about time stamps and delay value checks, but it is not reliable, because the idle periods may be unpredictable long. Anyway, seems like I'm the only one responding to this thread, and I'm in no way an expert... Have you tried to ask main developers in the IRC directly? asked Campbell, and the answer is, 2.49 API doesn't support this. Though it should be easy to extend - i have to look at Blender.Scene.getScriptLinks() method. As I've learned recently, in 2.63 (or maybe even 2.6+), there are bpy.app.handlers.scene_update_pre and bpy.app.handlers.scene_update_post -- these event handlers are invoked each frame (not sure if this behavior will persist, though). It's possible to get the list of the handlers, so I guess in recent Blender versions your idea can be implemented. i am keeping my eyes on 2.6, but awaiting significant moves in UI+API area after bmesh integration at first. ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers
Re: [Bf-committers] API: How to get a list of running scripts?
Hi, If this is about an addon, there seems to be a function to check if it is running: import addon_utils addon_utils.check('space_view3d_3d_navigation') If not then it seems more difficult. I might be wrong here, but I think in that case there isn't really any running 'script object' that exists. There might be python objects in memory that were created by the script, like functions that were installed as handlers somewhere, but it's just bits of data attached in various places. An error in the code will not remove those python objects, they stick around until you actually go and delete them. Brecht. On Wed, Apr 11, 2012 at 3:40 AM, Remigiusz Fiedler mig...@gmx.net wrote: hi all, I am looking for a method for conditional start of a script only if no instance of it is running already. How to get a list of running scripts through API? thanks in advance, migius ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers
Re: [Bf-committers] API: How to get a list of running scripts?
Dima, yes, i meant Python API, and particularly 2.49 API. Global variables (like Blender.myvariable) are perfect for script-to-script communication but there seems to be no way to update/delete them when the script cancels unexpectedly (by user_cancel or by errors). 2012/4/11 Dima Glibitsky dima.g...@gmail.com: Do you mean the Python API? Seems like it's not possible yet... But I guess in your case, you can just have a global variable in the script (or add some property to a WindowManager) and set it to True/False accordingly. ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers
Re: [Bf-committers] API: How to get a list of running scripts?
What is your script doing? Some realtime background processing? I'm not familiar with 2.49 API, and I'm not sure if this helps your case, but here's my suggestion: perhaps you can pass all the relevant data to the new instance of the script (which would continue the job), and the old one would shut down itself? I used a similar approach during the development of one of my scripts, though it was 2.5+ API. For what reasons are you still using 2.49, by the way? ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers
Re: [Bf-committers] API: How to get a list of running scripts?
Do you mean the Python API? Seems like it's not possible yet... But I guess in your case, you can just have a global variable in the script (or add some property to a WindowManager) and set it to True/False accordingly. ___ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers