diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-03-30 10:35:01 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-04-14 10:46:17 +0300 |
commit | b2c2d7b7f13a0c033853dcc87b49dbda4ba737af (patch) | |
tree | 50b69a60ea5c1ab3c1018f8a79cfd10af3e6b257 /source/blender/editors/object/object_modifier.c | |
parent | 9e0b44aae941d0d175a072c12423b0db094c4c3e (diff) |
Sculpt: Implement undo of Apply Base during sculpt session
The idea is to push both base mesh geometry and PBVH coordinates
so it is possible to undo everything without loosing data which was
not flushed from sculpt session to base mesh.
It is possible do memory optimization to avoid push custom data
layers which are not touched by operator, but before doing that
better to ensure this is a correct and working approach.
Differential Revision: https://developer.blender.org/D7381
Diffstat (limited to 'source/blender/editors/object/object_modifier.c')
-rw-r--r-- | source/blender/editors/object/object_modifier.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 2babf27eb61..a24f3ba2269 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -86,6 +86,7 @@ #include "ED_mesh.h" #include "ED_object.h" #include "ED_screen.h" +#include "ED_sculpt.h" #include "WM_api.h" #include "WM_types.h" @@ -1697,8 +1698,12 @@ static int multires_base_apply_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } + ED_sculpt_undo_push_multires_mesh_begin(C, op->type->name); + multiresModifier_base_apply(depsgraph, object, mmd); + ED_sculpt_undo_push_multires_mesh_end(C, op->type->name); + DEG_id_tag_update(&object->id, ID_RECALC_GEOMETRY); WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, object); @@ -1726,7 +1731,7 @@ void OBJECT_OT_multires_base_apply(wmOperatorType *ot) ot->exec = multires_base_apply_exec; /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; + ot->flag = OPTYPE_REGISTER | OPTYPE_INTERNAL; edit_modifier_properties(ot); } |