From 6087a8b4a48509b1746719fd6a0a0c9fedea5d0e Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 1 Oct 2025 16:38:52 +0200 Subject: [PATCH] Fix #147119: Auto smooth modifier detection broken with packing The check for the essentials node group needs to be updated to look into the library for node group that's now linked instead of appended. Also fix missing redraws in the node editor with a more specific notifier. Pull Request: https://projects.blender.org/blender/blender/pulls/147130 --- source/blender/editors/object/object_edit.cc | 32 +++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/source/blender/editors/object/object_edit.cc b/source/blender/editors/object/object_edit.cc index 07e2f041dad..db015c1e049 100644 --- a/source/blender/editors/object/object_edit.cc +++ b/source/blender/editors/object/object_edit.cc @@ -1609,11 +1609,27 @@ static bool is_smooth_by_angle_modifier(const ModifierData &md) if (!nmd.node_group) { return false; } - const LibraryWeakReference *library_ref = nmd.node_group->id.library_weak_reference; - if (!library_ref) { + if (const LibraryWeakReference *library_ref = nmd.node_group->id.library_weak_reference) { + /* Support appended assets added before asset packing in Blender 5.0. */ + if (!library_ref) { + return false; + } + if (!STREQ(library_ref->library_id_name + 2, "Smooth by Angle")) { + return false; + } + return true; + } + const Library *library = nmd.node_group->id.lib; + if (!library) { return false; } - if (!STREQ(library_ref->library_id_name + 2, "Smooth by Angle")) { + if (!StringRef(library->filepath) + .endswith("datafiles/assets/geometry_nodes/geometry_nodes_essentials.blend")) + { + + return false; + } + if (!STREQ(BKE_id_name(nmd.node_group->id), "Smooth by Angle")) { return false; } return true; @@ -1644,8 +1660,6 @@ static wmOperatorStatus shade_smooth_exec(bContext *C, wmOperator *op) CTX_data_selected_editable_objects(C, &ctx_objects); } - bool modifier_removed = false; - Set object_data; for (const PointerRNA &ptr : ctx_objects) { Object *ob = static_cast(ptr.data); @@ -1658,7 +1672,7 @@ static wmOperatorStatus shade_smooth_exec(bContext *C, wmOperator *op) if (is_smooth_by_angle_modifier(*md)) { modifier_remove(op->reports, bmain, scene, ob, md); DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); - modifier_removed = true; + WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, ob); break; } } @@ -1699,11 +1713,6 @@ static wmOperatorStatus shade_smooth_exec(bContext *C, wmOperator *op) } } - if (modifier_removed) { - /* Outliner needs to know. #124302. */ - WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, nullptr); - } - if (has_linked_data) { BKE_report(op->reports, RPT_WARNING, "Cannot edit linked mesh or curve data"); } @@ -1915,6 +1924,7 @@ static wmOperatorStatus shade_auto_smooth_exec(bContext *C, wmOperator *op) LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) { if (is_smooth_by_angle_modifier(*md)) { modifier_remove(op->reports, &bmain, &scene, object, md); + WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object); break; } }