Cleanup: minor adjustment to gizmo extrude setup

No need to access both edit & active object.
This commit is contained in:
Campbell Barton 2019-03-05 11:32:46 +11:00
parent 90afe39181
commit 1df6a98b17
Notes: blender-bot 2023-02-14 06:00:44 +01:00
Referenced by issue #62239, Entering Particle Edit Mode crashes blender.
Referenced by issue #62232, Crash moving around the veiwport in wireframe
Referenced by issue #62202, Can't Select Strand Points in Hair System while in Particle Edit Mode
1 changed files with 5 additions and 6 deletions

View File

@ -145,23 +145,22 @@ static void gizmo_mesh_extrude_setup(const bContext *C, wmGizmoGroup *gzgroup)
}
{
const Object *obedit = CTX_data_edit_object(C);
const char *op_idname = NULL;
/* grease pencil does not use obedit */
/* GPXX: Remove if OB_MODE_EDIT_GPENCIL is merged with OB_MODE_EDIT */
const Object *ob = CTX_data_active_object(C);
if ((ob) && (ob->type == OB_GPENCIL)) {
const Object *obact = CTX_data_active_object(C);
if (obact->type == OB_GPENCIL) {
op_idname = "GPENCIL_OT_extrude_move";
}
else if (obedit->type == OB_MESH) {
else if (obact->type == OB_MESH) {
op_idname = "MESH_OT_extrude_context_move";
ggd->normal_axis = 2;
}
else if (obedit->type == OB_ARMATURE) {
else if (obact->type == OB_ARMATURE) {
op_idname = "ARMATURE_OT_extrude_move";
ggd->normal_axis = 1;
}
else if (obedit->type == OB_CURVE) {
else if (obact->type == OB_CURVE) {
op_idname = "CURVE_OT_extrude_move";
ggd->normal_axis = 2;
}