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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-11-01 06:15:33 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-11-01 09:16:45 +0300
commit346a812d7e1d15ad90bd568b181139929d4df50b (patch)
treeec6061bcc6a172d601f034601d345c37780984c3 /source/blender/editors
parent1e749d0602700f175d70eac75f510512fc3b8b42 (diff)
Fix scale cage gizmo in pose-mode
The active objects matrix was ignored when calculating the cage.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/ED_transform.h7
-rw-r--r--source/blender/editors/transform/transform_gizmo_3d.c19
2 files changed, 19 insertions, 7 deletions
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index bedd0e2fa35..b132e559baa 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -181,6 +181,13 @@ struct TransformBounds {
/* Normalized axis */
float axis[3][3];
float axis_min[3], axis_max[3];
+
+ /**
+ * When #TransformCalcParams.use_local_axis is used.
+ * This is the local space matrix the caller may need to access.
+ */
+ bool use_matrix_space;
+ float matrix_space[4][4];
};
struct TransformCalcParams {
diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c
index 466c4202dbd..e79fdc4890a 100644
--- a/source/blender/editors/transform/transform_gizmo_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_3d.c
@@ -667,6 +667,8 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
}
}
+ tbounds->use_matrix_space = false;
+
/* transform widget matrix */
unit_m4(rv3d->twmat);
@@ -689,13 +691,16 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
reset_tw_center(tbounds);
copy_m3_m4(tbounds->axis, rv3d->twmat);
- if (params->use_local_axis && (ob && ob->mode & OB_MODE_EDIT)) {
+ if (params->use_local_axis && (ob && ob->mode & (OB_MODE_EDIT | OB_MODE_POSE))) {
float diff_mat[3][3];
copy_m3_m4(diff_mat, ob->obmat);
normalize_m3(diff_mat);
invert_m3(diff_mat);
mul_m3_m3m3(tbounds->axis, tbounds->axis, diff_mat);
normalize_m3(tbounds->axis);
+
+ tbounds->use_matrix_space = true;
+ copy_m4_m4(tbounds->matrix_space, ob->obmat);
}
if (is_gp_edit) {
@@ -970,8 +975,10 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
if (totsel_iter) {
float mat_local[4][4];
- if (use_mat_local) {
- mul_m4_m4m4(mat_local, ob->imat, ob_iter->obmat);
+ if (params->use_local_axis) {
+ if (use_mat_local) {
+ mul_m4_m4m4(mat_local, ob->imat, ob_iter->obmat);
+ }
}
/* use channels to get stats */
@@ -2117,10 +2124,8 @@ static void WIDGETGROUP_xform_cage_refresh(const bContext *C, wmGizmoGroup *gzgr
WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, true);
}
else {
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Object *ob = OBACT(view_layer);
- if (ob && ob->mode & OB_MODE_EDIT) {
- copy_m4_m4(gz->matrix_space, ob->obmat);
+ if (tbounds.use_matrix_space) {
+ copy_m4_m4(gz->matrix_space, tbounds.matrix_space);
}
else {
unit_m4(gz->matrix_space);