[Bf-blender-cvs] [8b23549d479] blender2.8: Manipulator: run callback when calculating the final matrix
Campbell Barton
noreply at git.blender.org
Wed Aug 30 09:59:42 CEST 2017
Commit: 8b23549d479fab753ca11f4ebde5880c8a209878
Author: Campbell Barton
Date: Wed Aug 30 17:53:32 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB8b23549d479fab753ca11f4ebde5880c8a209878
Manipulator: run callback when calculating the final matrix
===================================================================
M source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c
M source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c
M source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c
M source/blender/windowmanager/manipulators/intern/wm_manipulator.c
===================================================================
diff --git a/source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c
index 5c984de2e27..21ebbba46cf 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c
@@ -184,16 +184,11 @@ static void arrow_draw_intern(ArrowManipulator3D *arrow, const bool select, cons
{
wmManipulator *mpr = &arrow->manipulator;
float color[4];
- float matrix_basis_adjust[4][4];
float matrix_final[4][4];
manipulator_color_get(mpr, highlight, color);
- manipulator_arrow_matrix_basis_get(mpr, matrix_basis_adjust);
- WM_manipulator_calc_matrix_final_params(
- mpr, &((struct WM_ManipulatorMatrixParams) {
- .matrix_basis = matrix_basis_adjust,
- }), matrix_final);
+ WM_manipulator_calc_matrix_final(mpr, matrix_final);
gpuPushMatrix();
gpuMultMatrix(matrix_final);
diff --git a/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c
index 257ccfa88d8..f637b098cca 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c
@@ -96,7 +96,9 @@ typedef struct DialInteraction {
#define DIAL_WIDTH 1.0f
#define DIAL_RESOLUTION 32
-
+/**
+ * We can't use this for the #wmManipulatorType.matrix_basis_get callback, it conflicts with depth picking.
+ */
static void dial_calc_matrix(const wmManipulator *mpr, float mat[4][4])
{
float rot[3][3];
diff --git a/source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c
index 37ad31db642..fd1f5a0cf25 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c
@@ -175,15 +175,7 @@ static void grab3d_draw_intern(
float matrix_align[4][4];
manipulator_color_get(mpr, highlight, color);
-
- {
- float matrix_basis_adjust[4][4];
- manipulator_grab_matrix_basis_get(mpr, matrix_basis_adjust);
- WM_manipulator_calc_matrix_final_params(
- mpr, &((struct WM_ManipulatorMatrixParams) {
- .matrix_basis = matrix_basis_adjust,
- }), matrix_final);
- }
+ WM_manipulator_calc_matrix_final(mpr, matrix_final);
gpuPushMatrix();
gpuMultMatrix(matrix_final);
@@ -293,14 +285,7 @@ static int manipulator_grab_invoke(
}
#endif
- {
- float matrix_basis_adjust[4][4];
- manipulator_grab_matrix_basis_get(mpr, matrix_basis_adjust);
- WM_manipulator_calc_matrix_final_params(
- mpr, &((struct WM_ManipulatorMatrixParams) {
- .matrix_basis = matrix_basis_adjust,
- }), inter->init_matrix_final);
- }
+ WM_manipulator_calc_matrix_final(mpr, inter->init_matrix_final);
mpr->interaction_data = inter;
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
index ee7c10aa50b..5693c4854c9 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
@@ -541,8 +541,12 @@ void WM_manipulator_calc_matrix_final_params(
const float *scale_final = params->scale_final ? params->scale_final : &mpr->scale_final;
float final_matrix[4][4];
-
- copy_m4_m4(final_matrix, matrix_basis);
+ if (params->matrix_basis == NULL && mpr->type->matrix_basis_get) {
+ mpr->type->matrix_basis_get(mpr, final_matrix);
+ }
+ else {
+ copy_m4_m4(final_matrix, matrix_basis);
+ }
if (mpr->flag & WM_MANIPULATOR_DRAW_OFFSET_SCALE) {
mul_mat3_m4_fl(final_matrix, *scale_final);
@@ -561,10 +565,10 @@ void WM_manipulator_calc_matrix_final(const wmManipulator *mpr, float r_mat[4][4
WM_manipulator_calc_matrix_final_params(
mpr,
&((struct WM_ManipulatorMatrixParams) {
- .matrix_space = mpr->matrix_space,
- .matrix_basis = mpr->matrix_basis,
- .matrix_offset = mpr->matrix_offset,
- .scale_final = &mpr->scale_final,
+ .matrix_space = NULL,
+ .matrix_basis = NULL,
+ .matrix_offset = NULL,
+ .scale_final = NULL,
}), r_mat
);
}
More information about the Bf-blender-cvs
mailing list