[Bf-blender-cvs] [7ec7f324a3e] greasepencil-object: Fix build warnings

Dalai Felinto noreply at git.blender.org
Mon May 8 14:46:59 CEST 2017


Commit: 7ec7f324a3e161c185fb862ffdd53bccbdf50cc0
Author: Dalai Felinto
Date:   Mon May 8 14:37:06 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB7ec7f324a3e161c185fb862ffdd53bccbdf50cc0

Fix build warnings

* gcc complain if you have a "main" variable
* Missing header include in gpencil_draw.w
* A few shadowed variables (we should avoid common names in (#define) macros)
* Clear ambiguity in (!flag & VALUE) -> ((flag & VALUE) == 0)

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

M	source/blender/blenkernel/intern/context.c
M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/draw/engines/gpencil/gpencil_draw.c
M	source/blender/draw/engines/gpencil/gpencil_engine.c
M	source/blender/editors/gpencil/drawgpencil.c
M	source/blender/editors/gpencil/gpencil_data.c
M	source/blender/editors/gpencil/gpencil_intern.h
M	source/blender/editors/include/ED_gpencil.h

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

diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 4d4526d3c39..2d851364001 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -1230,7 +1230,7 @@ int CTX_data_available_palettes(const bContext *C, ListBase *list)
 	return ctx_data_collection_get(C, "available_palettes", list);
 }
 
-int CTX_data_active_palettecolorss(const bContext *C, ListBase *list)
+int CTX_data_active_palettecolors(const bContext *C, ListBase *list)
 {
 	return ctx_data_collection_get(C, "active_palettecolors", list);
 }
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index f40c4aaf59c..4957364b23a 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1252,9 +1252,9 @@ bGPDpalettecolor *BKE_gpencil_palettecolor_getbyname(bGPDpalette *palette, char
 void BKE_gpencil_palettecolor_allnames(PaletteColor *palcolor, const char *newname)
 {
 	bGPdata *gpd;
-	Main *main = G.main;
+	Main *bmain = G.main;
 
-	for (gpd = main->gpencil.first; gpd; gpd = gpd->id.next) {
+	for (gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) {
 		BKE_gpencil_palettecolor_changename(palcolor, gpd, newname);
 	}
 }
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw.c b/source/blender/draw/engines/gpencil/gpencil_draw.c
index c03e64dc044..a268772e668 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw.c
@@ -47,6 +47,8 @@
 
 #include "UI_resources.h"
 
+#include "gpencil_engine.h"
+
 /* set stroke point to vbo */
 static void gpencil_set_stroke_point(RegionView3D *rv3d, VertexBuffer *vbo, float matrix[4][4], const bGPDspoint *pt, int idx,
 						    unsigned int pos_id, unsigned int color_id,
@@ -167,7 +169,7 @@ Batch *gpencil_get_stroke_geom(bGPDframe *gpf, bGPDstroke *gps, short thickness,
 }
 
 /* helper to convert 2d to 3d for simple drawing buffer */
-static void gpencil_stroke_convertcoords(Scene *scene, ARegion *ar, View3D *v3d, const tGPspoint *point2D, float out[3], float *depth)
+static void gpencil_stroke_convertcoords(Scene *scene, ARegion *ar, View3D *v3d, const tGPspoint *point2D, float out[3], float *UNUSED(depth))
 {
 	float mval_f[2] = { point2D->x, point2D->y };
 	float mval_prj[2];
@@ -193,7 +195,7 @@ static void gpencil_stroke_convertcoords(Scene *scene, ARegion *ar, View3D *v3d,
 }
 
 /* convert 2d tGPspoint to 3d bGPDspoint */
-void gpencil_tpoint_to_point(Scene *scene, ARegion *ar, View3D *v3d, const tGPspoint *tpt, bGPDspoint *pt)
+static void gpencil_tpoint_to_point(Scene *scene, ARegion *ar, View3D *v3d, const tGPspoint *tpt, bGPDspoint *pt)
 {
 	float p3d[3];
 	/* conversion to 3d format */
@@ -567,7 +569,7 @@ static void gp_triangulate_stroke_fill(bGPDstroke *gps)
 }
 
 /* add a new fill point and texture coordinates to vertex buffer */
-static void gpencil_set_fill_point(VertexBuffer *vbo, int idx, bGPDspoint *pt, float fcolor[4], float uv[2],
+static void gpencil_set_fill_point(VertexBuffer *vbo, int idx, bGPDspoint *pt, const float fcolor[4], float uv[2],
 	unsigned int pos_id, unsigned int color_id, unsigned int text_id,
 	short UNUSED(flag),	int UNUSED(offsx), int UNUSED(offsy), int UNUSED(winx), int UNUSED(winy))
 {
@@ -587,7 +589,7 @@ static void gpencil_set_fill_point(VertexBuffer *vbo, int idx, bGPDspoint *pt, f
 }
 
 /* create batch geometry data for stroke shader */
-Batch *gpencil_get_fill_geom(bGPDstroke *gps, float color[4])
+Batch *gpencil_get_fill_geom(bGPDstroke *gps, const float color[4])
 {
 	BLI_assert(gps->totpoints >= 3);
 	int offsx = 0;
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index b7789cd4ab3..1bc105bf3a3 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -188,6 +188,7 @@ static DRWShadingGroup *GPENCIL_shgroup_fill_create(GPENCIL_Data *vedata, DRWPas
 		ImBuf *ibuf;
 		Image *image = palcolor->ima;
 		unsigned int *bind = &image->bindcode[TEXTARGET_TEXTURE_2D];
+		UNUSED_VARS(bind);
 		ImageUser iuser = { NULL };
 		void *lock;
 
@@ -220,7 +221,7 @@ static DRWShadingGroup *GPENCIL_shgroup_fill_create(GPENCIL_Data *vedata, DRWPas
 }
 
 /* create shading group for volumetric points */
-static DRWShadingGroup *GPENCIL_shgroup_point_volumetric_create(GPENCIL_Data *vedata, DRWPass *pass)
+static DRWShadingGroup *GPENCIL_shgroup_point_volumetric_create(GPENCIL_Data *UNUSED(vedata), DRWPass *pass)
 {
 	DRWShadingGroup *grp = DRW_shgroup_create(e_data.gpencil_volumetric_sh, pass);
 
@@ -228,7 +229,7 @@ static DRWShadingGroup *GPENCIL_shgroup_point_volumetric_create(GPENCIL_Data *ve
 }
 
 /* create shading group for strokes */
-static DRWShadingGroup *GPENCIL_shgroup_stroke_create(GPENCIL_Data *vedata, DRWPass *pass, PaletteColor *palcolor)
+static DRWShadingGroup *GPENCIL_shgroup_stroke_create(GPENCIL_Data *UNUSED(vedata), DRWPass *pass, PaletteColor *UNUSED(palcolor))
 {
 	const float *viewport_size = DRW_viewport_size_get();
 
@@ -239,7 +240,7 @@ static DRWShadingGroup *GPENCIL_shgroup_stroke_create(GPENCIL_Data *vedata, DRWP
 }
 
 /* create shading group for edit points using volumetric */
-static DRWShadingGroup *GPENCIL_shgroup_edit_volumetric_create(GPENCIL_Data *vedata, DRWPass *pass)
+static DRWShadingGroup *GPENCIL_shgroup_edit_volumetric_create(GPENCIL_Data *UNUSED(vedata), DRWPass *pass)
 {
 	DRWShadingGroup *grp = DRW_shgroup_create(e_data.gpencil_volumetric_sh, pass);
 
@@ -247,7 +248,8 @@ static DRWShadingGroup *GPENCIL_shgroup_edit_volumetric_create(GPENCIL_Data *ved
 }
 
 /* create shading group for drawing strokes in buffer */
-static DRWShadingGroup *GPENCIL_shgroup_drawing_stroke_create(GPENCIL_Data *vedata, DRWPass *pass, PaletteColor *palcolor)
+static DRWShadingGroup *GPENCIL_shgroup_drawing_stroke_create(
+        GPENCIL_Data *UNUSED(vedata), DRWPass *pass, PaletteColor *UNUSED(palcolor))
 {
 	DRWShadingGroup *grp = DRW_shgroup_create(e_data.gpencil_stroke_sh, pass);
 	DRW_shgroup_uniform_vec2(grp, "Viewport", DRW_viewport_size_get(), 1);
@@ -255,7 +257,8 @@ static DRWShadingGroup *GPENCIL_shgroup_drawing_stroke_create(GPENCIL_Data *veda
 }
 
 /* create shading group for drawing fill in buffer */
-static DRWShadingGroup *GPENCIL_shgroup_drawing_fill_create(GPENCIL_Data *vedata, DRWPass *pass, PaletteColor *palcolor)
+static DRWShadingGroup *GPENCIL_shgroup_drawing_fill_create(
+        GPENCIL_Data *UNUSED(vedata), DRWPass *pass, PaletteColor *UNUSED(palcolor))
 {
 	DRWShadingGroup *grp = DRW_shgroup_create(e_data.gpencil_drawing_fill_sh, pass);
 	return grp;
@@ -321,7 +324,6 @@ static void gpencil_draw_strokes(void *vedata, ToolSettings *ts, Object *ob,
 
 	DRWShadingGroup *fillgrp;
 	DRWShadingGroup *strokegrp;
-	bGPDbrush *brush = BKE_gpencil_brush_getactive(ts);
 	float tcolor[4];
 	float matrix[4][4];
 	float ink[4];
@@ -451,14 +453,12 @@ static void gpencil_draw_buffer_strokes(void *vedata, ToolSettings *ts, bGPdata
 	*/
 	if (ED_gpencil_session_active() && (gpd->sbuffer_size > 0))
 	{
-		float matrix[4][4];
-		unit_m4(matrix);
 		if ((gpd->sbuffer_sflag & GP_STROKE_ERASER) == 0) {
 			/* It should also be noted that sbuffer contains temporary point types
 			* i.e. tGPspoints NOT bGPDspoints
 			*/
 			short lthick = brush->thickness;
-			static float matrix[4][4];
+			float matrix[4][4];
 			unit_m4(matrix);
 
 			if (gpd->sbuffer_size == 1) {
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 5eea4befeb3..aa52e2bfd44 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -619,7 +619,7 @@ static int gp_set_filling_texture(Image *image, short flag)
 
 /* draw fills for shapes */
 static void gp_draw_stroke_fill(
-        bGPdata *gpd, bGPDstroke *gps,
+        bGPdata *UNUSED(gpd), bGPDstroke *gps,
         int offsx, int offsy, int winx, int winy, const float diff_mat[4][4], const float color[4])
 {
 	BLI_assert(gps->totpoints >= 3);
@@ -727,6 +727,7 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi
 	float offset[2] = { offsx, offsy };
 	float curpressure = points[0].pressure;
 	float fpt[3];
+	UNUSED_VARS(offset);
 
 	/* if cyclic needs more vertex */
 	int cyclic_add = (cyclic) ? 2 : 0;
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index dc0cf5a63cc..cf4209a8153 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -894,7 +894,7 @@ static int gp_stroke_change_palette_exec(bContext *C, wmOperator *op)
 
 			for (bGPDstroke *gps = gpl->actframe->strokes.last; gps; gps = gps->prev) {
 				/* only if selected */
-				if ((!gps->flag & GP_STROKE_SELECT) && (type == GP_MOVE_PALETTE_SELECT))
+				if (((gps->flag & GP_STROKE_SELECT) == 0) || (type != GP_MOVE_PALETTE_SELECT))
 					continue;
 				/* skip strokes that are invalid for current view */
 				if (ED_gpencil_stroke_can_use(C, gps) == false)
@@ -1430,8 +1430,8 @@ void GPENCIL_OT_brush_select(wmOperatorType *ot)
 static int gp_convert_old_palettes_poll(bContext *C)
 {
 	/* TODO: need better poll*/
-	Main *main = CTX_data_main(C);
-	if (main->gpencil.first) {
+	Main *bmain = CTX_data_main(C);
+	if (bmain->gpencil.first) {
 		return true;
 	}
 	else { 
@@ -1440,10 +1440,10 @@ static int gp_convert_old_palettes_poll(bContext *C)
 }
 
 /* convert old animation data to new format */
-static int gp_convert_old_palettes_exec(bContext *C, wmOperator *op)
+static int gp_convert_old_palettes_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Main *main = CTX_data_main(C);
-	for (bGPdata *gpd = main->gpencil.first; gpd; gpd = gpd->id.next) {
+	Main *bmain = CTX_data_main(C);
+	for (bGPdata *gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) {
 		BKE_gpencil_move_animdata_to_palettes(gpd);
 	}
 	/* notifiers */
@@ -1479,7 +1479,7 @@ static int gp_convert_scene_to_object_poll(bContext *C)
 }
 
 /* convert scene datablock to gpencil object */
-static int gp_convert_scene_to_o

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list