[Bf-blender-cvs] [63150511a29] blender2.8: Gizmo: use Y-axis for armature extrude on normal
Campbell Barton
noreply at git.blender.org
Wed Nov 21 02:15:50 CET 2018
Commit: 63150511a29edda0e7c9f98c5c32d14e9d488c38
Author: Campbell Barton
Date: Wed Nov 21 12:12:20 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB63150511a29edda0e7c9f98c5c32d14e9d488c38
Gizmo: use Y-axis for armature extrude on normal
For bones it's useful to extrude a bone aligned to the existing bone.
===================================================================
M source/blender/editors/transform/transform_gizmo_extrude_3d.c
===================================================================
diff --git a/source/blender/editors/transform/transform_gizmo_extrude_3d.c b/source/blender/editors/transform/transform_gizmo_extrude_3d.c
index b9693669d18..2281bd91569 100644
--- a/source/blender/editors/transform/transform_gizmo_extrude_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_extrude_3d.c
@@ -77,6 +77,9 @@ typedef struct GizmoExtrudeGroup {
struct wmGizmo *adjust;
int adjust_axis;
+ /* Depends on object type. */
+ int normal_axis;
+
struct {
float normal_mat3[3][3]; /* use Z axis for normal. */
int orientation_type;
@@ -136,12 +139,15 @@ static void gizmo_mesh_extrude_setup(const bContext *C, wmGizmoGroup *gzgroup)
const char *op_idname = NULL;
if (obedit->type == OB_MESH) {
op_idname = "MESH_OT_extrude_context_move";
+ ggd->normal_axis = 2;
}
else if (obedit->type == OB_ARMATURE) {
op_idname = "ARMATURE_OT_extrude_move";
+ ggd->normal_axis = 1;
}
else if (obedit->type == OB_CURVE) {
op_idname = "CURVE_OT_extrude_move";
+ ggd->normal_axis = 2;
}
else {
BLI_assert(0);
@@ -168,7 +174,7 @@ static void gizmo_mesh_extrude_setup(const bContext *C, wmGizmoGroup *gzgroup)
PointerRNA *ptr = WM_gizmo_operator_set(ggd->invoke_xyz_no[i], 0, ggd->ot_extrude, NULL);
{
bool constraint[3] = {0, 0, 0};
- constraint[MIN2(i, 2)] = 1;
+ constraint[(i < 3) ? i : ggd->normal_axis] = true;
PointerRNA macroptr = RNA_pointer_get(ptr, "TRANSFORM_OT_translate");
RNA_boolean_set(¯optr, "release_confirm", true);
RNA_boolean_set_array(¯optr, "constraint_axis", constraint);
@@ -245,7 +251,7 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup)
/* Offset the add icon. */
mul_v3_v3fl(
ggd->invoke_xyz_no[3]->matrix_offset[3],
- ggd->data.normal_mat3[2],
+ ggd->data.normal_mat3[ggd->normal_axis],
(extrude_arrow_normal_axis_scale * extrude_button_offset_scale) / extrude_button_scale);
/* Adjust current operator. */
More information about the Bf-blender-cvs
mailing list