Manipulator: run callback when calculating the final matrix
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user