Fix scale-cage editmode pivot point
authorCampbell Barton <ideasman42@gmail.com>
Tue, 11 Sep 2018 21:27:17 +0000 (07:27 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 11 Sep 2018 21:27:48 +0000 (07:27 +1000)
source/blender/editors/transform/transform_gizmo_3d.c

index f3509f62faa1083146ce71f6864f5f0cadf48ae5..6cfac524ce48ea392b81c986c845344cfafb91fc 100644 (file)
@@ -1805,6 +1805,9 @@ static void WIDGETGROUP_xform_cage_refresh(const bContext *C, wmGizmoGroup *gzgr
                mid_v3_v3v3(gz->matrix_offset[3], rv3d->tw_axis_max, rv3d->tw_axis_min);
                mul_m3_v3(rv3d->tw_axis_matrix, gz->matrix_offset[3]);
 
+               float matrix_offset_global[4][4];
+               mul_m4_m4m4(matrix_offset_global, gz->matrix_space, gz->matrix_offset);
+
                PropertyRNA *prop_center_override = NULL;
                float center[3];
                float center_global[3];
@@ -1819,7 +1822,7 @@ static void WIDGETGROUP_xform_cage_refresh(const bContext *C, wmGizmoGroup *gzgr
                                        if (prop_center_override == NULL) {
                                                prop_center_override = RNA_struct_find_property(&mpop->ptr, "center_override");
                                        }
-                                       mul_v3_m4v3(center_global, gz->matrix_offset, center);
+                                       mul_v3_m4v3(center_global, matrix_offset_global, center);
                                        RNA_property_float_set_array(&mpop->ptr, prop_center_override, center_global);
                                        i++;
                                }