3D View: draw edit-text selection on-top (x-ray)
authorCampbell Barton <ideasman42@gmail.com>
Tue, 18 Jun 2019 22:00:47 +0000 (08:00 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 18 Jun 2019 22:05:59 +0000 (08:05 +1000)
This changes behavior from 2.7x, where selection & cursor could be
occluded by other objects.

Doing this without z-fighting in 2.8x isn't so simple because drawing
the text geometry is separated from edit-selection.

Change behavior since this doesn't seem like an important difference.

Fixes assert drawing text edit mode.

source/blender/draw/modes/edit_text_mode.c

index d1d17f2..03f26e8 100644 (file)
@@ -166,18 +166,17 @@ static void EDIT_TEXT_cache_init(void *vedata)
         "Font Wire", DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL);
     stl->g_data->wire_shgrp = DRW_shgroup_create(e_data.wire_sh, psl->wire_pass);
 
-    psl->overlay_select_pass = DRW_pass_create("Font Select",
-                                               DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH);
+    /* Show selection & cursor on-top of everything (x-ray). */
+
+    psl->overlay_select_pass = DRW_pass_create("Font Select", DRW_STATE_WRITE_COLOR);
     stl->g_data->overlay_select_shgrp = DRW_shgroup_create(e_data.overlay_select_sh,
                                                            psl->overlay_select_pass);
 
-    psl->overlay_cursor_pass = DRW_pass_create("Font Cursor",
-                                               DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH);
+    psl->overlay_cursor_pass = DRW_pass_create("Font Cursor", DRW_STATE_WRITE_COLOR);
     stl->g_data->overlay_cursor_shgrp = DRW_shgroup_create(e_data.overlay_cursor_sh,
                                                            psl->overlay_cursor_pass);
 
-    psl->text_box_pass = DRW_pass_create("Font Text Boxes",
-                                         DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH);
+    psl->text_box_pass = DRW_pass_create("Font Text Boxes", DRW_STATE_WRITE_COLOR);
     stl->g_data->box_shgrp = buffer_dynlines_dashed_uniform_color(
         psl->text_box_pass, G_draw.block.colorWire, draw_ctx->sh_cfg);
     stl->g_data->box_active_shgrp = buffer_dynlines_dashed_uniform_color(