[Bf-blender-cvs] [9189fd643a2] blender2.8: Gizmo: fix extrude depth ordering
Campbell Barton
noreply at git.blender.org
Sat Sep 8 04:54:05 CEST 2018
Commit: 9189fd643a2e00e164db21b46d637713b7251518
Author: Campbell Barton
Date: Sat Sep 8 12:30:36 2018 +1000
Branches: blender2.8
https://developer.blender.org/rB9189fd643a2e00e164db21b46d637713b7251518
Gizmo: fix extrude depth ordering
===================================================================
M source/blender/editors/mesh/editmesh_extrude.c
===================================================================
diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c
index e763a14f3d8..6bcf91038e9 100644
--- a/source/blender/editors/mesh/editmesh_extrude.c
+++ b/source/blender/editors/mesh/editmesh_extrude.c
@@ -623,6 +623,15 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup)
}
}
+static int gizmo_cmp_temp_f(const void *gz_a_ptr, const void *gz_b_ptr)
+{
+ const wmGizmo *gz_a = gz_a_ptr;
+ const wmGizmo *gz_b = gz_b_ptr;
+ if (gz_a->temp.f < gz_b->temp.f) return -1;
+ else if (gz_a->temp.f > gz_b->temp.f) return 1;
+ else return 0;
+}
+
static void gizmo_mesh_extrude_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
{
GizmoExtrudeGroup *man = gzgroup->customdata;
@@ -637,6 +646,15 @@ static void gizmo_mesh_extrude_draw_prepare(const bContext *C, wmGizmoGroup *gzg
break;
}
}
+
+ /* Basic ordering for drawing only. */
+ {
+ RegionView3D *rv3d = CTX_wm_region_view3d(C);
+ LISTBASE_FOREACH (wmGizmo *, gz, &gzgroup->gizmos) {
+ gz->temp.f = dot_v3v3(rv3d->viewinv[2], gz->matrix_offset[3]);
+ }
+ BLI_listbase_sort(&gzgroup->gizmos, gizmo_cmp_temp_f);
+ }
}
static void gizmo_mesh_extrude_message_subscribe(
More information about the Bf-blender-cvs
mailing list