From 94cf74afbb1329a9ff099e2ebd7f43ed8313f9ec Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 4 Feb 2021 22:03:39 +0100 Subject: Cleanup/refactor: Undosys: Get rid of the magic values for undo direction. Move `eUndoStepDir` to `BKE_undo_system.h` and use its values everywhere. Note that this also introduce the `STEP_INVALID` value in that enum. Finally, kept the matching struct members in some lower-level readfile code as an `int` to avoid having to include `BKE_undo_system.h` in a lot of unrelated files. --- source/blender/editors/gpencil/gpencil_undo.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/gpencil/gpencil_undo.c') diff --git a/source/blender/editors/gpencil/gpencil_undo.c b/source/blender/editors/gpencil/gpencil_undo.c index e545a3365e9..4e172104ce7 100644 --- a/source/blender/editors/gpencil/gpencil_undo.c +++ b/source/blender/editors/gpencil/gpencil_undo.c @@ -36,6 +36,7 @@ #include "BKE_blender_undo.h" #include "BKE_context.h" #include "BKE_gpencil.h" +#include "BKE_undo_system.h" #include "ED_gpencil.h" @@ -61,19 +62,19 @@ int ED_gpencil_session_active(void) return (BLI_listbase_is_empty(&undo_nodes) == false); } -int ED_undo_gpencil_step(bContext *C, const int step) +int ED_undo_gpencil_step(bContext *C, const eUndoStepDir step) { bGPdata **gpd_ptr = NULL, *new_gpd = NULL; gpd_ptr = ED_gpencil_data_get_pointers(C, NULL); - if (step == -1) { /* undo */ + if (step == STEP_UNDO) { if (cur_node->prev) { cur_node = cur_node->prev; new_gpd = cur_node->gpd; } } - else if (step == 1) { + else if (step == STEP_REDO) { if (cur_node->next) { cur_node = cur_node->next; new_gpd = cur_node->gpd; -- cgit v1.2.3