Rigify: generated rig is offset from its object center #70841

Closed
opened 2019-10-15 15:24:01 +02:00 by Damien Picard · 2 comments
Member

System Information
Operating system: GNU/Linux Ubuntu 19.04

Blender Version
Broken: 2.82
Worked: 2.79

Short description of error
When generating a rig with Rigify, if the metarig has any transform, the rig will be offset. The bones are copied in place but the object is created at the origin.
image.png
In this screenshot, the Root bone is the only one created at the origin, the other bones are on the metarig.

Exact steps for others to reproduce the error

  • Add metarig
  • Move it
  • Generate

One possible solution might be to give the metarig’s transforms to the rig:

diff --git a/rigify/generate.py b/rigify/generate.py
index 295c1a50..86510135 100644
--- a/rigify/generate.py
+++ b/rigify/generate.py
@@ -165,8 +165,13 @@ class Generator(base_generate.BaseGenerator):
         # Select the target rig and join
         select_object(context, obj)
 
+        obj_matrix = obj.matrix_world.copy()
+
+        obj.matrix_world = metarig.matrix_world
         bpy.ops.object.join()
 
+        obj.matrix_world = obj_matrix
+
         # Select the generated rig
         select_object(context, obj, deselect_all=True)
**System Information** Operating system: GNU/Linux Ubuntu 19.04 **Blender Version** Broken: 2.82 Worked: 2.79 **Short description of error** When generating a rig with Rigify, if the metarig has any transform, the rig will be offset. The bones are copied in place but the object is created at the origin. ![image.png](https://archive.blender.org/developer/F7820627/image.png) In this screenshot, the Root bone is the only one created at the origin, the other bones are on the metarig. **Exact steps for others to reproduce the error** - Add metarig - Move it - Generate One possible solution might be to give the metarig’s transforms to the rig: ``` diff --git a/rigify/generate.py b/rigify/generate.py index 295c1a50..86510135 100644 --- a/rigify/generate.py +++ b/rigify/generate.py @@ -165,8 +165,13 @@ class Generator(base_generate.BaseGenerator): # Select the target rig and join select_object(context, obj) + obj_matrix = obj.matrix_world.copy() + + obj.matrix_world = metarig.matrix_world bpy.ops.object.join() + obj.matrix_world = obj_matrix + # Select the generated rig select_object(context, obj, deselect_all=True) ```
Author
Member

Added subscriber: @pioverfour

Added subscriber: @pioverfour
Alexander Gavrilov was assigned by Damien Picard 2019-10-15 15:24:55 +02:00

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Milestone
No project
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#70841
No description provided.