GP: Fix crash when select vertex group in modifiers

This commit is contained in:
2018-09-19 17:20:39 +02:00
parent 828c0e9813
commit 03bb7cd9ad
2 changed files with 12 additions and 2 deletions

View File

@@ -127,7 +127,7 @@ float get_modifier_point_weight(MDeformVert *dvert, bool inverse, int def_nr)
{
float weight = 1.0f;
if (def_nr != -1) {
if ((dvert != NULL) && (def_nr != -1)) {
MDeformWeight *dw = defvert_find_index(dvert, def_nr);
weight = dw ? dw->weight : -1.0f;
if ((weight >= 0.0f) && (inverse == 1)) {
@@ -145,6 +145,16 @@ float get_modifier_point_weight(MDeformVert *dvert, bool inverse, int def_nr)
}
/* handle special empty groups */
if ((dvert == NULL) && (def_nr != -1)) {
if (inverse == 1) {
return 1.0f;
}
else {
return -1.0f;
}
}
return weight;
}

View File

@@ -108,7 +108,7 @@ static void deformStroke(
for (int i = 0; i < gps->totpoints; i++) {
bGPDspoint *pt = &gps->points[i];
MDeformVert *dvert = &gps->dvert[i];
MDeformVert *dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
float curvef = 1.0f;
/* verify vertex group */
const float weight = get_modifier_point_weight(dvert, (mmd->flag & GP_THICK_INVERT_VGROUP) != 0, def_nr);