Sun, Sep 15, 11:54 PM CDT

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Sep 08 5:10 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: runPythonScript from pz2 - How to avoid double invocation


dburdick ( ) posted Thu, 06 March 2008 at 2:06 PM · edited Sun, 15 September 2024 at 4:01 PM

It seems that when using the runPythonScript command in a .pz2 file it will run the called python script twice.  Quick example:

The .pz2 file contains:

{
version
 {
 number 6
 }
runPythonScript ":Runtime:Python:poserScripts:Test.py"
}

The Test.py program contains:

print "Hello World"

When running this, it will print "Hello World" twice.  If I invoke the script from material file (e.g. test.mt5), it runs correctly and prints only once.  Any ideas on how to get the runPythonScript command to execute only once from a .PZ2?


Dimension3D ( ) posted Thu, 06 March 2008 at 8:52 PM

The script is called only once from a pz2 file, if you put the Python call in the second part of the pose.

Use the following as pz2:

{
    version
    {
        number 6
    }
}
{
    version
    {
        number 6
        runPythonScript ":Runtime:Python:poserScripts:Test.py"
    }
}


Dimension 3D - Poser Tools, Poser Props and Morphs, Cinema 4D Plugins, and more

Renderosity Store / D3D Web Site


dburdick ( ) posted Thu, 06 March 2008 at 11:49 PM

Quote - The script is called only once from a pz2 file, if you put the Python call in the second part of the pose.

Use the following as pz2:

{
    version
    {
        number 6
    }
}
{
    version
    {
        number 6
        runPythonScript ":Runtime:Python:poserScripts:Test.py"
    }
}

Many thanks.  That works perfectly.  How in the heck did you ever figure that one out?  Anyways, thanks again


Dimension3D ( ) posted Fri, 07 March 2008 at 12:13 AM

Actually, it was just luck. I tried a few things to see whether it will have any influence on this behavior.

I just wonder if this is intended behavior or a Poser bug. It looks as if poses are always applied twice, readScript calls in a pose are also executed twice.


Dimension 3D - Poser Tools, Poser Props and Morphs, Cinema 4D Plugins, and more

Renderosity Store / D3D Web Site


semidieu ( ) posted Sat, 08 March 2008 at 1:28 PM

Thanks a lot !!!!

I managed to avoid this with adding a 'trigger' on the UNIVERSE actor.

If there was no trigger, then the script must be launched.
If there was the trigger, the script removed it and exit with doing the rest of the script.

But this way is MUCH better !


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.