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


Anthony Appleyard posted Wed, 26 March 2014 at 11:18 AM

I tried this, and, if I first select a prop which has been "half-parented" by a Python script, it should change it into proper full parenting. I DO NOT GUARANTEE ANYTHING :: test it first!!!


import poser  
 import string  
 import os  
 import sys  
 scn = poser.Scene()  
 act = scn.CurrentActor()  
  
 acts=scn.Actors()  
 figs=scn.Figures()  
  
 propin=ac.InternalName()  
 propen=ac.Name()  
 ac=scn.CurrentActor()  
 if ac.IsProp():  
     par=ac.Parent()  
     parin=par.InternalName()  
     paren=par.Name()  
     print paren,"(",parin,") is parent of ",propen,"(",propin,"), now trying to parent it fully properly"  
     libaddr=poser.Libraries()[0]  
     fileaddr=libaddr+"RuntimeLibrariesPosezxcvbnm.pz2"  
     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"  
 poser.ProcessCommand(1559)  
 scn.DrawAll();