diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 10:31:30 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 10:31:30 +0300 |
commit | 44505b38df557a5711703613685a1dec9fc2c3d9 (patch) | |
tree | 3f05bebcc7bfadf56569f2dcca7f95fc56b1b0d0 /source/blender/editors/gpencil/gpencil_undo.c | |
parent | 6654e109df952be3a3128fae2508a02c196ae593 (diff) |
Cleanup: strip trailing space in editors
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_undo.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_undo.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/source/blender/editors/gpencil/gpencil_undo.c b/source/blender/editors/gpencil/gpencil_undo.c index 202d7630ae0..5e2be7c41f0 100644 --- a/source/blender/editors/gpencil/gpencil_undo.c +++ b/source/blender/editors/gpencil/gpencil_undo.c @@ -55,7 +55,7 @@ typedef struct bGPundonode { struct bGPundonode *next, *prev; - + char name[BKE_UNDO_STR_MAX]; struct bGPdata *gpd; } bGPundonode; @@ -71,9 +71,9 @@ int ED_gpencil_session_active(void) int ED_undo_gpencil_step(bContext *C, int step, const char *name) { 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) { @@ -92,18 +92,18 @@ int ED_undo_gpencil_step(bContext *C, int step, const char *name) } } } - + if (new_gpd) { if (gpd_ptr) { if (*gpd_ptr) { bGPdata *gpd = *gpd_ptr; bGPDlayer *gpl, *gpld; - + BKE_gpencil_free_layers(&gpd->layers); - + /* copy layers */ BLI_listbase_clear(&gpd->layers); - + for (gpl = new_gpd->layers.first; gpl; gpl = gpl->next) { /* make a copy of source layer and its data */ gpld = BKE_gpencil_layer_duplicate(gpl); @@ -112,9 +112,9 @@ int ED_undo_gpencil_step(bContext *C, int step, const char *name) } } } - + WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, NULL); - + return OPERATOR_FINISHED; } @@ -129,7 +129,7 @@ static void gpencil_undo_free_node(bGPundonode *undo_node) * or else the real copy will segfault when accessed */ undo_node->gpd->adt = NULL; - + BKE_gpencil_free(undo_node->gpd, false); MEM_freeN(undo_node->gpd); } @@ -137,65 +137,65 @@ static void gpencil_undo_free_node(bGPundonode *undo_node) void gpencil_undo_push(bGPdata *gpd) { bGPundonode *undo_node; - + //printf("\t\tGP - undo push\n"); - + if (cur_node) { /* remove all un-done nodes from stack */ undo_node = cur_node->next; - + while (undo_node) { bGPundonode *next_node = undo_node->next; - + gpencil_undo_free_node(undo_node); BLI_freelinkN(&undo_nodes, undo_node); - + undo_node = next_node; } } - + /* limit number of undo steps to the maximum undo steps - * - to prevent running out of memory during **really** + * - to prevent running out of memory during **really** * long drawing sessions (triggering swapping) */ /* TODO: Undo-memory constraint is not respected yet, but can be added if we have any need for it */ if (U.undosteps && !BLI_listbase_is_empty(&undo_nodes)) { /* remove anything older than n-steps before cur_node */ int steps = 0; - + undo_node = (cur_node) ? cur_node : undo_nodes.last; while (undo_node) { bGPundonode *prev_node = undo_node->prev; - + if (steps >= U.undosteps) { gpencil_undo_free_node(undo_node); BLI_freelinkN(&undo_nodes, undo_node); } - + steps++; undo_node = prev_node; } } - + /* create new undo node */ undo_node = MEM_callocN(sizeof(bGPundonode), "gpencil undo node"); undo_node->gpd = BKE_gpencil_data_duplicate(G.main, gpd, true); - + cur_node = undo_node; - + BLI_addtail(&undo_nodes, undo_node); } void gpencil_undo_finish(void) { bGPundonode *undo_node = undo_nodes.first; - + while (undo_node) { gpencil_undo_free_node(undo_node); undo_node = undo_node->next; } - + BLI_freelistN(&undo_nodes); - + cur_node = NULL; } |