Commit: d5289f9d80291e28111e0d5dcd5f3c290f20a4af
Author: Campbell Barton
Date:   Thu Aug 10 14:03:37 2017 +1000
Branches: blender2.8
https://developer.blender.org/rBd5289f9d80291e28111e0d5dcd5f3c290f20a4af

Manipulator: apply cage2d scale before offset

Needed when offset takes factor into account.

===================================================================

M       
source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c

===================================================================

diff --git 
a/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c
 
b/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c
index 11e9982fede..99f252d1ec7 100644
--- 
a/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c
+++ 
b/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c
@@ -576,11 +576,6 @@ static void manipulator_rect_transform_modal(
 
        wmManipulatorProperty *mpr_prop;
 
-       mpr_prop = WM_manipulator_target_property_find(mpr, "offset");
-       if (mpr_prop->type != NULL) {
-               WM_manipulator_target_property_value_set_array(C, mpr, 
mpr_prop, offset);
-       }
-
        mpr_prop = WM_manipulator_target_property_find(mpr, "scale");
        if (mpr_prop->type != NULL) {
                if (transform_flag & 
ED_MANIPULATOR_RECT_TRANSFORM_FLAG_SCALE_UNIFORM) {
@@ -597,21 +592,26 @@ static void manipulator_rect_transform_modal(
                }
        }
 
+       mpr_prop = WM_manipulator_target_property_find(mpr, "offset");
+       if (mpr_prop->type != NULL) {
+               WM_manipulator_target_property_value_set_array(C, mpr, 
mpr_prop, offset);
+       }
+
        /* tag the region for redraw */
        ED_region_tag_redraw(CTX_wm_region(C));
 }
 
 static void manipulator_rect_transform_property_update(wmManipulator *mpr, 
wmManipulatorProperty *mpr_prop)
 {
-       if (STREQ(mpr_prop->type->idname, "offset")) {
-               manipulator_rect_transform_get_prop_value(mpr, mpr_prop, 
mpr->matrix_offset[3]);
-       }
-       else if (STREQ(mpr_prop->type->idname, "scale")) {
+       if (STREQ(mpr_prop->type->idname, "scale")) {
                float scale[2];
                manipulator_rect_transform_get_prop_value(mpr, mpr_prop, scale);
                mpr->matrix_offset[0][0] = scale[0];
                mpr->matrix_offset[1][1] = scale[1];
        }
+       else if (STREQ(mpr_prop->type->idname, "offset")) {
+               manipulator_rect_transform_get_prop_value(mpr, mpr_prop, 
mpr->matrix_offset[3]);
+       }
        else {
                BLI_assert(0);
        }
@@ -627,11 +627,6 @@ static void manipulator_rect_transform_exit(bContext *C, 
wmManipulator *mpr, con
        wmManipulatorProperty *mpr_prop;
 
        /* reset properties */
-       mpr_prop = WM_manipulator_target_property_find(mpr, "offset");
-       if (mpr_prop->type != NULL) {
-               WM_manipulator_target_property_value_set_array(C, mpr, 
mpr_prop, data->orig_matrix_offset[3]);
-       }
-
        mpr_prop = WM_manipulator_target_property_find(mpr, "scale");
        if (mpr_prop->type != NULL) {
                const float orig_scale[2] = {data->orig_matrix_offset[0][0], 
data->orig_matrix_offset[1][1]};
@@ -649,6 +644,11 @@ static void manipulator_rect_transform_exit(bContext *C, 
wmManipulator *mpr, con
                }
        }
 
+       mpr_prop = WM_manipulator_target_property_find(mpr, "offset");
+       if (mpr_prop->type != NULL) {
+               WM_manipulator_target_property_value_set_array(C, mpr, 
mpr_prop, data->orig_matrix_offset[3]);
+       }
+
        copy_m4_m4(mpr->matrix_offset, data->orig_matrix_offset);
 }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to