Fix T46471: Sculpt strokes doesn't mark file as modified
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 27 Oct 2015 23:10:00 +0000 (04:10 +0500)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 27 Oct 2015 23:10:00 +0000 (04:10 +0500)
source/blender/editors/sculpt_paint/paint_hide.c
source/blender/editors/sculpt_paint/paint_mask.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/sculpt_paint/sculpt_intern.h
source/blender/editors/sculpt_paint/sculpt_undo.c
source/blender/editors/util/undo.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_files.c

index 2f1d4cd4194814a63f4781d7f9b37068802b884e..5af6792f10f574f45fdf3d3e18132eb81c035337 100644 (file)
@@ -417,7 +417,7 @@ static int hide_show_exec(bContext *C, wmOperator *op)
                MEM_freeN(nodes);
        
        /* end undo */
-       sculpt_undo_push_end();
+       sculpt_undo_push_end(C);
 
        /* ensure that edges and faces get hidden as well (not used by
         * sculpt but it looks wrong when entering editmode otherwise) */
index 118f3a7571f2da09ad05cfcffaff827a223a9987..2f6314685e044f96cad9e28fead0f32b1c9ef43f 100644 (file)
@@ -133,7 +133,7 @@ static int mask_flood_fill_exec(bContext *C, wmOperator *op)
        if (multires)
                multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);
 
-       sculpt_undo_push_end();
+       sculpt_undo_push_end(C);
 
        if (nodes)
                MEM_freeN(nodes);
@@ -265,7 +265,7 @@ int ED_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, const rcti *r
        if (multires)
                multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);
 
-       sculpt_undo_push_end();
+       sculpt_undo_push_end(C);
 
        ED_region_tag_redraw(ar);
 
@@ -420,7 +420,7 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
                if (multires)
                        multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);
 
-               sculpt_undo_push_end();
+               sculpt_undo_push_end(C);
 
                ED_region_tag_redraw(vc.ar);
                MEM_freeN((void *)mcords);
index 07511e1924ece42d51530504fd64a98325c2d98f..81c158aebf8d6066de77ca6e385fb2b53234987f 100644 (file)
@@ -4522,7 +4522,7 @@ static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(str
                sculpt_cache_free(ss->cache);
                ss->cache = NULL;
 
-               sculpt_undo_push_end();
+               sculpt_undo_push_end(C);
 
                BKE_pbvh_update(ss->pbvh, PBVH_UpdateOriginalBB, NULL);
                
@@ -4846,7 +4846,7 @@ static int sculpt_dynamic_topology_toggle_exec(bContext *C, wmOperator *UNUSED(o
                sculpt_dynamic_topology_enable(C);
                sculpt_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_BEGIN);
        }
-       sculpt_undo_push_end();
+       sculpt_undo_push_end(C);
 
        return OPERATOR_FINISHED;
 }
@@ -5008,7 +5008,7 @@ static int sculpt_symmetrize_exec(bContext *C, wmOperator *UNUSED(op))
 
        /* Finish undo */
        BM_log_all_added(ss->bm, ss->bm_log);
-       sculpt_undo_push_end();
+       sculpt_undo_push_end(C);
 
        /* Redraw */
        sculpt_pbvh_clear(ob);
@@ -5216,7 +5216,7 @@ static int sculpt_detail_flood_fill_exec(bContext *C, wmOperator *UNUSED(op))
        }
 
        MEM_freeN(nodes);
-       sculpt_undo_push_end();
+       sculpt_undo_push_end(C);
 
        /* force rebuild of pbvh for better BB placement */
        sculpt_pbvh_clear(ob);
index 8f1a4655c37ea9d6a881f2522cac340ea2ba531d..51af8788e60629a723d48bfa789be38cbbac14a8 100644 (file)
@@ -118,7 +118,7 @@ typedef struct SculptUndoNode {
 SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node, SculptUndoType type);
 SculptUndoNode *sculpt_undo_get_node(PBVHNode *node);
 void sculpt_undo_push_begin(const char *name);
-void sculpt_undo_push_end(void);
+void sculpt_undo_push_end(const struct bContext *C);
 
 void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3]);
 
index 1f1be51b9a6cffc54912de0642eb9b2a161263b9..28fe526e9520410e27c6dc800f73591f56e7f2cf 100644 (file)
@@ -884,7 +884,7 @@ void sculpt_undo_push_begin(const char *name)
                                 sculpt_undo_restore, sculpt_undo_free, sculpt_undo_cleanup);
 }
 
-void sculpt_undo_push_end(void)
+void sculpt_undo_push_end(const bContext *C)
 {
        ListBase *lb = undo_paint_push_get_list(UNDO_PAINT_MESH);
        SculptUndoNode *unode;
@@ -901,4 +901,6 @@ void sculpt_undo_push_end(void)
        }
 
        ED_undo_paint_push_end(UNDO_PAINT_MESH);
+
+       WM_file_tag_modified(C);
 }
index cd68df52ed47bc8ca29d6b4ecf1b6132187f3a85..483bb88b91c489e5b326a873e37986a044b423cc 100644 (file)
@@ -111,11 +111,7 @@ void ED_undo_push(bContext *C, const char *str)
                BKE_undo_write(C, str);
        }
 
-       if (wm->file_saved) {
-               wm->file_saved = 0;
-               /* notifier that data changed, for save-over warning or header */
-               WM_event_add_notifier(C, NC_WM | ND_DATACHANGED, NULL);
-       }
+       WM_file_tag_modified(C);
 }
 
 /* note: also check undo_history_exec() in bottom if you change notifiers */
index 11407678e53ab0b886cf56055a55742507af6806..ca658632bbbd368ea04e3266196ffdb80d345186 100644 (file)
@@ -112,6 +112,7 @@ void                WM_file_autoexec_init(const char *filepath);
 bool           WM_file_read(struct bContext *C, const char *filepath, struct ReportList *reports);
 void           WM_autosave_init(struct wmWindowManager *wm);
 void           WM_recover_last_session(struct bContext *C, struct ReportList *reports);
+void           WM_file_tag_modified(const struct bContext *C);
 
                        /* mouse cursors */
 void           WM_cursor_set(struct wmWindow *win, int curs);
index 8288b2ed1efe712ce14c17fc76912658838227a9..37fb4e5d89e63d54e0f13eea3f90453e4054bbf5 100644 (file)
@@ -1314,3 +1314,13 @@ void wm_open_init_use_scripts(wmOperator *op, bool use_prefs)
 }
 
 /** \} */
+
+void WM_file_tag_modified(const bContext *C)
+{
+       wmWindowManager *wm = CTX_wm_manager(C);
+       if (wm->file_saved) {
+               wm->file_saved = 0;
+               /* notifier that data changed, for save-over warning or header */
+               WM_event_add_notifier(C, NC_WM | ND_DATACHANGED, NULL);
+       }
+}