Mon, Dec 23, 1:43 AM 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: Bug? PP2010 run script from pz2?


grichter ( ) posted Thu, 10 February 2011 at 9:06 PM · edited Mon, 23 December 2024 at 1:28 AM

execute by double clicking on the icon in the PP2010 pose lib or by clicking on the check mark "apply original pose" and the script runs twice.

01-White.py contains

{
    version
    {
        number 4
    }
   
    runPythonScript ":Runtime:Python:poserScripts:MyScripts:V4Pantyhose:AllSheer:Colored-Sheers:01-White.py"

}

Note: Text wrapped above while posting)

Load from the file menu>run python script

and the script runs as it should just once.

01-White.py contains 20 variables that get transfered to the main script

Have 112 files like 01-White.py with different variables to create a second skin on V4 where the panty hose are all sheer, another 112 that add a displacement map and does a color math routine to make the second skin look like pantyhose with seams, darker top, and another 112 files that do the same except the top is all sheer (does the displacement but not the color math)

The imports are as such

import V4PantyhoseAllSheer

V4PantyhoseAllSheer.Doit( and the 20 variables)

where in V4PantyhoseAllSheer have a def Doit( and the 20 variables) that is where the basic script starts and runs and ends from.

See the next post:

 

 

 

Gary

"Those who lose themselves in a passion lose less than those who lose their passion"


grichter ( ) posted Thu, 10 February 2011 at 9:14 PM

Now to take the issues further I have  scripts menu scripts that load all my characters

that contain for example

Load V4.2+++Skin2.cr2

import os
import poser
scene = poser.Scene()

def loadLibraryFile():
   path = "/runtime/Libraries/Character/Characters_Daz/V4.2/V4.2+++Skin2.cr2"
   try:
        scene.LoadLibraryFigure(path)
   except:
      pass

loadLibraryFile()

 

Which as expected only load one figure of V4

So I created a pz2 that contains the following and moved the script that loads V4 from the scripts menu folder to the poserScripts folder

{
    version
    {
        number 4
    }
   
    runPythonScript ":Runtime:Python:poserScripts:V4.py"

}

double click on it and it loads 2 copies of V4

then I copied the pz2 and made it a cr2 and put in the character lib and it only loads one copy. So something is a miss it appears to me if you use runPythonScript from the pose folder.

 

anybody seen this behavior?

 

Gary

"Those who lose themselves in a passion lose less than those who lose their passion"


semidieu ( ) posted Fri, 11 February 2011 at 6:58 AM · edited Fri, 11 February 2011 at 7:00 AM

Pose (pz2) file run the script twice.

Use the following code in a pz2 file:

 

{
        version
        {
        number 6
        }
}
{
        version
        {
                number 6
                runPythonScript "FILENAME.py"
        }
}


grichter ( ) posted Fri, 11 February 2011 at 8:18 AM

Wow, how did you figure that out?

If you tell me it's on page 323 of the PoserPython Methods manual, I'll.....???

Thanks a zillion.

Gary

"Those who lose themselves in a passion lose less than those who lose their passion"


semidieu ( ) posted Fri, 11 February 2011 at 2:32 PM

You're welcome. Not in a book (or I don't know too). I didn't discovered the trick... it's someone who told me it (noelr I think... not sure)


amandagirl15701 ( ) posted Sat, 12 February 2011 at 7:09 PM

Attached Link: http://d3d.sesseler.de/index.php?tutorial=tutorial&product=run_python

I found this handy little tutorial on D3D's site that pointed me in the right direction.

Hope it helps.

 


grichter ( ) posted Sat, 12 February 2011 at 8:36 PM

Interesting he has the run command (if you can call it that) outside or one bracket lower in the second half

{

     version

    {

        number 6

    }

     then the run script

} (the final closer bracket)

Will have to try this small change as a few times the script has not completed the first time it is loaded into the name space. After the first load it works everytime. Granted it second script stays in the name space. But my script imports a second script. And the second script is the one that does not complete the first time.

Gary

"Those who lose themselves in a passion lose less than those who lose their passion"


amandagirl15701 ( ) posted Sat, 12 February 2011 at 9:33 PM

Don't forget the double version instances. This is a pz2 file that links to an outside runtime I keep scripts stored in that don't need to bee in my main runtime and accesses one of Cage's scripts. I works perfectly in Poser 7. I also use absolute rather than relative file paths... less chance something goes wrong.

{

version
 {
 number 4.01
 }
}
{

version
 {
 number 4.01
 }

 runPythonScript C:UsersMandyDocumentsPoser ContentPoser ScriptRuntimePythonposerScriptsmr_looper6h.py
}


amandagirl15701 ( ) posted Sat, 12 February 2011 at 10:35 PM

Cr2 file need only one version instance in the file and pz2s need two.  One thing is with a pose file you need a loaded figure to apply it to. I'm curious to how you managed to get the pz2 file to do anything at all. I tried to recreate your findings with your python script modified to open one of my files and found that yes the script works and loads one figure. The pz2 version would not load at all until I had a figure of some kind loaded into the scene and the cr2 version loads perfectly.

Anyhoo... I hope you get it working...


grichter ( ) posted Sun, 13 February 2011 at 11:07 PM

I load all my characters from the script menu. Saves time instead of hunting them down. Granted switching runtimes used to be a pain under P7 etc. But still faster even with the P8 or PP2010 library. Have folders Load F Chars and Load M Chars in the scripts menu with the appropriate files inside of them.

I don't know about how I got it to load a character. I copied my code from the scripts menu for V4 and put it into a pz2 and tested. Then deleted after it loaded two instances of V4.

I am on a Mac and Python is slightly different then on Windows.

 

Been busy doing something else all day in Poser. I will test again in the next day or two,

 

Gary

"Those who lose themselves in a passion lose less than those who lose their passion"


SteveJax ( ) posted Sun, 20 February 2011 at 4:10 AM

Well the first problem I see in your very first example is that 01-White.py is calling a copy of itself!! That would be why it's running twice.

1st: Make sure you don't have multiple copies of the script.

2nd: Make sure any copies you do have aren't calling themselves.


grichter ( ) posted Sun, 20 February 2011 at 8:03 AM

Quote - Well the first problem I see in your very first example is that 01-White.py is calling a copy of itself!! That would be why it's running twice.

1st: Make sure you don't have multiple copies of the script.

2nd: Make sure any copies you do have aren't calling themselves.

 

No it is not calling it's self twice. It is a pz2 that calls a 01-White.py that loads a bunch of variables and then calls a second skin script in totally different directory. The second skin script is shared or used by 288 different variable loading scripts.

Gary

"Those who lose themselves in a passion lose less than those who lose their passion"


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.