[Bf-blender-cvs] [c5b72fd70e2] greasepencil-object: Rename field factor to weight

Antonio Vazquez noreply at git.blender.org
Tue May 15 12:53:41 CEST 2018


Commit: c5b72fd70e25487bf2a4616a0afc08f42b8e50a6
Author: Antonio Vazquez
Date:   Tue May 15 12:52:45 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBc5b72fd70e25487bf2a4616a0afc08f42b8e50a6

Rename field factor to weight

This is a previous step to move weights to MDeformVert

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

M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/editors/gpencil/gpencil_brush.c
M	source/blender/editors/gpencil/gpencil_data.c
M	source/blender/makesdna/DNA_gpencil_types.h
M	source/blender/makesrna/intern/rna_gpencil.c

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

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 9dd518999c8..9ea235429bf 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1323,7 +1323,7 @@ bGPDweight *BKE_gpencil_vgroup_add_point_weight(bGPDspoint *pt, int index, float
 	for (int i = 0; i < pt->totweight; i++) {
 		tmp_gpw = &pt->weights[i];
 		if (tmp_gpw->def_nr == index) {
-			tmp_gpw->factor = weight;
+			tmp_gpw->weight = weight;
 			return tmp_gpw;
 		}
 	}
@@ -1337,7 +1337,7 @@ bGPDweight *BKE_gpencil_vgroup_add_point_weight(bGPDspoint *pt, int index, float
 	}
 	new_gpw = &pt->weights[pt->totweight - 1];
 	new_gpw->def_nr = index;
-	new_gpw->factor = weight;
+	new_gpw->weight = weight;
 
 	return new_gpw;
 }
@@ -1349,7 +1349,7 @@ float BKE_gpencil_vgroup_use_index(bGPDspoint *pt, int index)
 	for (int i = 0; i < pt->totweight; i++) {
 		gpw = &pt->weights[i];
 		if (gpw->def_nr == index) {
-			return gpw->factor;
+			return gpw->weight;
 		}
 	}
 	return -1.0f;
@@ -1381,7 +1381,7 @@ bool BKE_gpencil_vgroup_remove_point_weight(bGPDspoint *pt, int index)
 		bGPDweight *final_gpw = &pt->weights[e];
 		if (gpw->def_nr != index) {
 			final_gpw->def_nr = gpw->def_nr;
-			final_gpw->factor = gpw->factor;
+			final_gpw->weight = gpw->weight;
 			e++;
 		}
 	}
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 4ceabc01d6b..925e444e32b 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -877,7 +877,7 @@ static bool gp_brush_weight_apply(
 	for (int i = 0; i < pt->totweight; ++i) {
 		bGPDweight *gpw = &pt->weights[i];
 		if (gpw->def_nr == gso->vrgroup) {
-			curweight = gpw->factor;
+			curweight = gpw->weight;
 			break;
 		}
 	}
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index 6b992170a3d..e7e0d4fe8e0 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -1535,11 +1535,11 @@ static int gpencil_vertex_group_invert_exec(bContext *C, wmOperator *UNUSED(op))
 			if (pt->weights == NULL) {
 				BKE_gpencil_vgroup_add_point_weight(pt, def_nr, 1.0f);
 			}
-			else if (pt->weights->factor == 1.0f) {
+			else if (pt->weights->weight == 1.0f) {
 				BKE_gpencil_vgroup_remove_point_weight(pt, def_nr);
 			}
 			else {
-				pt->weights->factor = 1.0f - pt->weights->factor;
+				pt->weights->weight = 1.0f - pt->weights->weight;
 			}
 		}
 	}
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 4c966098795..973ea569082 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -50,7 +50,7 @@ struct GHash;
 /* Vertex weight info for one GP point, in one group */
 typedef struct bGPDweight {
 	int def_nr;            /* vertex group index */
-	float factor;         /* weight factor */
+	float weight;          /* weight factor */
 } bGPDweight;
 
 /* ***************************************** */
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index c7f54c221cb..0526912b721 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -654,7 +654,7 @@ static void rna_def_gpencil_point_weight(BlenderRNA *brna)
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
 	prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_float_sdna(prop, NULL, "factor");
+	RNA_def_property_float_sdna(prop, NULL, "weight");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Weight", "Factor of weight for this vertex group");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");



More information about the Bf-blender-cvs mailing list