[Bf-blender-cvs] [a3375729f85] blender2.8: Cleanup: macro hygiene, style, doxy comments

Campbell Barton noreply at git.blender.org
Thu Dec 13 13:04:43 CET 2018


Commit: a3375729f8518c8069edafde36953b558329a0db
Author: Campbell Barton
Date:   Thu Dec 13 22:56:19 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBa3375729f8518c8069edafde36953b558329a0db

Cleanup: macro hygiene, style, doxy comments

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

M	source/blender/blenkernel/BKE_curve.h
M	source/blender/blenkernel/BKE_gpencil_modifier.h
M	source/blender/blenlib/intern/edgehash.c
M	source/blender/draw/engines/gpencil/gpencil_engine.c
M	source/blender/editors/mesh/mesh_data.c
M	source/blender/editors/space_view3d/view3d_select.c

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

diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index be46a2dd01a..ebbdbc7f7a0 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -68,7 +68,7 @@ typedef struct CVKeyIndex {
 #define SEGMENTSU(nu)       ( ((nu)->flagu & CU_NURB_CYCLIC) ? (nu)->pntsu : (nu)->pntsu - 1)
 #define SEGMENTSV(nu)       ( ((nu)->flagv & CU_NURB_CYCLIC) ? (nu)->pntsv : (nu)->pntsv - 1)
 
-#define CU_DO_TILT(cu, nu) (((nu->flag & CU_2D) && (cu->flag & CU_3D) == 0) ? 0 : 1)
+#define CU_DO_TILT(cu, nu) ((((nu)->flag & CU_2D) && ((cu)->flag & CU_3D) == 0) ? 0 : 1)
 #define CU_DO_RADIUS(cu, nu) ((CU_DO_TILT(cu, nu) || ((cu)->flag & CU_PATH_RADIUS) || (cu)->bevobj || (cu)->ext1 != 0.0f || (cu)->ext2 != 0.0f) ? 1 : 0)
 
 /* not 3d and not unfilled */
diff --git a/source/blender/blenkernel/BKE_gpencil_modifier.h b/source/blender/blenkernel/BKE_gpencil_modifier.h
index e31f61c909a..8acbfac7981 100644
--- a/source/blender/blenkernel/BKE_gpencil_modifier.h
+++ b/source/blender/blenkernel/BKE_gpencil_modifier.h
@@ -49,9 +49,11 @@ struct bGPDframe;
 struct bGPDstroke;
 struct ModifierUpdateDepsgraphContext;
 
-#define GPENCIL_MODIFIER_ACTIVE(_md, _is_render) (((_md->mode & eGpencilModifierMode_Realtime) && (_is_render == false)) || \
-												  ((_md->mode & eGpencilModifierMode_Render) && (_is_render == true)))
-#define GPENCIL_MODIFIER_EDIT(_md, _is_edit) (((_md->mode & eGpencilModifierMode_Editmode) == 0) && (_is_edit))
+#define GPENCIL_MODIFIER_ACTIVE(_md, _is_render) \
+	((((_md)->mode & eGpencilModifierMode_Realtime) && (_is_render == false)) || \
+	 (((_md)->mode & eGpencilModifierMode_Render) && (_is_render == true)))
+#define GPENCIL_MODIFIER_EDIT(_md, _is_edit) \
+	((((_md)->mode & eGpencilModifierMode_Editmode) == 0) && (_is_edit))
 
 typedef enum {
 	/* Should not be used, only for None modifier type */
@@ -93,15 +95,16 @@ typedef void(*GreasePencilIDWalkFunc)(void *userData, struct Object *ob, struct
 typedef void(*GreasePencilTexWalkFunc)(void *userData, struct Object *ob, struct GpencilModifierData *md, const char *propname);
 
 typedef struct GpencilModifierTypeInfo {
-	/* The user visible name for this modifier */
+	/** The user visible name for this modifier */
 	char name[32];
 
-	/* The DNA struct name for the modifier data type, used to
+	/**
+	 * The DNA struct name for the modifier data type, used to
 	 * write the DNA data out.
 	 */
 	char struct_name[32];
 
-	/* The size of the modifier data type, used by allocation. */
+	/** The size of the modifier data type, used by allocation. */
 	int struct_size;
 
 	GpencilModifierTypeType type;
@@ -110,12 +113,14 @@ typedef struct GpencilModifierTypeInfo {
 
 	/********************* Non-optional functions *********************/
 
-	/* Copy instance data for this modifier type. Should copy all user
+	/**
+	 * Copy instance data for this modifier type. Should copy all user
 	 * level settings to the target modifier.
 	 */
 	void (*copyData)(const struct GpencilModifierData *md, struct GpencilModifierData *target);
 
-	/* Callback for GP "stroke" modifiers that operate on the
+	/**
+	 * Callback for GP "stroke" modifiers that operate on the
 	 * shape and parameters of the provided strokes (e.g. Thickness, Noise, etc.)
 	 *
 	 * The gpl parameter contains the GP layer that the strokes come from.
@@ -129,7 +134,8 @@ typedef struct GpencilModifierTypeInfo {
 	void (*deformStroke)(struct GpencilModifierData *md, struct Depsgraph *depsgraph,
 	                     struct Object *ob, struct bGPDlayer *gpl, struct bGPDstroke *gps);
 
-	/* Callback for GP "geometry" modifiers that create extra geometry
+	/**
+	 * Callback for GP "geometry" modifiers that create extra geometry
 	 * in the frame (e.g. Array)
 	 *
 	 * The gpf parameter contains the GP frame/strokes to operate on. This is
@@ -143,7 +149,8 @@ typedef struct GpencilModifierTypeInfo {
 	void (*generateStrokes)(struct GpencilModifierData *md, struct Depsgraph *depsgraph,
 	                        struct Object *ob, struct bGPDlayer *gpl, struct bGPDframe *gpf);
 
-	/* Bake-down GP modifier's effects into the GP datablock.
+	/**
+	 * Bake-down GP modifier's effects into the GP datablock.
 	 *
 	 * This gets called when the user clicks the "Apply" button in the UI.
 	 * As such, this callback needs to go through all layers/frames in the
@@ -155,7 +162,8 @@ typedef struct GpencilModifierTypeInfo {
 
 	/********************* Optional functions *********************/
 
-	/* Callback for GP "time" modifiers that offset keyframe time
+	/**
+	 * Callback for GP "time" modifiers that offset keyframe time
 	 * Returns the frame number to be used after apply the modifier. This is
 	 * usually an offset of the animation for duplicated datablocks.
 	 *
@@ -164,21 +172,24 @@ typedef struct GpencilModifierTypeInfo {
 	int (*remapTime)(struct GpencilModifierData *md, struct Depsgraph *depsgraph,
 		struct Scene *scene, struct Object *ob, struct bGPDlayer *gpl, int cfra);
 
-	/* Initialize new instance data for this modifier type, this function
+	/**
+	 * Initialize new instance data for this modifier type, this function
 	 * should set modifier variables to their default values.
 	 *
 	 * This function is optional.
 	 */
 	void (*initData)(struct GpencilModifierData *md);
 
-	/* Free internal modifier data variables, this function should
+	/**
+	 * Free internal modifier data variables, this function should
 	 * not free the md variable itself.
 	 *
 	 * This function is optional.
 	 */
 	void (*freeData)(struct GpencilModifierData *md);
 
-	/* Return a boolean value indicating if this modifier is able to be
+	/**
+	 * Return a boolean value indicating if this modifier is able to be
 	 * calculated based on the modifier data. This is *not* regarding the
 	 * md->flag, that is tested by the system, this is just if the data
 	 * validates (for example, a lattice will return false if the lattice
@@ -188,14 +199,16 @@ typedef struct GpencilModifierTypeInfo {
 	 */
 	bool (*isDisabled)(struct GpencilModifierData *md, int userRenderParams);
 
-	/* Add the appropriate relations to the dependency graph.
+	/**
+	 * Add the appropriate relations to the dependency graph.
 	 *
 	 * This function is optional.
 	 */
 	void (*updateDepsgraph)(struct GpencilModifierData *md,
 	                        const struct ModifierUpdateDepsgraphContext *ctx);
 
-	/* Should return true if the modifier needs to be recalculated on time
+	/**
+	 * Should return true if the modifier needs to be recalculated on time
 	 * changes.
 	 *
 	 * This function is optional (assumes false if not present).
@@ -203,7 +216,8 @@ typedef struct GpencilModifierTypeInfo {
 	bool (*dependsOnTime)(struct GpencilModifierData *md);
 
 
-	/* Should call the given walk function on with a pointer to each Object
+	/**
+	 * Should call the given walk function on with a pointer to each Object
 	 * pointer that the modifier data stores. This is used for linking on file
 	 * load and for unlinking objects or forwarding object references.
 	 *
@@ -212,7 +226,8 @@ typedef struct GpencilModifierTypeInfo {
 	void (*foreachObjectLink)(struct GpencilModifierData *md, struct Object *ob,
 	                          GreasePencilObjectWalkFunc walk, void *userData);
 
-	/* Should call the given walk function with a pointer to each ID
+	/**
+	 * Should call the given walk function with a pointer to each ID
 	 * pointer (i.e. each datablock pointer) that the modifier data
 	 * stores. This is used for linking on file load and for
 	 * unlinking datablocks or forwarding datablock references.
@@ -223,7 +238,8 @@ typedef struct GpencilModifierTypeInfo {
 	void (*foreachIDLink)(struct GpencilModifierData *md, struct Object *ob,
 	                      GreasePencilIDWalkFunc walk, void *userData);
 
-	/* Should call the given walk function for each texture that the
+	/**
+	 * Should call the given walk function for each texture that the
 	 * modifier data stores. This is used for finding all textures in
 	 * the context for the UI.
 	 *
@@ -233,7 +249,8 @@ typedef struct GpencilModifierTypeInfo {
 	void (*foreachTexLink)(struct GpencilModifierData *md, struct Object *ob,
 	                       GreasePencilTexWalkFunc walk, void *userData);
 
-	/* get the number of times the strokes are duplicated in this modifier.
+	/**
+	 * Get the number of times the strokes are duplicated in this modifier.
 	 * This is used to calculate the size of the GPU VBOs
 	 */
 	int (*getDuplicationFactor)(struct GpencilModifierData *md);
diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c
index 7061c1b8702..b46383cf9de 100644
--- a/source/blender/blenlib/intern/edgehash.c
+++ b/source/blender/blenlib/intern/edgehash.c
@@ -63,8 +63,8 @@ typedef struct EdgeSet {
 
 #define ENTRIES_CAPACITY(container) (uint)(1 << (container)->capacity_exp)
 #define MAP_CAPACITY(container) (uint)(1 << ((container)->capacity_exp + 1))
-#define CLEAR_MAP(container) memset(container->map, 0xFF, sizeof(int32_t) * MAP_CAPACITY(container))
-#define UPDATE_SLOT_MASK(container) (container)->slot_mask = MAP_CAPACITY(container) - 1
+#define CLEAR_MAP(container) memset((container)->map, 0xFF, sizeof(int32_t) * MAP_CAPACITY(container))
+#define UPDATE_SLOT_MASK(container) { (container)->slot_mask = MAP_CAPACITY(container) - 1; } ((void)0)
 #define PERTURB_SHIFT 5
 
 #define ITER_SLOTS(CONTAINER, EDGE, SLOT, INDEX) \
@@ -127,7 +127,7 @@ static uint calc_capacity_exp_for_reserve(uint reserve)
 /** \name Internal Utility API
  * \{ */
 
-#define EH_INDEX_HAS_EDGE(eh, index, edge) (index) >= 0 && edges_equal((edge), (eh)->entries[index].edge)
+#define EH_INDEX_HAS_EDGE(eh, index, edge) ((index) >= 0 && edges_equal((edge), (eh)->entries[index].edge))
 
 static void edgehash_free_values(EdgeHash *eh, EdgeHashFreeFP free_value)
 {
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 0e998363ec5..66d9bac1fac 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -116,7 +116,7 @@ static void GPENCIL_create_framebuffers(void *vedata)
 
 	

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list