[Bf-blender-cvs] [f9f64ca4a31] master: Use eObjectMode for function arguments

Campbell Barton noreply at git.blender.org
Tue Feb 6 13:32:57 CET 2018


Commit: f9f64ca4a3170fda239ac27542046942cce23876
Author: Campbell Barton
Date:   Tue Feb 6 23:34:58 2018 +1100
Branches: master
https://developer.blender.org/rBf9f64ca4a3170fda239ac27542046942cce23876

Use eObjectMode for function arguments

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

M	source/blender/blenkernel/BKE_brush.h
M	source/blender/blenkernel/BKE_paint.h
M	source/blender/blenkernel/intern/brush.c
M	source/blender/blenkernel/intern/paint.c
M	source/blender/makesdna/DNA_brush_types.h

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

diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h
index e7af7400850..f2601f2ca32 100644
--- a/source/blender/blenkernel/BKE_brush.h
+++ b/source/blender/blenkernel/BKE_brush.h
@@ -36,6 +36,7 @@ struct Scene;
 struct UnifiedPaintSettings;
 // enum eCurveMappingPreset;
 
+#include "DNA_object_enums.h"
 
 /* globals for brush execution */
 void BKE_brush_system_init(void);
@@ -43,8 +44,8 @@ void BKE_brush_system_exit(void);
 
 /* datablock functions */
 void BKE_brush_init(struct Brush *brush);
-struct Brush *BKE_brush_add(struct Main *bmain, const char *name, short ob_mode);
-struct Brush *BKE_brush_first_search(struct Main *bmain, short ob_mode);
+struct Brush *BKE_brush_add(struct Main *bmain, const char *name, const eObjectMode ob_mode);
+struct Brush *BKE_brush_first_search(struct Main *bmain, const eObjectMode ob_mode);
 void BKE_brush_copy_data(struct Main *bmain, struct Brush *brush_dst, const struct Brush *brush_src, const int flag);
 struct Brush *BKE_brush_copy(struct Main *bmain, const struct Brush *brush);
 void BKE_brush_make_local(struct Main *bmain, struct Brush *brush, const bool lib_local);
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index de2c862651c..c7a4f6b2fb6 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -60,6 +60,8 @@ struct UnifiedPaintSettings;
 
 enum eOverlayFlags;
 
+#include "DNA_object_enums.h"
+
 extern const char PAINT_CURSOR_SCULPT[3];
 extern const char PAINT_CURSOR_VERTEX_PAINT[3];
 extern const char PAINT_CURSOR_WEIGHT_PAINT[3];
@@ -122,7 +124,7 @@ void BKE_paint_copy(struct Paint *src, struct Paint *tar, const int flag);
 
 void BKE_paint_cavity_curve_preset(struct Paint *p, int preset);
 
-short BKE_paint_object_mode_from_paint_mode(ePaintMode mode);
+eObjectMode BKE_paint_object_mode_from_paint_mode(ePaintMode mode);
 struct Paint *BKE_paint_get_active_from_paintmode(struct Scene *sce, ePaintMode mode);
 struct Paint *BKE_paint_get_active(struct Scene *sce);
 struct Paint *BKE_paint_get_active_from_context(const struct bContext *C);
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 8d63c1cfb44..d82c1ca56fe 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -151,7 +151,7 @@ void BKE_brush_init(Brush *brush)
 /**
  * \note Resulting brush will have two users: one as a fake user, another is assumed to be used by the caller.
  */
-Brush *BKE_brush_add(Main *bmain, const char *name, short ob_mode)
+Brush *BKE_brush_add(Main *bmain, const char *name, const eObjectMode ob_mode)
 {
 	Brush *brush;
 
@@ -164,7 +164,7 @@ Brush *BKE_brush_add(Main *bmain, const char *name, short ob_mode)
 	return brush;
 }
 
-struct Brush *BKE_brush_first_search(struct Main *bmain, short ob_mode)
+struct Brush *BKE_brush_first_search(struct Main *bmain, const eObjectMode ob_mode)
 {
 	Brush *brush;
 
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index dba2bc7287e..593c769e8e9 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -496,7 +496,7 @@ void BKE_paint_cavity_curve_preset(Paint *p, int preset)
 	curvemapping_changed(p->cavity_curve, false);
 }
 
-short BKE_paint_object_mode_from_paint_mode(ePaintMode mode)
+eObjectMode BKE_paint_object_mode_from_paint_mode(ePaintMode mode)
 {
 	switch (mode) {
 		case ePaintSculpt:
@@ -526,7 +526,7 @@ void BKE_paint_init(Scene *sce, ePaintMode mode, const char col[3])
 	/* If there's no brush, create one */
 	brush = BKE_paint_brush(paint);
 	if (brush == NULL) {
-		short ob_mode = BKE_paint_object_mode_from_paint_mode(mode);
+		eObjectMode ob_mode = BKE_paint_object_mode_from_paint_mode(mode);
 		brush = BKE_brush_first_search(G.main, ob_mode);
 
 		if (!brush) {
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 407d59f09da..fc3b4afe18d 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -72,7 +72,7 @@ typedef struct Brush {
 	float rake_factor;  /* rake actual data (not texture), used for sculpt */
 
 	short blend;        /* blend mode */
-	short ob_mode;      /* & with ob->mode to see if the brush is compatible, use for display only. */
+	short ob_mode;      /* eObjectMode: to see if the brush is compatible, use for display only. */
 	float weight;       /* brush weight */
 	int size;           /* brush diameter */
 	int flag;           /* general purpose flag */



More information about the Bf-blender-cvs mailing list