Commit: 5dbd47c7e93a8bedc22472988ef12b11f786b008
Author: Campbell Barton
Date:   Mon Feb 5 18:12:11 2018 +1100
Branches: temp-workspace-object-mode-removal
https://developer.blender.org/rB5dbd47c7e93a8bedc22472988ef12b11f786b008

Merge branch '28' into temp-workspace-object-mode-removal

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



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

diff --cc source/blender/editors/util/ed_util.c
index 61c613221b1,8973c96c438..bbf5f2064fd
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@@ -181,22 -174,26 +181,26 @@@ bool ED_editors_flush_edits(const bCont
         * exiting we might not have a context for edit object and multiple 
sculpt
         * objects can exist at the same time */
        for (ob = bmain->object.first; ob; ob = ob->id.next) {
 -              if (ob->mode & OB_MODE_SCULPT) {
 +              if (eval_ctx.object_mode & OB_MODE_SCULPT) {
-                       /* flush multires changes (for sculpt) */
-                       multires_force_update(ob);
-                       has_edited = true;
- 
-                       if (for_render) {
-                               /* flush changes from dynamic topology sculpt */
-                               BKE_sculptsession_bm_to_me_for_render(ob);
-                       }
-                       else {
-                               /* Set reorder=false so that saving the file 
doesn't reorder
-                                * the BMesh's elements */
-                               BKE_sculptsession_bm_to_me(ob, false);
+                       /* Don't allow flushing while in the middle of a stroke 
(frees data in use).
+                        * Auto-save prevents this from happening but scripts 
may cause a flush on saving: T53986. */
+                       if ((ob->sculpt && ob->sculpt->cache) == 0) {
+                               /* flush multires changes (for sculpt) */
+                               multires_force_update(ob);
+                               has_edited = true;
+ 
+                               if (for_render) {
+                                       /* flush changes from dynamic topology 
sculpt */
+                                       
BKE_sculptsession_bm_to_me_for_render(ob);
+                               }
+                               else {
+                                       /* Set reorder=false so that saving the 
file doesn't reorder
+                                        * the BMesh's elements */
+                                       BKE_sculptsession_bm_to_me(ob, false);
+                               }
                        }
                }
 -              else if (ob->mode & OB_MODE_EDIT) {
 +              else if (eval_ctx.object_mode & OB_MODE_EDIT) {
                        /* get editmode results */
                        has_edited = true;
                        ED_object_editmode_load(ob);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to