multiple duplication AutoSmooth modifier #120030

Open
opened 2024-03-28 19:24:22 +01:00 by Sergey Bogatchev · 12 comments

System Information
Operating system: Windows-10-10.0.17763-SP0 64 Bits
Graphics card: NVIDIA GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 536.23

Blender Version
Broken: version: 4.1.0, branch: blender-v4.1-release, commit date: 2024-03-25 20:42, hash: 40a5e739e270
Worked: 4.0.2
Short description of error
multiple duplication AutoSmooth modifier on linked localized objects saved in 4.0.2 / 3.6

Exact steps for others to reproduce the error

  • Open blender 4.0.2. Add cube. Sade smooth cube. Save file.
  • Open blender 4.1 Link object cube. Make Local cube. Save file. Open it file. See dublicating autosmooth every file opening and save.
**System Information** Operating system: Windows-10-10.0.17763-SP0 64 Bits Graphics card: NVIDIA GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 536.23 **Blender Version** Broken: version: 4.1.0, branch: blender-v4.1-release, commit date: 2024-03-25 20:42, hash: `40a5e739e270` Worked: 4.0.2 **Short description of error** multiple duplication AutoSmooth modifier on linked localized objects saved in 4.0.2 / 3.6 **Exact steps for others to reproduce the error** - Open blender 4.0.2. Add cube. Sade smooth cube. Save file. - Open blender 4.1 Link object cube. Make Local cube. Save file. Open it file. See dublicating autosmooth every file opening and save.
Sergey Bogatchev added the
Type
Report
Priority
Normal
Status
Needs Triage
labels 2024-03-28 19:24:23 +01:00

I don't think I can reproduce this issue. Do you identify this bug by cube shading/appearance?

I don't think I can reproduce this issue. Do you identify this bug by cube shading/appearance?

I don't think I can reproduce this issue. Do you identify this bug by cube shading/appearance?

> I don't think I can reproduce this issue. Do you identify this bug by cube shading/appearance?

Open in blender 4.1.0 test.blend file. Select cube. Make Local cube. Save file. Reopen test file. look at the number of modifiers....

Open in blender 4.1.0 test.blend file. Select cube. Make Local cube. Save file. Reopen test file. look at the number of modifiers....

I see now I think, I was confused by the auto smooth thing, because now this is done with modifiers and I could not see the auto smooth anywhere... Turns out this is added by versioning code. So it looks like, that you set auto smooth in 4.0 and then use this file in 4.1.

In any case, can reproduce.

I see now I think, I was confused by the auto smooth thing, because now this is done with modifiers and I could not see the auto smooth anywhere... Turns out this is added by versioning code. So it looks like, that you set auto smooth in 4.0 and then use this file in 4.1. In any case, can reproduce.

I have looked at the code quite quickly, I see, that flag is cleared in versioning, but not sure how this could be resolved if original file is not modifies when linking. Perhaps checking existing modifiers. That said, seems like Modelling module issue to me, so will assign report there.

I have looked at the code quite quickly, I see, that flag is cleared in versioning, but not sure how this could be resolved if original file is not modifies when linking. Perhaps checking existing modifiers. That said, seems like Modelling module issue to me, so will assign report there.
Richard Antalik added
Module
Modeling
Priority
High
Status
Confirmed
and removed
Priority
Normal
Status
Needs Triage
labels 2024-03-28 21:38:39 +01:00
Richard Antalik added the
Interest
Geometry Nodes
label 2024-03-28 22:05:12 +01:00
Member

Can confirm when object is local but mesh data is still linked.
cc @HooglyBoogly

Can confirm when object is local but mesh data is still linked. cc @HooglyBoogly
Hans Goudey self-assigned this 2024-04-03 01:57:52 +02:00
Member

Hmm, I can confirm this issue too. The problem is when the object is made local after the versioning runs. Then the object will be local but still reference the linked data-block from the library file. However, the node group added by versioning isn't really from the library, so we get this error: 1 linked data-blocks are missing.

Maybe there is a way to pack the versioning node group into the file so it isn't re-read from the library file incorrectly? @mont29, do you have an idea here?

