def SetRestPosePosition(context, armatureObj):
if not armatureObj:
return None
# Force the armature in the rest position (warning: https://developer.blender.org/T24674)
# This should reset bones matrices ok, but for sure it is not resetting the mesh tessfaces
# positions
savedPosePositionAndVisibility = [armatureObj.data.pose_position, armatureObj.hide]
armatureObj.data.pose_position = 'REST'
armatureObj.hide = False
# This should help to recalculate all the mesh vertices, it is needed by decomposeMesh
# and maybe it helps decomposeArmature (but no problem was seen there)
# TODO: find the correct way, for sure it is not this
objects = context.scene.objects
savedObjectActive = objects.active
objects.active = armatureObj
if bpy.ops.object.mode_set.poll():
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
if bpy.ops.object.mode_set.poll():
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
objects.active = savedObjectActive
return savedPosePositionAndVisibility
评论列表
文章目录