[Bf-blender-cvs] [f81032b] soc-2013-paint: Cleanup: Make BKE_palette_ functions match our naming convention

Campbell Barton noreply at git.blender.org
Mon Jun 23 13:01:01 CEST 2014


Commit: f81032bd0d3e869e13c212448add922d9ff41a93
Author: Campbell Barton
Date:   Mon Jun 23 20:39:32 2014 +1000
https://developer.blender.org/rBf81032bd0d3e869e13c212448add922d9ff41a93

Cleanup: Make BKE_palette_ functions match our naming convention

also use const args for paint functions

===================================================================

M	source/blender/blenkernel/BKE_paint.h
M	source/blender/blenkernel/intern/library.c
M	source/blender/blenkernel/intern/paint.c
M	source/blender/editors/include/ED_sculpt.h
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_ops.c
M	source/blender/editors/sculpt_paint/paint_image.c
M	source/blender/editors/sculpt_paint/paint_image_2d.c
M	source/blender/editors/sculpt_paint/paint_intern.h

===================================================================

diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 6cffafb..e2e1ebf 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -97,13 +97,13 @@ void BKE_paint_reset_overlay_invalid(OverlayControlFlags flag);
 void BKE_paint_set_overlay_override(enum OverlayFlags flag);
 
 /* palettes */
-void BKE_free_palette(struct Palette *palette);
-struct Palette *BKE_palette_add(struct Main *bmain, const char *name);
+void                 BKE_palette_free(struct Palette *palette);
+struct Palette      *BKE_palette_add(struct Main *bmain, const char *name);
 struct PaletteColor *BKE_palette_color_add(struct Palette *palette);
 struct PaletteColor *BKE_palette_color_get_last(struct Palette *palette);
-bool BKE_palette_is_empty(const struct Palette *palette);
-void BKE_palette_remove_color (struct Palette *palette, struct PaletteColor *colour);
-void BKE_palette_cleanup (struct Palette *palette);
+bool                 BKE_palette_is_empty(const struct Palette *palette);
+void                 BKE_palette_color_remove(struct Palette *palette, struct PaletteColor *colour);
+void                 BKE_palette_cleanup(struct Palette *palette);
 
 /* paint curves */
 struct PaintCurve *BKE_paint_curve_add(struct Main *bmain, const char *name);
@@ -142,8 +142,6 @@ float paint_grid_paint_mask(const struct GridPaintMask *gpm, unsigned level,
 /* stroke related */
 void paint_calculate_rake_rotation(struct UnifiedPaintSettings *ups, const float mouse_pos[2]);
 
-void paint_bucket_fill(struct bContext *C, float color[3], struct wmOperator *op);
-
 /* Session data (mode-specific) */
 
 typedef struct SculptSession {
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 187aeb8..05f04d0 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1019,7 +1019,7 @@ void BKE_libblock_free_ex(Main *bmain, void *idv, bool do_id_user)
 			BKE_free_linestyle((FreestyleLineStyle *)id);
 			break;
 		case ID_PAL:
-			BKE_free_palette((Palette *)id);
+			BKE_palette_free((Palette *)id);
 			break;
 		case ID_PC:
 			BKE_free_paint_curve((PaintCurve *)id);
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 9666dc8..7a3a1eb 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -313,7 +313,7 @@ void BKE_paint_curve_set(Brush *br, PaintCurve *pc)
 }
 
 /* remove colour from palette. Must be certain colour is inside the palette! */
-void BKE_palette_remove_color(Palette *palette, PaletteColor *colour)
+void BKE_palette_color_remove(Palette *palette, PaletteColor *colour)
 {
 	BLI_remlink(&palette->colors, colour);
 	BLI_addhead(&palette->deleted, colour);
@@ -337,7 +337,7 @@ Palette *BKE_palette_add(Main *bmain, const char *name)
 	return palette;
 }
 
-void BKE_free_palette (Palette *palette)
+void BKE_palette_free(Palette *palette)
 {
 	BLI_freelistN(&palette->colors);
 }
diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_sculpt.h
index 792658d..b3449be 100644
--- a/source/blender/editors/include/ED_sculpt.h
+++ b/source/blender/editors/include/ED_sculpt.h
@@ -73,8 +73,10 @@ void ED_undo_paint_push_end(int type);
 /* image painting specific undo */
 void ED_image_undo_restore(struct bContext *C, struct ListBase *lb);
 void ED_image_undo_free(struct ListBase *lb);
+
+struct wmOperator;
 void ED_imapaint_clear_partial_redraw(void);
 void ED_imapaint_dirty_region(struct Image *ima, struct ImBuf *ibuf, int x, int y, int w, int h);
-
+void ED_imapaint_bucket_fill(struct bContext *C, float color[3], struct wmOperator *op);
 
 #endif
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 55b92b3..c2b0d7f 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -4295,7 +4295,7 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co
 			Palette *palette = BKE_paint_palette(paint);
 			PaletteColor *color = but->rnapoin.data;
 
-			BKE_palette_remove_color(palette, color);
+			BKE_palette_color_remove(palette, color);
 
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 			return WM_UI_HANDLER_BREAK;
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 7279163..1673509 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -57,6 +57,8 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
+#include "ED_sculpt.h"
+
 /* only for UI_OT_editsource */
 #include "ED_screen.h"
 #include "BKE_main.h"
@@ -874,7 +876,7 @@ static int drop_color_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
 			srgb_to_linearrgb_v3_v3(color, color);
 		}
 
