Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'rigify/generate.py')
-rw-r--r--rigify/generate.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/rigify/generate.py b/rigify/generate.py
index 01e5de28..42523490 100644
--- a/rigify/generate.py
+++ b/rigify/generate.py
@@ -134,6 +134,11 @@ def generate_rig(context, metarig):
wgts_group_name = "WGTS_" + obj.name
+ # Get parented objects to restore later
+ childs = {} # {object: bone}
+ for child in obj.children:
+ childs[child] = child.parent_bone
+
# Remove all bones from the generated rig armature.
bpy.ops.object.mode_set(mode='EDIT')
for bone in obj.data.edit_bones:
@@ -526,6 +531,12 @@ def generate_rig(context, metarig):
metarig.data.pose_position = rest_backup
obj.data.pose_position = 'POSE'
+ # Restore parent to bones
+ for child, sub_parent in childs.items():
+ if sub_parent in obj.pose.bones:
+ mat = child.matrix_world.copy()
+ child.parent_bone = sub_parent
+ child.matrix_world = mat
def create_selection_sets(obj, metarig):