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:
authorHans Goudey <h.goudey@me.com>2021-12-02 05:16:18 +0300
committerHans Goudey <h.goudey@me.com>2021-12-02 05:16:18 +0300
commit594656e7a39d3598d7a357511742fb0b001254bc (patch)
tree9f852a7c1569510fcb05c0c0f77de8a69ba03702 /source/blender/draw/intern/draw_cache.c
parent9cec9b4d6e33e2270baa8b94454b16665a8f2f60 (diff)
Fix T93525: Crash with curve/text armature bone gizmo
The problem is that drw_batch_cache_generate_requested_delayed is called on the object, which uses the original object data type to choose which data type to get info for. So for curves and text it uses the incorrect type (not the evaluated mesh like we hardcoded in the armature overlay code). To fix this I hardcoded the "delayed" generation to only use the evaluated mesh. Luckily it wasn't use elsewhere besides this armature overlay system. That seems like the simplest fix for 3.0. A proper solution should rewrite this whole area anyway. Differential Revision: https://developer.blender.org/D13439
Diffstat (limited to 'source/blender/draw/intern/draw_cache.c')
-rw-r--r--source/blender/draw/intern/draw_cache.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c
index 7b66026f7ad..d1b82bab277 100644
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@ -3450,6 +3450,25 @@ void drw_batch_cache_generate_requested(Object *ob)
}
}
+/* Note: Logic here is duplicated from #drw_batch_cache_generate_requested. */
+void drw_batch_cache_generate_requested_evaluated_mesh(Object *ob)
+{
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ const Scene *scene = draw_ctx->scene;
+ const enum eContextObjectMode mode = CTX_data_mode_enum_ex(
+ draw_ctx->object_edit, draw_ctx->obact, draw_ctx->object_mode);
+ const bool is_paint_mode = ELEM(
+ mode, CTX_MODE_SCULPT, CTX_MODE_PAINT_TEXTURE, CTX_MODE_PAINT_VERTEX, CTX_MODE_PAINT_WEIGHT);
+
+ const bool use_hide = ((ob->type == OB_MESH) &&
+ ((is_paint_mode && (ob == draw_ctx->obact) &&
+ DRW_object_use_hide_faces(ob)) ||
+ ((mode == CTX_MODE_EDIT_MESH) && DRW_object_is_in_edit_mode(ob))));
+
+ Mesh *mesh = BKE_object_get_evaluated_mesh(ob);
+ DRW_mesh_batch_cache_create_requested(DST.task_graph, ob, mesh, scene, is_paint_mode, use_hide);
+}
+
void drw_batch_cache_generate_requested_delayed(Object *ob)
{
BLI_gset_add(DST.delayed_extraction, ob);