0
$\begingroup$

I am trying to capture the mesh of an object modified by an armature. Below is an image of the object before being modified by the armature. The object is parented to the armature using "Armature Deform with Automatic Weights". enter image description here

I'm using this code below that uses a bmesh to try and capture the new mesh of the transformed object.



import bpy
import bmesh

context = bpy.context
ob = context.object
dg = context.evaluated_depsgraph_get()

bm = bmesh.new()
bm.from_object(ob, dg)

# Create new mesh 
me = bpy.data.meshes.new('myMesh') 

# Create new object
obj = bpy.data.objects.new('myObject', me)   

#ob.location = origin
ob.show_name = True

# Link object to scene
bpy.context.collection.objects.link(obj)

# Finish up, write the bmesh back to the mesh
bm.to_mesh(me)

For example below is an image of the transformed object and the new object using the transformed mesh. The new object is lying at the foot of the transformed object. I expected both objects to look the same. What am I missing here? enter image description here

enter image description here

$\endgroup$
1
  • $\begingroup$ I tested a bit, and it seems like the vertices of the mesh are the same before and after moving the bone. So the pose bones haven't a real effect on the mesh of the object, just visual. $\endgroup$ – Rivin Dec 18 '20 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.