Fix T95029: Arrow gizmo always uses normal direction

Bug possibly introduced in {rBc57e4418bb85aec8bd3615fd775b990badb43d30}.

Interestingly, the orientation set before (NORMAL), even different from
the orientation that was actually used, was allowing the use of
"orient_matrix" ("orient_matrix_type" should have been NORMAL in that
case too).

In any case, make sure the "orient_matrix_type" and "orient_type" are the
same so that the "orient_matrix" is used.
This commit is contained in:
Germano Cavalcante 2022-01-18 16:07:08 -03:00
parent 977baeaa26
commit 9506dcf675
Notes: blender-bot 2023-02-14 01:21:16 +01:00
Referenced by issue #95029, Extrude Tool Regression: Arrow gizmo always uses normal direction
1 changed files with 4 additions and 1 deletions

View File

@ -82,6 +82,7 @@ typedef struct GizmoExtrudeGroup {
float orient_matrix[3][3];
bool constraint_axis[3];
float value[4];
int orient_type;
} redo_xform;
/* Depends on object type. */
@ -310,6 +311,7 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup)
RNA_float_get_array(op_xform->ptr, "orient_matrix", &ggd->redo_xform.orient_matrix[0][0]);
RNA_boolean_get_array(op_xform->ptr, "constraint_axis", ggd->redo_xform.constraint_axis);
RNA_float_get_array(op_xform->ptr, "value", ggd->redo_xform.value);
ggd->redo_xform.orient_type = RNA_enum_get(op_xform->ptr, "orient_type");
/* Set properties for redo. */
for (int i = 0; i < 3; i++) {
@ -435,7 +437,8 @@ static void gizmo_mesh_extrude_invoke_prepare(const bContext *UNUSED(C),
if (gz == ggd->adjust[0]) {
RNA_boolean_set_array(&macroptr, "constraint_axis", ggd->redo_xform.constraint_axis);
RNA_float_set_array(&macroptr, "orient_matrix", &ggd->redo_xform.orient_matrix[0][0]);
RNA_enum_set(&macroptr, "orient_type", V3D_ORIENT_NORMAL);
RNA_enum_set(&macroptr, "orient_matrix_type", ggd->redo_xform.orient_type);
RNA_enum_set(&macroptr, "orient_type", ggd->redo_xform.orient_type);
}
RNA_float_set_array(&macroptr, "value", ggd->redo_xform.value);
}