[Bf-blender-cvs] [16ded67d809] greasepencil-object: Rename weight index field
Antonio Vazquez
noreply at git.blender.org
Tue May 15 12:53:39 CEST 2018
Commit: 16ded67d80941681eda72e30e749484e50f8a4da
Author: Antonio Vazquez
Date: Tue May 15 12:45:38 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB16ded67d80941681eda72e30e749484e50f8a4da
Rename weight index field
This commit is a previous step to move the weights to MDeformVert and MDeformWeight
===================================================================
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 b507fa095a4..9dd518999c8 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1295,12 +1295,12 @@ void BKE_gpencil_vgroup_remove(Object *ob, bDeformGroup *defgroup)
pt = &gps->points[i];
for (int i2 = 0; i2 < pt->totweight; i2++) {
gpw = &pt->weights[i2];
- if (gpw->index == def_nr) {
+ if (gpw->def_nr == def_nr) {
BKE_gpencil_vgroup_remove_point_weight(pt, def_nr);
}
/* if index is greater, must be moved one back */
- if (gpw->index > def_nr) {
- gpw->index--;
+ if (gpw->def_nr > def_nr) {
+ gpw->def_nr--;
}
}
}
@@ -1322,7 +1322,7 @@ bGPDweight *BKE_gpencil_vgroup_add_point_weight(bGPDspoint *pt, int index, float
/* need to verify if was used before to update */
for (int i = 0; i < pt->totweight; i++) {
tmp_gpw = &pt->weights[i];
- if (tmp_gpw->index == index) {
+ if (tmp_gpw->def_nr == index) {
tmp_gpw->factor = weight;
return tmp_gpw;
}
@@ -1336,7 +1336,7 @@ bGPDweight *BKE_gpencil_vgroup_add_point_weight(bGPDspoint *pt, int index, float
pt->weights = MEM_reallocN(pt->weights, sizeof(bGPDweight) * pt->totweight);
}
new_gpw = &pt->weights[pt->totweight - 1];
- new_gpw->index = index;
+ new_gpw->def_nr = index;
new_gpw->factor = weight;
return new_gpw;
@@ -1348,7 +1348,7 @@ float BKE_gpencil_vgroup_use_index(bGPDspoint *pt, int index)
bGPDweight *gpw;
for (int i = 0; i < pt->totweight; i++) {
gpw = &pt->weights[i];
- if (gpw->index == index) {
+ if (gpw->def_nr == index) {
return gpw->factor;
}
}
@@ -1379,8 +1379,8 @@ bool BKE_gpencil_vgroup_remove_point_weight(bGPDspoint *pt, int index)
for (int x = 0; x < pt->totweight; x++) {
bGPDweight *gpw = &tmp[e];
bGPDweight *final_gpw = &pt->weights[e];
- if (gpw->index != index) {
- final_gpw->index = gpw->index;
+ if (gpw->def_nr != index) {
+ final_gpw->def_nr = gpw->def_nr;
final_gpw->factor = gpw->factor;
e++;
}
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 17b4493591d..4ceabc01d6b 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -876,7 +876,7 @@ static bool gp_brush_weight_apply(
float curweight = 0.0f;
for (int i = 0; i < pt->totweight; ++i) {
bGPDweight *gpw = &pt->weights[i];
- if (gpw->index == gso->vrgroup) {
+ if (gpw->def_nr == gso->vrgroup) {
curweight = gpw->factor;
break;
}
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index b6aca7cb102..6b992170a3d 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -1814,8 +1814,8 @@ int ED_gpencil_join_objects_exec(bContext *C, wmOperator *op)
bGPDspoint *pt;
int i;
for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
- if ((pt->weights) && (pt->weights->index == old_idx)) {
- pt->weights->index = idx;
+ if ((pt->weights) && (pt->weights->def_nr == old_idx)) {
+ pt->weights->def_nr = idx;
}
}
}
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index ee7c4c96d11..4c966098795 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -49,7 +49,7 @@ struct GHash;
/* Vertex weight info for one GP point, in one group */
typedef struct bGPDweight {
- int index; /* vertex group index */
+ int def_nr; /* vertex group index */
float factor; /* weight factor */
} bGPDweight;
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index 625023b6c24..c7f54c221cb 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -649,7 +649,7 @@ static void rna_def_gpencil_point_weight(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Grease Pencil Point Weight", "Data for point vertex groups");
prop = RNA_def_property(srna, "vertex_group", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "index");
+ RNA_def_property_int_sdna(prop, NULL, "def_nr");
RNA_def_property_ui_text(prop, "Index", "Index of the vertex group");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
More information about the Bf-blender-cvs
mailing list