Fix T59273: Text object disappears when Fill Mode is set to None
authorJacques Lucke <mail@jlucke.com>
Wed, 19 Dec 2018 14:53:29 +0000 (15:53 +0100)
committerJacques Lucke <mail@jlucke.com>
Wed, 19 Dec 2018 14:56:15 +0000 (15:56 +0100)
Reviewers: fclem

Differential Revision: https://developer.blender.org/D4103

source/blender/draw/modes/edit_text_mode.c
source/blender/draw/modes/object_mode.c

index cb87a015717893bdbff2122951ef55e3ab3a7068..40cbd876473922e563e98f812f044f44489985ca 100644 (file)
@@ -337,7 +337,8 @@ static void EDIT_TEXT_cache_populate(void *vedata, Object *ob)
                        /* Get geometry cache */
                        struct GPUBatch *geom;
 
-                       if (cu->flag & CU_FAST) {
+                       bool has_surface = (cu->flag & (CU_FRONT | CU_BACK)) || cu->ext1 != 0.0f || cu->ext2 != 0.0f;
+                       if ((cu->flag & CU_FAST) || !has_surface) {
                                geom = DRW_cache_text_edge_wire_get(ob);
                                if (geom) {
                                        DRW_shgroup_call_add(stl->g_data->wire_shgrp, geom, ob->obmat);
index c51498b4368cf92c88762ee6b4bdc6cb5512215a..91e41f75bedf4281299ab80d1ddd5208f63516b3 100644 (file)
@@ -2809,6 +2809,25 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
                        }
                        break;
                }
+               case OB_FONT:
+               {
+                       if (hide_object_extra) {
+                               break;
+                       }
+                       Curve *cu = (Curve *)ob->data;
+                       bool has_surface = (cu->flag & (CU_FRONT | CU_BACK)) || cu->ext1 != 0.0f || cu->ext2 != 0.0f;
+                       if (!has_surface) {
+                               struct GPUBatch *geom = DRW_cache_text_edge_wire_get(ob);
+                               if (geom) {
+                                       if (theme_id == TH_UNDEFINED) {
+                                               theme_id = DRW_object_wire_theme_get(ob, view_layer, NULL);
+                                       }
+                                       DRWShadingGroup *shgroup = shgroup_theme_id_to_wire_or(sgl, theme_id, sgl->wire);
+                                       DRW_shgroup_call_object_add(shgroup, geom, ob);
+                               }
+                       }
+                       break;
+               }
                default:
                        break;
        }