Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Sep 18 2:50 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).
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).
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).
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).
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).
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).
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.
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).