Fix T96799: GPencil `weight_get` API cannot retrieve weights
The problem was when the stroke had less weights that the total number of vertex groups. The API checked the total number of groups, but this is not required because `BKE_defvert_find_index` returns NULL is the vertex group index does not exist.
This commit is contained in:
parent
31bcab0ecb
commit
9450057b43
Notes:
blender-bot
2023-02-14 00:06:52 +01:00
Referenced by issue #96799, GPencil: Scripting weight_get cannot retrieve weights of certain vertex groups Referenced by issue #96241, 3.1: Potential candidates for corrective releases
|
@ -848,10 +848,10 @@ static float rna_GPencilStrokePoints_weight_get(bGPDstroke *stroke,
|
|||
}
|
||||
|
||||
MDeformVert *pt_dvert = stroke->dvert + point_index;
|
||||
if ((pt_dvert) && (pt_dvert->totweight <= vertex_group_index || vertex_group_index < 0)) {
|
||||
BKE_report(reports, RPT_ERROR, "Groups: index out of range");
|
||||
return -1.0f;
|
||||
}
|
||||
// if ((pt_dvert) && (pt_dvert->totweight <= vertex_group_index || vertex_group_index < 0)) {
|
||||
// BKE_report(reports, RPT_ERROR, "Groups: index out of range");
|
||||
// return -1.0f;
|
||||
// }
|
||||
|
||||
MDeformWeight *dw = BKE_defvert_find_index(pt_dvert, vertex_group_index);
|
||||
if (dw) {
|
||||
|
|
Loading…
Reference in New Issue