Sun, Dec 1, 6:46 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: Detecting hair props


Pret-a-3D ( ) posted Wed, 08 January 2014 at 9:14 AM · edited Sun, 01 December 2024 at 6:25 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 · edited Thu, 09 January 2014 at 5:57 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


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.