Cleanup: move image undo into space_image/
authorCampbell Barton <ideasman42@gmail.com>
Tue, 1 Oct 2019 15:44:27 +0000 (01:44 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 1 Oct 2019 15:45:37 +0000 (01:45 +1000)
This isn't just used for painting.

source/blender/editors/include/ED_paint.h
source/blender/editors/sculpt_paint/CMakeLists.txt
source/blender/editors/sculpt_paint/paint_intern.h
source/blender/editors/space_image/CMakeLists.txt
source/blender/editors/space_image/image_undo.c [moved from source/blender/editors/sculpt_paint/paint_image_undo.c with 99% similarity]

index 81252ad25160429e09446a9d4f01360b31550418..82f5e3b2b57cbc0f9bf80dafac58a74184bcf73a 100644 (file)
@@ -40,7 +40,7 @@ void ED_imapaint_dirty_region(
     struct Image *ima, struct ImBuf *ibuf, int x, int y, int w, int h, bool find_old);
 void ED_imapaint_bucket_fill(struct bContext *C, float color[3], struct wmOperator *op);
 
-/* paint_image_undo.c */
+/* image_undo.c */
 void ED_image_undo_push_begin(const char *name, int paint_mode);
 void ED_image_undo_push_begin_with_image(const char *name,
                                          struct Image *image,
@@ -51,6 +51,33 @@ void ED_image_undo_restore(struct UndoStep *us);
 
 void ED_image_undosys_type(struct UndoType *ut);
 
+void *image_undo_find_tile(struct ListBase *undo_tiles,
+                           struct Image *ima,
+                           struct ImBuf *ibuf,
+                           int x_tile,
+                           int y_tile,
+                           unsigned short **mask,
+                           bool validate);
+void *image_undo_push_tile(struct ListBase *undo_tiles,
+                           struct Image *ima,
+                           struct ImBuf *ibuf,
+                           struct ImBuf **tmpibuf,
+                           int x_tile,
+                           int y_tile,
+                           unsigned short **,
+                           bool **valid,
+                           bool proj,
+                           bool find_prev);
+void image_undo_remove_masks(void);
+void image_undo_init_locks(void);
+void image_undo_end_locks(void);
+
+struct ListBase *ED_image_undo_get_tiles(void);
+
+#define IMAPAINT_TILE_BITS 6
+#define IMAPAINT_TILE_SIZE (1 << IMAPAINT_TILE_BITS)
+#define IMAPAINT_TILE_NUMBER(size) (((size) + IMAPAINT_TILE_SIZE - 1) >> IMAPAINT_TILE_BITS)
+
 /* paint_curve_undo.c */
 void ED_paintcurve_undo_push_begin(const char *name);
 void ED_paintcurve_undo_push_end(void);
index c8057686c5e40d29b015e4d80abec172d17ed65a..a5cc262ddcd3a32a611ef0be64c45bfbef4ca6a0 100644 (file)
@@ -48,7 +48,6 @@ set(SRC
   paint_image.c
   paint_image_2d.c
   paint_image_proj.c
-  paint_image_undo.c
   paint_mask.c
   paint_ops.c
   paint_stroke.c
index abfa43319525e66fe527d3f810300a4dbf954cbb..69eed84fe2b7f0543cbdfc158c4a82d0a1c9ff67 100644 (file)
@@ -184,10 +184,6 @@ typedef struct ImagePaintPartialRedraw {
   int enabled;
 } ImagePaintPartialRedraw;
 
-#define IMAPAINT_TILE_BITS 6
-#define IMAPAINT_TILE_SIZE (1 << IMAPAINT_TILE_BITS)
-#define IMAPAINT_TILE_NUMBER(size) (((size) + IMAPAINT_TILE_SIZE - 1) >> IMAPAINT_TILE_BITS)
-
 bool image_texture_paint_poll(struct bContext *C);
 void imapaint_image_update(struct SpaceImage *sima,
                            struct Image *image,
@@ -252,30 +248,6 @@ void PAINT_OT_add_texture_paint_slot(struct wmOperatorType *ot);
 void PAINT_OT_image_paint(struct wmOperatorType *ot);
 void PAINT_OT_add_simple_uvs(struct wmOperatorType *ot);
 
-/* paint_image_undo.c */
-void *image_undo_find_tile(ListBase *undo_tiles,
-                           struct Image *ima,
-                           struct ImBuf *ibuf,
-                           int x_tile,
-                           int y_tile,
-                           unsigned short **mask,
-                           bool validate);
-void *image_undo_push_tile(ListBase *undo_tiles,
-                           struct Image *ima,
-                           struct ImBuf *ibuf,
-                           struct ImBuf **tmpibuf,
-                           int x_tile,
-                           int y_tile,
-                           unsigned short **,
-                           bool **valid,
-                           bool proj,
-                           bool find_prev);
-void image_undo_remove_masks(void);
-void image_undo_init_locks(void);
-void image_undo_end_locks(void);
-
-struct ListBase *ED_image_undo_get_tiles(void);
-
 /* sculpt_uv.c */
 void SCULPT_OT_uv_sculpt_stroke(struct wmOperatorType *ot);
 
index 61e6b065cba5a7716e5665cfc8b60b6abeb8cfc8..5abcff436f12cde7beaebf56d12b0f69a118af84 100644 (file)
@@ -29,6 +29,7 @@ set(INC
   ../../makesrna
   ../../render/extern/include
   ../../windowmanager
+  ../../../../intern/clog
   ../../../../intern/glew-mx
   ../../../../intern/guardedalloc
 )
@@ -42,6 +43,7 @@ set(SRC
   image_draw.c
   image_edit.c
   image_ops.c
+  image_undo.c
   space_image.c
 
   image_intern.h
similarity index 99%
rename from source/blender/editors/sculpt_paint/paint_image_undo.c
rename to source/blender/editors/space_image/image_undo.c
index 4cc12296e375240483544ab345870b5d42923a0f..c3d8bd1b446b6d7990a0ac6a8946d41add35d9cb 100644 (file)
@@ -14,7 +14,7 @@
  */
 
 /** \file
- * \ingroup edsculpt
+ * \ingroup spimage
  *
  * Overview
  * ========
@@ -64,8 +64,6 @@
 
 #include "WM_api.h"
 
-#include "paint_intern.h"
-
 static CLG_LogRef LOG = {"ed.image.undo"};
 
 /* -------------------------------------------------------------------- */