Wed, Nov 20, 8:57 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 Sep 18 2:50 am)

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: Loading a PP2 file via PoserPython (Poser 6)


3dcheapskate ( ) posted Sat, 05 May 2012 at 9:50 PM · edited Thu, 07 November 2024 at 9:17 AM

I'm (still!) working on a script to be released in the Renderosity FreeStuff. I've already got my PoserPython 'PropGoto' script working nicely (in Poser 6*) - if I have my prop already loaded and selected, and I also have a figure in the scene, the script will smartparent the prop to the figure's left/right hand (i.e. position, orient, and parent correctly, regardless of figure pose) and apply the correct handgrip pose to the figure's appropriate hand.

I have also written a DAZ Script that does the same thing. I've gone one step further with the DAZ Script - I've created a .DSA file to go in the same folder as the .PP2, with the same filename as the .PP2. When you double click the icon for the prop in DS3 or DS4 it loads my prop at the origin, but if you already have a figure selected it will load the prop smartparented to the figure's left/right hand, and apply the correct hand pose too.  Sort of SmartPropPlus.

Now obviously I want to do the same thing in Poser, but I can't work out how to load the prop from the PP2 file. Advice please!

 

*(I use the poser.DialogSimple.MessageBox/YesNo/AskMenu a fair bit, and I've read somewhere on this forum that these don't work in later versions of Poser. Could somebody please clarify?)


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).



markschum ( ) posted Sat, 05 May 2012 at 11:40 PM

scene.LoadLibraryProp()

 

Irs a scene command , loadlibraryprop, which loads the named prop.  The loaded prop I thimk becomes the currectly selected item so scene.CurrentActor() should get it for any changes to position or parentinng.

 


3dcheapskate ( ) posted Sun, 06 May 2012 at 12:12 AM

Thanks markschum - can't see how I missed that since it's in the Poser 6 PoserPython Methods Manual. That's my second "D'oh!" facepalm moment in as many days - I think I'm having one of those braindead weekends!


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).



3dcheapskate ( ) posted Sun, 06 May 2012 at 12:57 AM

Okay, that works perfectly! I can now call this script in Poser 6 and it loads the prop, smartparents, and applies the hand pose all in one.

I was calling the original PropGoto script from a Pose file like this (complete contents of the pose file):

{
version
    {
    number 6
    }
}
{
version
    {
    number 6
    }
runPythonScript ":Runtime:Python:poserScripts:3DCheapskate:PropGoto.py"
}

I can change this pose file to call my new script and it works perfectly. Now the original 'PropGoto' was logically a pose, but the new version is logically a prop. So I thought "I'll just make that a .PP2 prop file (and move it to my Props folder). But when I double click on it in my Props library... nothing, no dialogues, no PoserPython window with error messages. It seems that the runPythonScript is being ignored.

Am I correct in thinking that this method of calling scripts ONLY works from Pose files (i.e. PP2)?


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).



3dcheapskate ( ) posted Sun, 06 May 2012 at 1:11 AM · edited Sun, 06 May 2012 at 1:15 AM

Ha! Just found the answer (Google came up trumps - the free 'Run Python in Poser' tutorial at Dimension 3D here has the answer in section 6)! You only need that double version section thing in pose files (otherwise the script is run twice). In all other types of content file you just use a single version section. So this works fine as a .PP2 prop file:

{
version
    {
    number 6
    }
runPythonScript ":Runtime:Python:poserScripts:3DCheapskate:Dha.py"
}


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).



3dcheapskate ( ) posted Sun, 06 May 2012 at 1:29 AM

Okay, now I've got my 'SuperSmartProp' 😉 working in both DAZ Studio (DS3/4) and Poser 6 on my Windows 7 laptop. No Mac to test on, but I assume that the following PoserPython script line won't work on a Mac:

poser.Scene().LoadLibraryProp("RuntimeLibrariesPropsWar DanceDha.pp2")

Is there anything I can do to make this work on both PC/Mac?


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).



Snarlygribbly ( ) posted Tue, 08 May 2012 at 3:06 AM

Just use forward slashes - they work on Windows and Mac

Free stuff @ https://poser.cobrablade.net/


nruddock ( ) posted Tue, 08 May 2012 at 7:40 PM

Quote - Just use forward slashes - they work on Windows and Mac

And don't start the path with "/" either.


3dcheapskate ( ) posted Tue, 22 May 2012 at 12:06 AM

Darn it, I'd forgotten about that last MAC question I posted and just uploaded the scripts as-they-were, so they won't work on a MAC! (They're part of my 'S.E.Asian Duel' via the freebie links in my siggy)

So this is what the script line should be to work on PC and MAC, yes?

poser.Scene().LoadLibraryProp("Runtime/Libraries/Prop/War Dance/Dha.pp2")


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).



markschum ( ) posted Wed, 23 May 2012 at 10:39 PM

the slash issue is a python one. The   is a control code so in a python script you either use / or   . 

 

I would try using :runtime:libraries:prop: etc which poser recognises on pc and mac.

 


3dcheapskate ( ) posted Wed, 06 June 2012 at 11:06 PM

Thanks again - duly noted. So instead of this...

WORKS ON A PC BUT WON'T WORK ON A MAC:

poser.Scene().LoadLibraryProp("RuntimeLibrariesProps3DCheapskateWeaponsDha.pp2")

...I could use any of the following three:

WORKS ON A PC (CHECKED ALL 3 MYSELF), SHOULD WORK ON A MAC TOO (CAN'T CHECK):

poser.Scene().LoadLibraryProp("Runtime/Libraries/Props/3DCheapskate/Weapons/Dha.pp2")

poser.Scene().LoadLibraryProp("RuntimeLibrariesProps3DCheapskateWeaponsDha.pp2")

 poser.Scene().LoadLibraryProp(":Runtime:Libraries:Props:3DCheapskate:Weapons:Dha.pp2")

 

 


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).



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.