layingback opened this issue on Dec 03, 2003 ยท 6 posts
layingback posted Wed, 03 December 2003 at 3:34 PM
There's a python script poserStartup.py that gets executed when Poser first starts. Anybody happen to know if there is a python script that gets run automatically as Poser is closing down, or someway to get one to run at that time? And a different but related question: Is there any way to handle exceptions - in the Python sense - from poser.Execfile()? It appears from my testing to just push it's Warning dialog directly to the screen in the event of an error such as missing file, and abends your python script - so you get no chance to try-except it. Am I missing something? FWIW, I'm trying to load a program when Poser starts, and ideally end it when Poser closes. Thanks.
ockham posted Fri, 05 December 2003 at 10:01 AM
Execfile is indeed clumsy. It seems to open a "DOS box", which gets all tangled up with Poser. You might try the Spawn family instead, which is only available in Python 2.2 (Poser 5). I don't know if that would be any better. Or use some of the extenders like SWIG or Pyrex to form an external module that can be called from Python. I'm learning how to use SWIG, and it's powerful but tricky. For a simple action with minimal passed values, it works nicely. As for closing down, I don't think Poser gives us a trigger event. (Seems like there was a discussion of this point some time ago; you might search back through the forum.) One possibility: Take advantage of the "exitfunc" action in Python itself. Since Poser closes down all the scripts that it owns, the exitfunc could call a out-of-Python program when your startup script detected that it was being closed down. This would require the script to keep running during the session, though. Another way: The startup script could trigger a plain little Windows app that keeps running in the background, watching the files that Poser rewrites when it's done. Specifically, when poser.ini changes its last-written time, Poser has just finished.
layingback posted Fri, 05 December 2003 at 5:05 PM
Ockham, Thanks so much for the detailed - and useful - reply. I'm using Execfile expressly to call a python script which has the spawn command in it. (spawn appears to be in new in 1.6.) Reason for this is that with NT-based Windoze (2K, XP) the python script calling the external program becomes "In use" per Windoze until the external program goes to EOJ. I.e. you can't edit the python script in the meantime. So I don't want to risk tying up poserStartup.py for potentially the whole session. Problem is when you try to access an "In use" py script from within Poser Python it appears fine, until you go to execute it. Then the ugly dialog box appears! Looks as if I may have found a route to a way around it though... Attempting to delete an "in use" script will fail in Poser python. 'Course it's a tad like the old method of testing suspected witches by burning - by the time you find out that the file isn't locked, it's gone! Fortunately virtual things like files are somewhat easier to recreate :-) Thanks for the insight on close down detection - both could work for this situation.
MungoPark posted Tue, 09 December 2003 at 6:53 AM
Hi, just have the same problem - when I load faces, sometimes the morphs are different and the dialog box comes with "some channels do not apply" - any idea how I can get rid of this ? I want to render several hundred faces, and unfortunately the figure they were created had different morph channels (which dont interest me at all) Greetings Mungo
ockham posted Tue, 09 December 2003 at 9:22 AM
The simple answer is to rename (or copy) the fc2 files to pz2. Then load them as poses, not faces. The "Some information does not apply" dialog box won't pop up when Poser thinks it's a PZ2.
MungoPark posted Tue, 09 December 2003 at 9:43 AM
Man you are great - was just looking for a monkey to press enter every ten minutes for a week - Mungo