code cleanup: use single define for undo string size, was 64 mostly, but 512 in the UI.
[blender-staging.git] / source / blender / editors / sculpt_paint / paint_undo.c
index fbf83dd8df5d801fe5d727d6a61c826e1f6bac9b..f5b9aa742c6ac516fee7eb62737cc3b916df467d 100644 (file)
@@ -1,7 +1,4 @@
 /*
- *
- * Undo system for painting and sculpting.
- * 
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -23,9 +20,9 @@
 
 /** \file blender/editors/sculpt_paint/paint_undo.c
  *  \ingroup edsculpt
+ *  \brief Undo system for painting and sculpting.
  */
 
-
 #include <stdlib.h>
 #include <string.h>
 
@@ -37,7 +34,7 @@
 
 #include "DNA_userdef_types.h"
 
-
+#include "BKE_blender.h"
 #include "BKE_context.h"
 #include "BKE_global.h"
 
 
 #include "paint_intern.h"
 
-#define MAXUNDONAME 64
-
 typedef struct UndoElem {
        struct UndoElem *next, *prev;
-       char name[MAXUNDONAME];
+       char name[BKE_UNDO_STR_MAX];
        uintptr_t undosize;
 
        ListBase elems;
@@ -160,7 +155,9 @@ static int undo_stack_step(bContext *C, UndoStack *stack, int step, const char *
                if (stack->current == NULL) ;
                else {
                        if (!name || strcmp(stack->current->name, name) == 0) {
-                               if (G.f & G_DEBUG) printf("undo %s\n", stack->current->name);
+                               if (G.debug & G_DEBUG_WM) {
+                                       printf("%s: undo '%s'\n", __func__, stack->current->name);
+                               }
                                undo_restore(C, stack, stack->current);
                                stack->current = stack->current->prev;
                                return 1;
@@ -174,7 +171,9 @@ static int undo_stack_step(bContext *C, UndoStack *stack, int step, const char *
                                undo = (stack->current && stack->current->next) ? stack->current->next : stack->elems.first;
                                undo_restore(C, stack, undo);
                                stack->current = undo;
-                               if (G.f & G_DEBUG) printf("redo %s\n", undo->name);
+                               if (G.debug & G_DEBUG_WM) {
+                                       printf("%s: redo %s\n", __func__, undo->name);
+                               }
                                return 1;
                        }
                }
@@ -270,4 +269,3 @@ void ED_undo_paint_free(void)
        undo_stack_free(&ImageUndoStack);
        undo_stack_free(&MeshUndoStack);
 }
-