Forum: Poser Python Scripting


Subject: How to select all figures in a group

maur_2005 opened this issue on Feb 24, 2020 ยท 11 posts


maur_2005 posted Mon, 24 February 2020 at 11:22 AM

Hi folks, I'm trying to select all figures in a Grouping and I need your help with this code

scene = poser.Scene()
group1 = scene.SelectActor(scene.Actor("Grouping 1"))

It doesn't work, what's wrong?


structure posted Mon, 24 February 2020 at 7:42 PM Forum Coordinator

"grouping 1" is not an actor, (you can check this by looking in the props dropdown) it cannot be selected using SelectActor,

what you can do ( there may be a better way ) is parent all the figures to one figure or prop and move the parent.

Locked Out


maur_2005 posted Mon, 24 February 2020 at 10:23 PM

thanks for your reply, I have a lot of scenes where the figures are already grouped.. Is there any way to select the figures from the group? or what is the right way to select a group in python?


structure posted Tue, 25 February 2020 at 12:44 AM Forum Coordinator

it depends on what you are doing, grouping (if memory serves ) allows you to group actors for rigging

Locked Out


ironsoul posted Tue, 25 February 2020 at 2:55 AM

Hello @maur_2005, can you provide a screen shot of the group?



adp001 posted Tue, 25 February 2020 at 7:35 AM

structure posted at 2:29PM Tue, 25 February 2020 - #4381745

"grouping 1" is not an actor, (you can check this by looking in the props dropdown) it cannot be selected using SelectActor,

???

Into a fresh loaded Poser scene I added 2 Groups. And parented a prop to the second Group.


print [ac.Name() for ac in sc.Actors()]


gives me:

[u'UNIVERSE', u'FocusDistanceControl', u'GROUND', u'Grouping 1', u'Arch_1', u'Light 1', u'backlight', u'aera', u'x 1', u'Main Camera', u'Aux Camera', u'Posing Camera', u'Dolly Camera', u'Left Camera', u'Right Camera', u'Top Camera', u'Bottom Camera', u'Front Camera', u'Back Camera', u'Face Camera', u'LHand Camera', u'RHand Camera', u'Shadow Cam Lite 1', u'Shadow Cam Lite 4', u'Shadow Cam Lite 2', u'Shadow Cam Lite 1', u'Grouping 2']

sc.Actor("Grouping 2")

returns an actor and I can select this actor.




adp001 posted Tue, 25 February 2020 at 9:33 AM

To find out what is contained in a group (or parented to a prop), use

print [ac.Name() for ac in poser.Scene().Actor("Grouping 1").Children()]





structure posted Tue, 25 February 2020 at 11:03 AM Forum Coordinator

Thanks adp, I could not figure that part out.

Locked Out


maur_2005 posted Tue, 25 February 2020 at 3:03 PM

Thanks Adp that code works pretty well, but the only problem is that it returns a list of actors instead of a list of figures. For example, returns:

Room, Studio_A, Body, Body, Body, Body

adp001 posted Wed, 26 February 2020 at 12:19 AM

Body actor stands for the figure. The body actor has no other task (also no geometry). Probably the programmers have included the body actor as a child in the chain, so that only actors are included and all objects can be edited with the same interface methods.

As you can learn from the manual, every actor has a method "ItsFigure", which helps you to find out to which figure it belongs.




maur_2005 posted Wed, 26 February 2020 at 12:37 PM

Thanks adp001, that was useful