-		paint_bucket_fill(C, color, op);
+		ED_imapaint_bucket_fill(C, color, op);
 	}
 
 	ED_region_tag_redraw(ar);
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 4b43d51..95781d6 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -1537,7 +1537,7 @@ void PAINT_OT_brush_colors_flip(wmOperatorType *ot)
 }
 
 
-void paint_bucket_fill(struct bContext *C, float color[3], wmOperator *op)
+void ED_imapaint_bucket_fill(struct bContext *C, float color[3], wmOperator *op)
 {
 	ED_undo_paint_push_begin(UNDO_PAINT_IMAGE, op->type->name,
 	                      ED_image_undo_restore, ED_image_undo_free, NULL);
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index 78d63ac..6b32073 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -1328,7 +1328,7 @@ static void paint_2d_fill_add_pixel_byte(int i, int j, ImBuf *ibuf, GSQueue *sta
 	}
 }
 
-static void paint_2d_fill_add_pixel_float(int i, int j, ImBuf *ibuf, GSQueue *stack, BLI_bitmap *touched, float color[4], float threshold)
+static void paint_2d_fill_add_pixel_float(int i, int j, ImBuf *ibuf, GSQueue *stack, BLI_bitmap *touched, const float color[4], float threshold)
 {
 	int coordinate = j * ibuf->x + i;
 
@@ -1349,7 +1349,7 @@ static void paint_2d_fill_add_pixel_float(int i, int j, ImBuf *ibuf, GSQueue *st
 }
 
 /* this function expects linear space color values */
-void paint_2d_bucket_fill (const bContext *C, float color[3], Brush *br, float mouse_init[2], void *ps)
+void paint_2d_bucket_fill(const bContext *C, const float color[3], Brush *br, float mouse_init[2], void *ps)
 {
 	SpaceImage *sima = CTX_wm_space_image(C);
 	Image *ima = sima->image;
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index a23c198..d1d0282 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -159,7 +159,7 @@ void *paint_2d_new_stroke(struct bContext *, struct wmOperator *, int mode);
 void paint_2d_redraw(const bContext *C, void *ps, bool final);
 void paint_2d_stroke_done(void *ps);
 void paint_2d_stroke(void *ps, const float prev_mval[2], const float mval[2], int eraser, float pressure, float distance, float size);
-void paint_2d_bucket_fill(const struct bContext *C, float color[3], struct Brush *br, float mouse_init[], void *ps);
+void paint_2d_bucket_fill(const struct bContext *C, const float color[3], struct Brush *br, float mouse_init[], void *ps);
 void paint_2d_gradient_fill (const struct bContext *C, struct Brush *br, float mouse_init[2], float mouse_final[2], void *ps);
 void *paint_proj_new_stroke(struct bContext *C, struct Object *ob, const float mouse[2], int mode);
 void paint_proj_stroke(const struct bContext *C, void *ps, const float prevmval_i[2], const float mval_i[2], float pressure, float distance, float size);




More information about the Bf-blender-cvs mailing list