Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)
After the above procedure, there are no more individual body parts. The geometry is baked together and is a single, solid object (a "Prop").
Unlike most other programs, a figure in Poser is not one continuous mesh but is made up of various body parts that are handled so that the whole thing looks like one solid figure.
So if you want to use what you've produced as a Poser figure again, you first have to disassemble it and tell Poser which parts of the prop belong to which "body part".
Thank you for your reply.
I was able to understand.
If I import the model expoted obj model again, the model will be treated as props.
I noticed that this prop contains a body part in a group.
#test_model.obj imported
actor = scene.Actor("test_model")
actGeom = actor.Geometry()
print(actGeom.Groups())
----result----
['hip', 'abdomen', 'chest', 'lThigh', 'lShin', 'lFoot', 'neck', 'head', 'lCollar', 'lShldr', 'lForeArm', 'lHand', ' rThigh', 'rShin', 'rFoot', 'rCollar', 'rShldr', 'rForeArm', 'rHand']
What I want to do now is get the coordinates of just the "hip" part, for example. (act Geom.Vertices())
Is it possible to select only one part in the group and get the vertex coordinates limited to that part?
Which method will be used?
Thank you all for your kindness.
What you see there are polygon groups. These groups were created when you exported your figure. That's why they have the same name as the body parts. From these polygon groups you can actually restore the figure (at least vertices and polygons in the right order).
To get the vertices you are interested in, you have to analyze the polygons and extract the data you need from them. Poser Python has a few commands for this:
Example:
geom = poser.Scene().CurrentActor().Geometry()
polys = geom.Polygons()
bodypart_name = "chest"
for poly in polys: # type: poser.PolygonType
if poly.InGroup(bodypart_name):
for vert in poly.Vertices(): # type: poser.VertexType
print(vert.X(), vert.Y(), vert.Z())
"poly.InGroup(<str>)" tells you if the queried polygon belongs to the group you are looking for.
"poly.Vertices()" returns a list of Poser's vertex objects (poser.VertexType). A Poser vertex knows X(), Y() and Z() to query as well as the corresponding "set" functions (SetX(), SetY(), SetZ()).
Another example:
sets = geom.Sets()
vertices = list()
for poly in geom.Polygons(): # type: poser.PolygonType
if poly.InGroup(bodypart_name):
index_start = poly.Start()
index_end = poly.Start() + poly.NumVertices()
vertices.append(sets[index_start:index_end])
Here the indices are queried into the geometry's vertex array and stored in the "vertices" list. This can only be done using the "sets" (geom.Sets()), which provide pointers into the vertex array.
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.
Hello.
https://www.renderosity.com/forums/threads/2972020/reduce-the-number-of-meshes#msg4441239
I was taught how to output an obj file with body part names etc. at this URL.
I don't know how to select this body part from python after importing this obj file. .
Could you tell me how to realize it from python? (For example, which method should be used, etc.)
Thank you.