Forum: Poser Python Scripting


Subject: An old problem with parenting props is still here in Poser 10.

Anthony Appleyard opened this issue on Jan 15, 2014 · 24 posts


3dcheapskate posted Wed, 02 April 2014 at 5:12 AM

Cheers Anthony! A minor correction, and a replacement of Poser.Libraries with something that works in Poser 6, and I can confirm that the props loaded via script are now deleted along with the figure. (I just tried it in the script-based freebie I uploaded a day or so ago here http://www.renderosity.com/mod/forumpro/showthread.php?thread_id=2879764 )

def parentprop(ac,par):
    scn = poser.Scene()
    if ac.IsProp():
        scn.SelectActor(ac)
        propin=ac.InternalName()
        propen=ac.Name()
        parin=par.InternalName()
        paren=par.Name()
        print "parenting",propen,"(",propin,") to ",paren,"(",parin,")"
        sTmp = os.path.join('Runtime','Libraries','Pose','3DCheapskate','TempPose.pz2')
        poserpath=os.path.split(poser.AppLocation())
        fileaddr =  os.path.join(poserpath[0],sTmp)
        print "writing temporary pose file to ",fileaddr
        pose=open(fileaddr,"w")
        pose.write("{ntactor $CURRENTnt{nttsmartparent "+parin+"nt}n}n")
        pose.close()
        scn.LoadLibraryPose(fileaddr)
        print "re-parented"
    else:
        print "FAILED:", propin," is not a prop"

Edit: saving the figure works too - when you load the figure back the props are there correctly parented (from a qquick visual inspection and waggle of the arms)

P.S. Poser 6 simply overwrites the temporary file when you try a second prop - no warning or confirmation. Which is good in some ways, bad in others...


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 or something else.
*soon only to be available in two flavours - 
 DAZ and Renderosity