Hmm, I can confirm this issue too. The problem is when the object is made local after the versioning runs. Then the object will be local but still reference the linked data-block from the library file. However, the node group added by versioning isn't *really* from the library, so we get this error: `1 linked data-blocks are missing`. Maybe there is a way to pack the versioning node group into the file so it isn't re-read from the library file incorrectly? @mont29, do you have an idea here?
Member

If we can get the modifier to load properly, the following might be necessary to avoid duplicates still:

diff --git a/source/blender/blenkernel/intern/mesh_legacy_convert.cc b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
index d38a612c52f..619cc00189e 100644
--- a/source/blender/blenkernel/intern/mesh_legacy_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
@@ -2431,6 +2431,15 @@ void BKE_main_mesh_legacy_convert_auto_smooth(Main &bmain)
           BLI_insertlinkbefore(&object->modifiers, object->modifiers.last, new_md);
         }
       }
+      if (md->type == eModifierType_Nodes) {
+        NodesModifierData *nmd = reinterpret_cast<NodesModifierData *>(md);
+        if (nmd->node_group && is_auto_smooth_node_tree(*nmd->node_group)) {
+          /* This object has already been processed by versioning. If the mesh is linked from
+           * another file its auto-smooth flag may not be cleared, so this check is necessary to
+           * avoid adding a duplicate modifier. */
+          has_custom_normals = true;
+        }
+      }
     }
 
     /* Some modifiers always generate custom normals which disabled sharp edge tagging, making
If we can get the modifier to load properly, the following might be necessary to avoid duplicates still: ```diff diff --git a/source/blender/blenkernel/intern/mesh_legacy_convert.cc b/source/blender/blenkernel/intern/mesh_legacy_convert.cc index d38a612c52f..619cc00189e 100644 --- a/source/blender/blenkernel/intern/mesh_legacy_convert.cc +++ b/source/blender/blenkernel/intern/mesh_legacy_convert.cc @@ -2431,6 +2431,15 @@ void BKE_main_mesh_legacy_convert_auto_smooth(Main &bmain) BLI_insertlinkbefore(&object->modifiers, object->modifiers.last, new_md); } } + if (md->type == eModifierType_Nodes) { + NodesModifierData *nmd = reinterpret_cast<NodesModifierData *>(md); + if (nmd->node_group && is_auto_smooth_node_tree(*nmd->node_group)) { + /* This object has already been processed by versioning. If the mesh is linked from + * another file its auto-smooth flag may not be cleared, so this check is necessary to + * avoid adding a duplicate modifier. */ + has_custom_normals = true; + } + } } /* Some modifiers always generate custom normals which disabled sharp edge tagging, making ```
Member

One hacky workaround might be checking for a modifier with the name "Auto Smooth" with a node group with LIB_TAG_MISSING.

One hacky workaround might be checking for a modifier with the name "Auto Smooth" with a node group with `LIB_TAG_MISSING`.

These kind of situations are indeed the cost of moving data from one ID type to another,,, There will always be corner-cases that cannot be handled nicely, if at all.

Here I can't think of any better idea than the hack suggested by @HooglyBoogly above, Though it may also backfire in some even more intricate cases, I think it's still a 'reasonable' one. :|

These kind of situations are indeed the cost of moving data from one ID type to another,,, There will always be corner-cases that cannot be handled nicely, if at all. Here I can't think of any better idea than the hack suggested by @HooglyBoogly above, Though it may also backfire in some even more intricate cases, I think it's still a 'reasonable' one. :|
Member

I think it's best to call this a known issue. I resolved part of the problem in 7ba8fc1768, but anything else is going to be too hacky.


The workaround in this case is to make both the object and the node group local, not just the object.

I think it's best to call this a known issue. I resolved part of the problem in 7ba8fc17682f510df60fa726e66dde353a8d4322, but anything else is going to be too hacky. --- The workaround in this case is to make *both* the object and the node group local, not just the object.
Hans Goudey added
Priority
Normal
Type
Known Issue
and removed
Priority
High
Type
Report
labels 2024-04-04 18:26:50 +02:00

corrections are not visible in the list of candidates...

corrections are not visible in the list of candidates...
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#120030
No description provided.