Commit: 43dab7833ab06f5d2939023bee29e999b310310b
Author: Sergey Sharybin
Date:   Thu Aug 27 12:01:20 2015 +0200
Branches: master
https://developer.blender.org/rB43dab7833ab06f5d2939023bee29e999b310310b

OpenSubdiv: Fix crash toggling edit mode with new depsgraph

===================================================================

M       source/blender/blenkernel/intern/scene.c
M       source/blender/depsgraph/DEG_depsgraph.h
M       source/blender/depsgraph/intern/depsgraph_eval.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/scene.c 
b/source/blender/blenkernel/intern/scene.c
index 701483a..9e3af97 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1804,6 +1804,11 @@ void BKE_scene_update_tagged(EvaluationContext 
*eval_ctx, Main *bmain, Scene *sc
        else
 #endif
        {
+#ifdef OPENSUBDIV_GL_WORKAROUND
+               if (DEG_needs_eval(scene->depsgraph)) {
+                       scene_free_unused_opensubdiv_cache(scene);
+               }
+#endif
                DEG_evaluate_on_refresh(eval_ctx, scene->depsgraph, scene);
                /* TODO(sergey): This is to beocme a node in new depsgraph. */
                BKE_mask_update_scene(bmain, scene);
diff --git a/source/blender/depsgraph/DEG_depsgraph.h 
b/source/blender/depsgraph/DEG_depsgraph.h
index b91f99e..a772f4e 100644
--- a/source/blender/depsgraph/DEG_depsgraph.h
+++ b/source/blender/depsgraph/DEG_depsgraph.h
@@ -193,6 +193,8 @@ void DEG_evaluate_on_refresh(struct EvaluationContext 
*eval_ctx,
                              Depsgraph *graph,
                              struct Scene *scene);
 
+bool DEG_needs_eval(Depsgraph *graph);
+
 /* Editors Integration  -------------------------- */
 
 /* Mechanism to allow editors to be informed of depsgraph updates,
diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cc 
b/source/blender/depsgraph/intern/depsgraph_eval.cc
index 0a1563e..e806576 100644
--- a/source/blender/depsgraph/intern/depsgraph_eval.cc
+++ b/source/blender/depsgraph/intern/depsgraph_eval.cc
@@ -392,3 +392,8 @@ void DEG_evaluate_on_framechange(EvaluationContext 
*eval_ctx,
        /* Perform recalculation updates. */
        DEG_evaluate_on_refresh_ex(eval_ctx, graph, layers);
 }
+
+bool DEG_needs_eval(Depsgraph *graph)
+{
+       return graph->entry_tags.size() != 0;
+}

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to