Skip to content

Commit

Permalink
#41 Fix migrated rigidbodies
Browse files Browse the repository at this point in the history
  • Loading branch information
UuuNyaa committed May 20, 2022
1 parent bb3e67d commit 0f4e1c1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mmd_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
bl_info = {
"name": "mmd_tools",
"author": "sugiany",
"version": (2, 2, 5),
"version": (2, 2, 6),
"blender": (2, 83, 0),
"location": "View3D > Sidebar > MMD Tools Panel",
"description": "Utility tools for MMD model editing. (UuuNyaa's forked version)",
Expand Down
9 changes: 8 additions & 1 deletion mmd_tools/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,8 +966,15 @@ def updateRigid(self, rigid_obj: bpy.types.Object, collision_margin: float):
rigid = rigid_obj.mmd_rigid
rigid_type = int(rigid.type)
relation = rigid_obj.constraints['mmd_tools_rigid_parent']

if relation.target is None:
relation.target = self.armature()

arm = relation.target
bone_name = relation.subtarget
if relation.subtarget not in arm.pose.bones:
bone_name = ''
else:
bone_name = relation.subtarget

if rigid_type == rigid_body.MODE_STATIC:
rb.kinematic = True
Expand Down

0 comments on commit 0f4e1c1

Please sign in to comment.