Forum: Poser Python Scripting


Subject: Detecting hair props

Pret-a-3D opened this issue on Jan 08, 2014 · 4 posts


Pret-a-3D posted Wed, 08 January 2014 at 9:14 AM

Hi.

Is there a reliable way of detecting if and Actor refers to a hair prop. IsHairProp() surprisingly doesn't work (it returns False for Hait props) and I could not figure out any other option. 

Any help will be greatly appreciated.

Paolo

https://www.preta3d.com
FB: https://www.facebook.com/RealityPlugIn
Tw: @preta3d
G+: https://plus.google.com/106625816153304163119
The Reality Gallery: https://reality-plug-in.deviantart.com


structure posted Thu, 09 January 2014 at 5:54 PM Forum Coordinator

I wrote this a while ago and it seems to work ok, I was kinda hoping someone had a better solution though.

import poser

scene=poser.Scene()

for act in scene.Actors():
    if act !=None:
        if (not act.IsBase()) and (not act.IsDeformer()) and (not act.IsZone()) and (not act.IsLight()) and (not act.IsCamera()) and (not act.IsBodyPart()):
            try:
                if act.Parent().InternalName().lower()[0:4]=='head':
                    print 'probably hair', act.Name(),'n'
                if act.ConformTarget().lower()[0:4]=='head':
                    print 'probably hair', act.Name(), 'n'    
            except:
                pass

Locked Out


Pret-a-3D posted Thu, 09 January 2014 at 6:07 PM

Thanks. 

I got a reply from SM in the meantime that points out that all hair props have a Actor.InternalName() that starts with "figureHair". Sometimes the solution stares you in the face :)

Paolo

https://www.preta3d.com
FB: https://www.facebook.com/RealityPlugIn
Tw: @preta3d
G+: https://plus.google.com/106625816153304163119
The Reality Gallery: https://reality-plug-in.deviantart.com


structure posted Fri, 10 January 2014 at 12:03 AM Forum Coordinator

good to know lol :)

Locked Out