Fix T46471: Sculpt strokes doesn't mark file as modified

This commit is contained in:
Sergey Sharybin 2015-10-28 04:10:00 +05:00
parent 16796c2813
commit fd1487977b
Notes: blender-bot 2023-02-14 10:37:49 +01:00
Referenced by issue #46471, Sculpt save bug
8 changed files with 24 additions and 15 deletions

View 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) */

View 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);

View 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);

View 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]);

View 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);
}

View 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 */

View 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);

View 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);
}
}