Forum: Poser Python Scripting


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

williamsheil opened this issue on May 12, 2002 ยท 8 posts


williamsheil posted Sun, 12 May 2002 at 4:02 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.