Fri, Jan 10, 9:14 PM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)

We now have a ProPack Section in the Poser FreeStuff.
Check out the new Poser Python Wish List thread. If you have an idea for a script, jot it down and maybe someone can write it. If you're looking to write a script, check out this thread for useful suggestions.

Also, check out the official Python site for interpreters, sample code, applications, cool links and debuggers. This is THE central site for Python.

You can now attach text files to your posts to pass around scripts. Just attach the script as a txt file like you would a jpg or gif. Since the forum will use a random name for the file in the link, you should give instructions on what the file name should be and where to install it. Its a good idea to usually put that info right in the script file as well.

Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: Despair: Prop Creation in a function - is this a bug?


williamsheil ( ) posted Sun, 12 May 2002 at 4:02 PM · edited Fri, 10 January 2025 at 9:08 PM

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.


bushi ( ) posted Mon, 13 May 2002 at 11:04 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.


williamsheil ( ) posted Tue, 14 May 2002 at 12:09 AM

This problem is not occuring with Tkinter running. It is a problem with basic Python scripts.

However, 'ProcessSomeEvents()' sounds like a good possibility, I'll try that ASAP.

I sent Curious support an email restaing the problem, so I'll see what they have to say.

Thanks

Bill.


bushi ( ) posted Tue, 14 May 2002 at 12:24 AM

OK, if that's the case then you might try passing it back through a global variable to make CERTAIN it isn't a scoping problem.


ockham ( ) posted Thu, 23 May 2002 at 4:17 PM

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


williamsheil ( ) posted Fri, 24 May 2002 at 8:15 AM

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.


stewer ( ) posted Sat, 08 June 2002 at 4:16 PM

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


bushi ( ) posted Sat, 08 June 2002 at 4:52 PM

And I can guess what those important things are wink, wink, nudge, nudge. ;-)


Privacy Notice

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.