Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)
My first guess would be that it's a problem with how TkInter is being shutdown. How are you destroying the frames when you leave TkInter? I had similiar side-effects when I first tried setting up 'Inter in a script. Granted, I wasn't using the create prop methods but the 'works the first time but not after that' sounds very fimiliar. You might also want to look at the ProcessSomeEvents() method. Keeping Poser synced with 'Inter saved me lots of headaches by keeping strange errors like these from occuring.
Try this: After creating the object, call the function MarkGeomAsChanged() with the new object as the argument. This causes Poser to somehow "register" the new object. I ran into the same problem in a script to create multiple spaced-out copies of an object.
My python page
My ShareCG freebies
I actually tried that, to no apparent effect, although I haven't run through all the possible combinations yet. I emailed Curious Labs support and got a reply from Jack in which he referred to other reports of possible memory leaks. I ran a few trial scripts with various startup document configurations, and got some interesting results which I forwarded to him a week ago, along with a query as to whether any more service releases were expected for ProPack. No reply yet.
Jack also forwarded your example script to me, I will also take a closer look at it. Don't worry if it takes a while - it's not that we wouldn't care it's just that we are busy with other important things. Just keep on sending us feature requests, bug reports and other comments on Poser Python. We care a lot about it and want you to get the best from it. Stefan Werner, Egisys AG
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
As part of a project, I am trying to create a simple Poser Actor inside a Python function. The intention is in due course to include a similar function as part of a Tkinter button/menu action.
I have no problems in creating objects (repeatedly) in the main body of the Python script, using the 'CreatePropFromGeom()' method and creating the mesh inside a function as a 'numpy' array.
However, when I use this method to create a prop inside a function and return the (complete) object to the main body, it works the first time, but, on subsequent script executions, the object returned is invalid and the script and Poser hangs.
Additionally, if, when starting Poser, I do a File::New instead of working with the initial startup document, the first instance of object creation inside a function crashes. In my previous post I did note that there seemed to be a difference (albeit under abnormal circumstances) between the Python environment in the startup Poser document and subsequent loaded documents.
As a matter of perspective, this problem does not appear to be a manifestaion of the Python namespace or garbage collection rules according to the reference, and all of the sample scripts that were supplied with ProPack avoid it by creating props in the main script body.
The only possibilities which I haven't yet tried is either to create a new script and use poser.ExecFile() inside the Tkinter action or to create a library object and use Python to load it in response to a button action, but I would certainly like to find out first whether this is a bug in Poser Python, or whether I am just missing something obvious.
If anyone has used Tkinter actions to repeatedly create objects, or has encountered (or failed to encounter) similar problems please let me know, as at the moment, this is looking like a killer bug for my project.