Forum: Poser - OFFICIAL


Subject: Vertex-level editing via Poser Python

Cage opened this issue on Mar 21, 2007 ยท 42 posts


adp001 posted Fri, 23 March 2007 at 3:42 PM

If a new box is created, the callback event is generated. This slows down anything.

I did the following: Wenn the start button is pressed, callbacks are disabled. If anything is set up, callbacks are re-enabled.

Using the standard Tk-mainloop from within Poser should be avoided for scripts like this.
Better use an infinitive loop and call poser.Scene().ProcessSomeEvents() from your script. This keeps Poser living without loosing control. If your script is very busy, don't let Poser do something. If you don't, Poser needs a lot of time to check if anything is changed in the meantime, including screen-refreshs.

Basically:

class PoserApp(Toplevel) :<br></br><br></br>    def __init__(self, master) :<br></br>        Toplevel.init(self, master)<br></br>        self.verybusy = False<br></br>        self.stopped = False<br></br><br></br>    def mainloop(self) :<br></br>        while not self.stopped :<br></br>            if not self.verybusy :<br></br>                poser.Scene().ProcessSomeEvents(10)<br></br><br></br>            self.update()<br></br><br></br>class MyApp(PoserApp) :<br></br>...<br></br>

From your app set self.verybusy = True to stop Poser. As a side effect, nobody is able to delete something your script needs to work with as long as self.verybusy is True ;)