Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-09-08 05:30:36 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-09-08 06:01:46 +0300
commit9189fd643a2e00e164db21b46d637713b7251518 (patch)
treeeb75e0c5647f12d1769cc05d8ef7b15afd6ef31f
parentf7f4c05bbfeec7679e44de2d216a1bb7de3c7749 (diff)
Gizmo: fix extrude depth ordering
-rw-r--r--source/blender/editors/mesh/editmesh_extrude.c18
1 files changed, 18 insertions, 0 deletions
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(