Bugfix #32987
authorTon Roosendaal <ton@blender.org>
Sun, 4 Nov 2012 12:33:58 +0000 (12:33 +0000)
committerTon Roosendaal <ton@blender.org>
Sun, 4 Nov 2012 12:33:58 +0000 (12:33 +0000)
"Set origin to cursor" tool failed for parented/rotated objects.
Matrix mashup.

Thanks to Ben Batt for the fix!

source/blender/editors/object/object_transform.c

index 4476296866e941b91d42b4e9d4777ccd21d50b85..900bf57b509060db986a94e1995bbaa55b5bca6a 100644 (file)
@@ -903,11 +903,16 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
                        /* offset other selected objects */
                        if (do_inverse_offset && (centermode != GEOMETRY_TO_ORIGIN)) {
                                CollectionPointerLink *ctx_link_other;
+                               float obmat[4][4];
 
                                /* was the object data modified
                                 * note: the functions above must set 'cent' */
+
+                               /* convert the offset to parent space */
+                               BKE_object_to_mat4(ob, obmat);
                                copy_v3_v3(centn, cent);
-                               mul_mat3_m4_v3(ob->obmat, centn); /* ommit translation part */
+                               mul_mat3_m4_v3(obmat, centn); /* omit translation part */
+
                                add_v3_v3(ob->loc, centn);
 
                                BKE_object_where_is_calc(scene, ob);