forked from bartvdbraak/blender
Fix #31743: Applying Smooth modifier to a curve crashes Blender
Actually there were two different issues involved here: - Recently enabled Smooth modifier wasn't actually designed for curves, so it in fact requires a bit bigger work to make it working. For now added check for object's typy in this modifier and if it's not mesh, it wouldn't try to use edges. The reason why it worked in 3d viewport is that creating DM from curve while displist is still ocntrcuting for would result in empty CDDM and that leads to not taking edges into account, only vertexCos passed to modifier would be used. This makes it behaving a bit differently from if it was a mesh, but still gives quite reasonable result. Would leave actual fix for a guy who enabled smooth modifier. - Another issue is related on ensuring sculpt mask layer after applying modifier. This shall happen only for meshes.
This commit is contained in:
parent
54297c8d13
commit
87211a49ab
@ -642,8 +642,10 @@ int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, Modi
|
||||
BLI_remlink(&ob->modifiers, md);
|
||||
modifier_free(md);
|
||||
|
||||
/* ensure mesh paint mask layer remains after applying */
|
||||
ED_sculpt_mask_layers_ensure(ob, NULL);
|
||||
if (ob->type == OB_MESH) {
|
||||
/* ensure mesh paint mask layer remains after applying */
|
||||
ED_sculpt_mask_layers_ensure(ob, NULL);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -118,8 +118,14 @@ static void smoothModifier_do(
|
||||
fac = smd->fac;
|
||||
facm = 1 - fac;
|
||||
|
||||
medges = dm->getEdgeArray(dm);
|
||||
numDMEdges = dm->getNumEdges(dm);
|
||||
if (ob->type == OB_MESH) {
|
||||
medges = dm->getEdgeArray(dm);
|
||||
numDMEdges = dm->getNumEdges(dm);
|
||||
}
|
||||
else {
|
||||
medges = NULL;
|
||||
numDMEdges = 0;
|
||||
}
|
||||
|
||||
modifier_get_vgroup(ob, dm, smd->defgrp_name, &dvert, &defgrp_index);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user