Fix #116395: Auto smooth versioning modifier added unnecessarily
As mentioned in new code comments, the auto smooth behavior in 4.0 was to skip sharp angle tagging when the evaluated mesh had custom normals. There was already a check for custom normals on the original mesh (we can't access the evaluated mesh from versioning code). But that didn't handle cases where custom normals were created by modifiers (the normal edit and weighted normal modifiers). Now skip adding the new modifier when those modifiers come last in the stack. Alternatively we could check if they existed in the stack at all, but that seems a bit more risky.
This commit is contained in:
@@ -2250,8 +2250,17 @@ void BKE_main_mesh_legacy_convert_auto_smooth(Main &bmain)
|
||||
continue;
|
||||
}
|
||||
if (CustomData_has_layer(&mesh->corner_data, CD_CUSTOMLOOPNORMAL)) {
|
||||
/* Auto-smooth disabled sharp edge tagging when the evaluated mesh had custom normals.
|
||||
* When the original mesh has custom normals, that's a good sign the evaluated mesh will
|
||||
* have custom normals as well. */
|
||||
continue;
|
||||
}
|
||||
if (ModifierData *last_md = static_cast<ModifierData *>(object->modifiers.last)) {
|
||||
if (ELEM(last_md->type, eModifierType_WeightedNormal, eModifierType_NormalEdit)) {
|
||||
/* These modifiers always generate custom normals which disabled sharp edge tagging. */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!auto_smooth_node_tree) {
|
||||
auto_smooth_node_tree = add_auto_smooth_node_tree(bmain);
|
||||
BKE_ntree_update_main_tree(&bmain, auto_smooth_node_tree, nullptr);
|
||||
|
||||
Reference in New Issue
Block a user