[Bf-blender-cvs] [a597e21dbd0] greasepencil-object: Cleanup. Rename material variable to "ma"

Antonio Vazquez noreply at git.blender.org
Mon Apr 30 19:42:01 CEST 2018


Commit: a597e21dbd0e5098ec758cdb598579cf5984a4f9
Author: Antonio Vazquez
Date:   Mon Apr 30 19:41:51 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBa597e21dbd0e5098ec758cdb598579cf5984a4f9

Cleanup. Rename material variable to "ma"

The old name "mat" could be confused with matrix.

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

M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M	source/blender/editors/gpencil/drawgpencil.c
M	source/blender/editors/gpencil/gpencil_brush.c
M	source/blender/editors/gpencil/gpencil_colorpick.c
M	source/blender/editors/gpencil/gpencil_data.c
M	source/blender/editors/gpencil/gpencil_edit.c
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/gpencil/gpencil_utils.c

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

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 454003da668..20ff1b04910 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1043,37 +1043,37 @@ void BKE_gpencil_layer_delete(bGPdata *gpd, bGPDlayer *gpl)
 
 Material *BKE_gpencil_get_color_from_brush(Brush *brush)
 {
-	Material *mat = NULL;
+	Material *ma = NULL;
 		
 	if ((brush != NULL) && (brush->material != NULL)) {
-		mat = brush->material;
+		ma = brush->material;
 	}
 
-	return mat;
+	return ma;
 }
 
 /* Get active color, and add all default settings if we don't find anything */
 Material *BKE_gpencil_color_ensure(Main *bmain, Object *ob)
 {
-	Material *mat = NULL;
+	Material *ma = NULL;
 
 	/* sanity checks */
 	if (ELEM(NULL, bmain, ob))
 		return NULL;
 
-	mat = give_current_material(ob, ob->actcol);
-	if (mat == NULL) {
+	ma = give_current_material(ob, ob->actcol);
+	if (ma == NULL) {
 		if (ob->totcol == 0) {
 			BKE_object_material_slot_add(ob);
 		}
-		mat = BKE_material_add_gpencil(bmain, DATA_("Material"));
-		assign_material(ob, mat, ob->totcol, BKE_MAT_ASSIGN_EXISTING);
+		ma = BKE_material_add_gpencil(bmain, DATA_("Material"));
+		assign_material(ob, ma, ob->totcol, BKE_MAT_ASSIGN_EXISTING);
 	}
-	else if (mat->gpcolor == NULL) {
-			BKE_material_init_gpencil_settings(mat);
+	else if (ma->gpcolor == NULL) {
+			BKE_material_init_gpencil_settings(ma);
 	}
 
-	return mat;
+	return ma;
 }
 
 /* ************************************************** */
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index f6155fc2bb2..049333f9210 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -635,9 +635,9 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T
 	float obscale = (ob->size[0] + ob->size[1] + ob->size[2]) / 3.0f;
 
 	/* if the brush has a default material defined, use these and not current defaults */
-	Material *mat = BKE_gpencil_get_color_from_brush(brush);
-	if (mat != NULL) {
-		gpcolor = mat->gpcolor;
+	Material *ma = BKE_gpencil_get_color_from_brush(brush);
+	if (ma != NULL) {
+		gpcolor = ma->gpcolor;
 	}
 	if (gpcolor == NULL) {
 		gpcolor = BKE_material_gpencil_settings_get(ob, ob->actcol);
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index fbb30e83958..b09a151aa29 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -625,8 +625,8 @@ static void gp_draw_stroke_fill(
         int offsx, int offsy, int winx, int winy, const float diff_mat[4][4], const float color[4])
 {
 	BLI_assert(gps->totpoints >= 3);
-	Material *material = gpd->mat[gps->mat_nr];
-	GpencilColorData *gpcolor = material->gpcolor;
+	Material *ma = gpd->mat[gps->mat_nr];
+	GpencilColorData *gpcolor = ma->gpcolor;
 
 	/* Calculate triangles cache for filling area (must be done only after changes) */
 	if ((gps->flag & GP_STROKE_RECALC_CACHES) || (gps->tot_triangles == 0) || (gps->triangles == NULL)) {
@@ -1026,8 +1026,8 @@ static void gp_draw_strokes(tGPDdraw *tgpw)
 			continue;
 		}
 		/* check if the color is visible */
-		Material *material = tgpw->gpd->mat[gps->mat_nr];
-		GpencilColorData *gpcolor = material->gpcolor;
+		Material *ma = tgpw->gpd->mat[gps->mat_nr];
+		GpencilColorData *gpcolor = ma->gpcolor;
 
 		if ((gpcolor == NULL) ||
 		    (gpcolor->flag & GPC_COLOR_HIDE) ||
@@ -1239,8 +1239,8 @@ static void gp_draw_strokes_edit(
 
 		/* verify color lock */
 		{
-			Material *material = gpd->mat[gps->mat_nr];
-			GpencilColorData *gpcolor = material->gpcolor;
+			Material *ma = gpd->mat[gps->mat_nr];
+			GpencilColorData *gpcolor = ma->gpcolor;
 
 			if (gpcolor != NULL) {
 				if (gpcolor->flag & GPC_COLOR_HIDE) {
@@ -1269,8 +1269,8 @@ static void gp_draw_strokes_edit(
 
 		/* for now, we assume that the base color of the points is not too close to the real color */
 		/* set color using material */
-		Material *material = gpd->mat[gps->mat_nr];
-		GpencilColorData *gpcolor = material->gpcolor;
+		Material *ma = gpd->mat[gps->mat_nr];
+		GpencilColorData *gpcolor = ma->gpcolor;
 
 		float selectColor[4];
 		UI_GetThemeColor3fv(TH_GP_VERTEX_SELECT, selectColor);
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 710a1c6694e..2ffa9be1bbe 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -1039,9 +1039,9 @@ static void gp_brush_clone_add(bContext *C, tGP_BrushEditData *gso)
 			BLI_addtail(&gpf->strokes, new_stroke);
 			
 			/* Fix color references */
-			Material *mat = BLI_ghash_lookup(data->new_colors, &new_stroke->mat_nr);
-			if ((mat) && (BKE_object_material_slot_find_index(ob, mat) > 0)) {
-				gps->mat_nr = BKE_object_material_slot_find_index(ob, mat) - 1;
+			Material *ma = BLI_ghash_lookup(data->new_colors, &new_stroke->mat_nr);
+			if ((ma) && (BKE_object_material_slot_find_index(ob, ma) > 0)) {
+				gps->mat_nr = BKE_object_material_slot_find_index(ob, ma) - 1;
 				CLAMP_MIN(gps->mat_nr, 0);
 			}
 			else {
diff --git a/source/blender/editors/gpencil/gpencil_colorpick.c b/source/blender/editors/gpencil/gpencil_colorpick.c
index e8196c242b0..0ec07e6d854 100644
--- a/source/blender/editors/gpencil/gpencil_colorpick.c
+++ b/source/blender/editors/gpencil/gpencil_colorpick.c
@@ -387,12 +387,12 @@ static tGPDpick *gpencil_colorpick_init(bContext *C, wmOperator *op, const wmEve
 	Material ***matar = give_matarar(tgpk->ob);
 	short *totcol = give_totcolp(tgpk->ob);
 	for (short i = 0; i < *totcol; i++) {
-		Material *tmp = (*matar)[i];
-		GpencilColorData *gpcolor = tmp->gpcolor;
+		Material *tmp_ma = (*matar)[i];
+		GpencilColorData *gpcolor = tmp_ma->gpcolor;
 		
 		tcolor->index = idx;
 
-		BLI_strncpy(tcolor->name, tmp->id.name + 2, sizeof(tcolor->name));
+		BLI_strncpy(tcolor->name, tmp_ma->id.name + 2, sizeof(tcolor->name));
 		copy_v4_v4(tcolor->rgba, gpcolor->rgb);
 		copy_v4_v4(tcolor->fill, gpcolor->fill);
 		tcolor->fillmode = (gpcolor->fill[3] > 0.0f);
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index d7fc6fedef0..584ae47a007 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -1087,8 +1087,8 @@ static int gp_stroke_change_color_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	bGPdata *gpd = ED_gpencil_data_get_active(C);
 	Object *ob = CTX_data_active_object(C);
-	Material *mat = give_current_material(ob, ob->actcol);
-	int idx = BKE_object_material_slot_find_index(ob, mat) - 1;
+	Material *ma = give_current_material(ob, ob->actcol);
+	int idx = BKE_object_material_slot_find_index(ob, ma) - 1;
 
 	/* sanity checks */
 	if (ELEM(NULL, gpd)) {
@@ -1096,7 +1096,7 @@ static int gp_stroke_change_color_exec(bContext *C, wmOperator *UNUSED(op))
 	}
 
 	bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
-	if (ELEM(NULL, mat)) {
+	if (ELEM(NULL, ma)) {
 		return OPERATOR_CANCELLED;
 	}
 
@@ -1161,7 +1161,7 @@ static int gp_stroke_lock_color_exec(bContext *C, wmOperator *UNUSED(op))
 	bGPdata *gpd = ED_gpencil_data_get_active(C);
 
 	Object *ob = CTX_data_active_object(C);
-	Material *mat = NULL;
+	Material *ma = NULL;
 
 	Material ***matar = give_matarar(ob);
 	short *totcol = give_totcolp(ob);
@@ -1172,8 +1172,8 @@ static int gp_stroke_lock_color_exec(bContext *C, wmOperator *UNUSED(op))
 
 	/* first lock all colors */
 	for (short i = 0; i < *totcol; i++) {
-		Material *tmp = (*matar)[i];
-		tmp->gpcolor->flag |= GPC_COLOR_LOCKED;
+		Material *tmp_ma = (*matar)[i];
+		tmp_ma->gpcolor->flag |= GPC_COLOR_LOCKED;
 
 	}
 
@@ -1189,8 +1189,8 @@ static int gp_stroke_lock_color_exec(bContext *C, wmOperator *UNUSED(op))
 						continue;
 					}
 					/* unlock color */
-					Material *tmp = (*matar)[gps->mat_nr];
-					tmp->gpcolor->flag &= ~GPC_COLOR_LOCKED;
+					Material *tmp_ma = (*matar)[gps->mat_nr];
+					tmp_ma->gpcolor->flag &= ~GPC_COLOR_LOCKED;
 				}
 			}
 		}
@@ -1873,10 +1873,10 @@ int ED_gpencil_join_objects_exec(bContext *C, wmOperator *op)
 				short *totcol = give_totcolp(ob_src);
 
 				for (short i = 0; i < *totcol; i++) {
-					Material *tmp_mat = (*matar)[i];
-					if (BKE_object_material_slot_find_index(ob_dst, tmp_mat) == 0) {
+					Material *tmp_ma = (*matar)[i];
+					if (BKE_object_material_slot_find_index(ob_dst, tmp_ma) == 0) {
 						BKE_object_material_slot_add(ob_dst);
-						assign_material(ob_dst, tmp_mat, ob_dst->totcol, BKE_MAT_ASSIGN_EXISTING);
+						assign_material(ob_dst, tmp_ma, ob_dst->totcol, BKE_MAT_ASSIGN_EXISTING);
 					}
 				}
 
@@ -2013,15 +2013,15 @@ static int gpencil_lock_layer_exec(bContext *C, wmOperator *UNUSED(op))
 		return OPERATOR_CANCELLED;
 
 	/* first lock and hide all colors */
-	Material *mat = NULL;
+	Material *ma = NULL;
 	Material ***matar = give_matarar(ob);
 	short *totcol = give_totcolp(ob);
 	if ((totcol == 0) || (matar == NULL))
 		return OPERATOR_CANCELLED;
 
 	for (short i = 0; i < *totcol; i++) {
-		mat = (*matar)[i];
-		gpcolor = mat->gpcolor;
+		ma = (*matar)[i];
+		gpcolor = ma->gpcolor;
 		gpcolor->flag |= GPC_COLOR_LOCKED;
 		gpcolor->flag |= GPC_COLOR_HIDE;
 	}
@@ -2069,7 +2069,7 @@ static int gpencil_color_isolate_exec(bContext *C, wmOperator *op)
 {
 	bGPdata *gpd = ED_gpencil_data_get_active(C);
 	Object *ob = CTX_data_active_object(C);
-	Material *active_mat = give_current_material(ob, ob->actcol);
+	Material *active_ma = give_current_material(ob, ob->actcol);
 	GpencilColorData *active_color = BKE_material_gpencil_settings_get(ob, ob->actcol);
 	GpencilColorData *gpcolor;
 
@@ -2085,19 +2085,19 @@ static int gpencil_color_isolate_exec(bContext *C, wmOperator *op)
 	}
 
 	/* Test whether to isolate or clear all flags */
-	Material *mat = NULL;
+	Material *ma = NULL;
 	Material ***matar = give_matarar(ob);
 	short *totcol = give_totcolp(ob);
 	for (short i = 0; i < *totcol; i++) {
-		mat = (*matar)[i];
+		ma = (*

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list