Netherworks opened this issue on Mar 11, 2011 · 5 posts
Netherworks posted Fri, 11 March 2011 at 4:52 AM
Hey guys,
Is there any way for Python (or wxPython) to detect if a new scene has been started? While the script has been running?
.
semidieu posted Fri, 11 March 2011 at 6:53 AM
I don't think directly. Don't know what kind of 'callbacks' it does return when a new scene is created. You will have to use alternate way to know if a scene has been created...
PhilC posted Fri, 11 March 2011 at 10:02 AM
Try a little skulduggery :)
Have your script change the GROUND xScale by a very small amount then continually check the xScale value. If it ever returns 100% you'll know that you have a new scene.
semidieu posted Fri, 11 March 2011 at 10:20 AM
Personnaly, I'm using the 'UNIVERSE' actor to add a new parameter.
Netherworks posted Fri, 11 March 2011 at 1:16 PM
Thanks Phil and Semi for your help. Before attempting this, I decided to try something else to solve the problem I'm having.
I never explained the problem...
I was attempting to use Poser Python's Callback function and it goes absolutely bonkers on a new scene, if the current script isn't closed. I'm supposing because you initially connect the Callback to something and I used the current scene. I was going to use one of your detection tricks to Clear the Callback and restart it. In my opinion, the whole callback thing is very volatile for scripts that can be kept running (this is a dockable panel)
Found a better solution. Instead of using Poser's callback, use a wxPython Timer. I have it at an 1000 ms loop but I think that a tad slow of a check so I'm going to reduce it to 250 ms. That should be responsive enough to check the currently selected object.
So yeah, this was a serious DUH moment for me.
.