diff options
-rw-r--r-- | source/blender/editors/gpencil/gpencil_undo.c | 16 | ||||
-rw-r--r-- | source/blender/editors/include/ED_gpencil.h | 2 | ||||
-rw-r--r-- | source/blender/editors/undo/ed_undo.c | 8 |
3 files changed, 12 insertions, 14 deletions
diff --git a/source/blender/editors/gpencil/gpencil_undo.c b/source/blender/editors/gpencil/gpencil_undo.c index 10d15c8afbc..d9bc77c8715 100644 --- a/source/blender/editors/gpencil/gpencil_undo.c +++ b/source/blender/editors/gpencil/gpencil_undo.c @@ -61,28 +61,22 @@ int ED_gpencil_session_active(void) return (BLI_listbase_is_empty(&undo_nodes) == false); } -int ED_undo_gpencil_step(bContext *C, int step, const char *name) +int ED_undo_gpencil_step(bContext *C, const int step) { bGPdata **gpd_ptr = NULL, *new_gpd = NULL; gpd_ptr = ED_gpencil_data_get_pointers(C, NULL); if (step == -1) { /* undo */ - // printf("\t\tGP - undo step\n"); if (cur_node->prev) { - if (!name || STREQ(cur_node->name, name)) { - cur_node = cur_node->prev; - new_gpd = cur_node->gpd; - } + cur_node = cur_node->prev; + new_gpd = cur_node->gpd; } } else if (step == 1) { - // printf("\t\tGP - redo step\n"); if (cur_node->next) { - if (!name || STREQ(cur_node->name, name)) { - cur_node = cur_node->next; - new_gpd = cur_node->gpd; - } + cur_node = cur_node->next; + new_gpd = cur_node->gpd; } } diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index 1b7caf27ecf..19cec4c0f62 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -213,7 +213,7 @@ bool ED_gpencil_anim_copybuf_paste(struct bAnimContext *ac, const short copy_mod /* ------------ Grease-Pencil Undo System ------------------ */ int ED_gpencil_session_active(void); -int ED_undo_gpencil_step(struct bContext *C, int step, const char *name); +int ED_undo_gpencil_step(struct bContext *C, const int step); /* ------------ Grease-Pencil Armature ------------------ */ bool ED_gpencil_add_armature(const struct bContext *C, diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c index d15f6d33acd..d29e9779130 100644 --- a/source/blender/editors/undo/ed_undo.c +++ b/source/blender/editors/undo/ed_undo.c @@ -77,7 +77,7 @@ static CLG_LogRef LOG = {"ed.undo"}; enum eUndoStepDir { STEP_REDO = 1, STEP_UNDO = -1, - /** Only used when the undo name is passed to #ed_undo_step_impl. */ + /** Only used when the undo step name or index is passed to #ed_undo_step_impl. */ STEP_NONE = 0, }; @@ -207,8 +207,12 @@ static int ed_undo_step_impl( /* TODO(campbell): undo_system: use undo system */ /* grease pencil can be can be used in plenty of spaces, so check it first */ + /* FIXME: This gpencil undo effectively only supports the one step undo/redo, undo based on name + * or index is fully not implemented. + * FIXME: However, it seems to never be used in current code (`ED_gpencil_session_active` seems + * to always return false). */ if (ED_gpencil_session_active()) { - return ED_undo_gpencil_step(C, (int)step, undoname); + return ED_undo_gpencil_step(C, (int)step); } if (area && (area->spacetype == SPACE_VIEW3D)) { Object *obact = CTX_data_active_object(C); |