Forum: Poser Python Scripting


Subject: Poser 7: Python manual differs from reality

Anthony Appleyard opened this issue on Nov 20, 2009 · 10 posts


Anthony Appleyard posted Fri, 20 November 2009 at 6:48 AM

I have Poser 7.0.4.220 . I am writing a Poser script which includes:

scn = poser.Scene()
...
acs=scn.Actors()
for ac in acs:

and my Poser's Python manual saps for screentype.Actors() -:

Get a list of the non-figure actor objects in the scene. Actors are items that populate the scene such as props, cameras, lights, or deformers. They can also be body-parts of a figure, although body-part actors will not be returned in this list. To get a list of actors belonging to a figure, use the Actors() method for a figure object.

but when I ran the script it listed all actors including those that were parts of a character who was on stage. How can a Python script separate actors thart are part of a character from other actors? If I loop over all figures, then in each figure I loop across all actors which are in that figure, I would miss any actors which are not part of a figure.


adp001 posted Fri, 20 November 2009 at 7:28 AM

acs=[ac for ac in acs if not ac.IsBodyPart()]




bagginsbill posted Fri, 20 November 2009 at 9:05 AM

I just ran into this myself the other day. The Actors() method returns all actors, despite what the doc says.

So to find all actors, there is no need to loop over figures.

To filter out things from figures, you actually have to do more than check IsBodyPart. DAZ Vickie 4.2, for example, causes the list to return a bunch of things that are not body parts, but other things that are parts of figures. Things like bases, zones, deformers, goalcenterofmass, etc.

The things we actually see in Poser UI for choosing the current actor include body parts and what I call "ordinary props". You can test for IsBodyPart pretty easily, but there is no handy IsOrdinaryProp, such as the list you get in Poser when you choose a Prop.

Then, of course, there are cameras and lights, etc.

So I wrote this function to determine if an actor is an ordinary prop. Seems to work.

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

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 Fri, 20 November 2009 at 9:06 AM

The itemHasMaterials method is this:

def itemHasMaterials(item):<br></br>
  try:<br></br>
    return item.Materials()<br></br>
  except:<br></br>
    pass<br></br>

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)


markschum posted Fri, 20 November 2009 at 10:03 AM

There are a number of errors in the Python documentation.


jdredline posted Fri, 20 November 2009 at 10:59 AM

I just wanted to say how great it is see BB back in the forums!



bagginsbill posted Fri, 20 November 2009 at 11:31 AM

?    ... When did I leave?


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)


jdredline posted Fri, 20 November 2009 at 12:17 PM

Okay, it's the first time I ran into you again. 



Anthony Appleyard posted Fri, 20 November 2009 at 1:28 PM

How can a Poser Python script ask the user to input a text string?


markschum posted Fri, 20 November 2009 at 3:05 PM

Its in the simple dialog methods. dIALOGTEXTENTRY page 130 of the P7 pdf file.