Sun, Oct 6, 6:52 AM CDT

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: How to filter out all 'special' prop actors ?


3dcheapskate ( ) posted Sat, 05 March 2016 at 6:59 AM · edited Tue, 01 October 2024 at 7:20 AM

I want to iterate through all 'things that can be held in a figure's hand' type props in the scene (i.e. not lights, magnets, etc)

This bit of code...

    aAct= poser.Scene().Actors()
    for act in aAct:
        if not act.IsBodyPart():
            if not act.IsCamera():
                if not act.IsBase():
                    if not act.IsDeformer():
                        if not act.IsHairProp():
                            if not act.IsLight():
                                if not act.IsZone():
                                    print("Zeroing "+act.Name())

...gives me this in a simple test scene...

Zeroing GROUND
Zeroing FocusDistanceControl
Zeroing GoalCenterOfMass
Zeroing CenterOfMass
Zeroing valPoArLeafspear

Yes, the question is how to exclude GROUND, FocusDistanceControl, GoalCenterOfMass, and CenterOfMass ? I only want stuff like valPoArLeafspear to get through.

I'd like a solution that works as far back as Poser 6

(I'm fairly sure that for GROUND I'll have to check the name and internal name, but hoping there's something I've missed that'll catch the 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.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).



3dcheapskate ( ) posted Sat, 05 March 2016 at 7:04 AM · edited Sat, 05 March 2016 at 7:05 AM

P.S. also just checking to see if anybody, especially the folks who've been patiently answering my stupid questions for years, is still here... ;o)

This forum seems almost as still as a graveyard. Where's the best place to ask PoserPython questions now ?


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).



3dcheapskate ( ) posted Sat, 05 March 2016 at 7:17 AM · edited Sat, 05 March 2016 at 7:17 AM

P.S.2: That list of 'isXyz()' functions was all the actor ones in the P6 PoserPython manual except IsProp() Trying the logic the other way round, i.e...

aAct= poser.Scene().Actors()
    for act in aAct:
        if act.IsProp():
            print("IsProp YES! "+act.Name())

...gives me exactly the same.


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).



bagginsbill ( ) posted Sat, 05 March 2016 at 7:17 AM

I never found a good answer to your question. Being a pragmatist, I didn't keep looking, but instead added this list of specific named elements I intend to ignore:

ignoredTargets = set(['CenterOfMass', 'GoalCenterOfMass', 'FocusDistanceControl'])

I also have a function I made similar to your giant if statement that determines if an object is an ordinary prop:

def isOrdinaryProp(actor): if actor.IsCamera() or actor.IsLight() or actor.IsBase() or actor.IsBodyPart() or actor.IsZone() or actor.IsDeformer() or not itemHasMaterials(actor): return False return True

def itemHasMaterials(item): try: return item.Materials() except: pass

Then where I want a list of all possible targets for materials or whatever, I do this:

elements = scene.Figures() + [e for e in scene.Actors() if isOrdinaryProp(e) and e.Name().split()[0] not in ignoredTargets]

I don't remember why I split the name and just take the first part. It's probably because some of the names appear with additional tokens that confuse the match.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


bagginsbill ( ) posted Sat, 05 March 2016 at 7:19 AM

I don't know how to use this stupid markdown editor and I do not intend to. Sorry about the code line breaks and indents getting messed up.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


bagginsbill ( ) posted Sat, 05 March 2016 at 7:20 AM

The markdown is part of the reason I'm not writing here. It's an idiot's tool from 1984. I cannot imagine why we need to take a step back from WYSIWYG.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


bagginsbill ( ) posted Sat, 05 March 2016 at 7:21 AM

Also I don't get ebots except for new threads, so if you reply and I don't answer, it isn't because I hate you. It's because THIS SITE SUCKS DONKEY BALLS.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


3dcheapskate ( ) posted Sat, 05 March 2016 at 7:22 AM · edited Sat, 05 March 2016 at 7:29 AM

Thank you - I won't look any further then (edit to clarify because of the intervening posts: that was a response to your "I didn't keep looking" in your first post)

And don't worry about the forum de-formatting your post, I should be able to work it out ;o)


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).



markschum ( ) posted Wed, 23 March 2016 at 2:10 PM

when I need to process actors I wrote a script to read a list of actors and delete the odd ones, then I let the main script read that list. there seems to be no easy way.


3dcheapskate ( ) posted Fri, 01 April 2016 at 12:38 AM

Thanks, so that's a double confirmation (yourself and bagginsbill) that there doesn't seem to be any easy way. I've already adopted bagginsbill's workaround, although I'll probably ask a few more questions about that (probably at CGbytes)

Anybody else (PhilC, ockham, etc) care to confirm confirm that there's no easy way that they can think of?


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).



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.