[Bf-blender-cvs] [027ae0fdef9] blender2.8: Fix sculpt dyntopo undo leaving PBVH at NULL
Campbell Barton
noreply at git.blender.org
Tue May 16 10:46:04 CEST 2017
Commit: 027ae0fdef9292b915ed5a4c9b9fb2a82f6ea8f7
Author: Campbell Barton
Date: Tue May 16 18:38:45 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB027ae0fdef9292b915ed5a4c9b9fb2a82f6ea8f7
Fix sculpt dyntopo undo leaving PBVH at NULL
===================================================================
M source/blender/draw/modes/sculpt_mode.c
===================================================================
diff --git a/source/blender/draw/modes/sculpt_mode.c b/source/blender/draw/modes/sculpt_mode.c
index 5053ea47b06..b55e3236ed9 100644
--- a/source/blender/draw/modes/sculpt_mode.c
+++ b/source/blender/draw/modes/sculpt_mode.c
@@ -195,6 +195,17 @@ static void SCULPT_cache_populate(void *vedata, Object *ob)
if (ob->sculpt && ob == OBACT_NEW) {
PBVH *pbvh = ob->sculpt->pbvh;
+
+ /* XXX, needed for dyntopo-undo (which clears).
+ * probably depsgraph should handlle? in 2.7x getting derived-mesh does this (mesh_build_data) */
+ if (pbvh == NULL) {
+ /* create PBVH immediately (would be created on the fly too,
+ * but this avoids waiting on first stroke) */
+ Scene *scene = draw_ctx->scene;
+
+ BKE_sculpt_update_mesh_elements(scene, scene->toolsettings->sculpt, ob, false, false);
+ }
+
if (pbvh && pbvh_has_mask(pbvh)) {
/* Get geometry cache */
DRWShadingGroup *shgroup = object_is_flat(ob) ? stl->g_data->group_flat : stl->g_data->group_smooth;
More information about the Bf-blender-cvs
mailing list