Auto Smooth versioning modifiers appearing on Append #119447

Closed
opened 2024-03-14 03:16:32 +01:00 by Demeter Dzadik · 11 comments
Member

Blender Version
Broken: version: 4.2.0 Alpha, branch: main, commit date: 2024-03-12 22:12, hash: 443ea628c5c8
Worked: I think this wasn't happening on the previous buildbot 4.2 build, so, the one from 13 March.

Short description of error
Some objects of our character keeps getting new Auto Smooth modifiers added to it whenever they are appended to another file.

Exact steps for others to reproduce the error

  • File: have_you_heard_of_our_lord_and_savior_auto_smooth.blend
  • The file was opened and saved with latest Blender, although these objects were originally created before the Auto Smooth changes.
  • Append or copy paste the objects to another file.
  • Auto Smooth modifiers appear, as if the objects came from a version of blender pre-auto smooth rework.

This is currently breaking our pipeline so an urgent fix would be nice.

**Blender Version** Broken: version: 4.2.0 Alpha, branch: main, commit date: 2024-03-12 22:12, hash: `443ea628c5c8` Worked: I think this wasn't happening on the previous buildbot 4.2 build, so, the one from 13 March. **Short description of error** Some objects of our character keeps getting new Auto Smooth modifiers added to it whenever they are appended to another file. **Exact steps for others to reproduce the error** - File: [have_you_heard_of_our_lord_and_savior_auto_smooth.blend](/attachments/6614f26e-a4eb-489d-8d9a-752894849c03) - The file was opened and saved with latest Blender, although these objects were originally created before the Auto Smooth changes. - Append or copy paste the objects to another file. - Auto Smooth modifiers appear, as if the objects came from a version of blender pre-auto smooth rework. This is currently breaking our pipeline so an urgent fix would be nice.
Demeter Dzadik added the
Type
Report
Status
Needs Triage
Priority
Normal
labels 2024-03-14 03:16:33 +01:00
Member

Hi, auto smooth versioning code for link/append is added in 3c3f1e6d62

Hi, auto smooth versioning code for link/append is added in 3c3f1e6d62e2dadb9cc3aa230033647d441b0a7b
Hans Goudey self-assigned this 2024-03-14 04:15:54 +01:00
Member

I'll work on this tomorrow morning. If someone else gets to it first that's okay though of course.

I'll work on this tomorrow morning. If someone else gets to it first that's okay though of course.
Pratik Borhade added
Module
Modeling
Priority
High
Status
Confirmed
and removed
Priority
Normal
Status
Needs Triage
labels 2024-03-14 04:25:19 +01:00
Member

I'll check. I think we can get the library file version from lapp_context then skip the versioning if > 400

I'll check. I think we can get the library file version from lapp_context then skip the versioning if > 400
Member

I'm not sure how this situation has occurred. AFAICS, we're already clearing ME_AUTOSMOOTH_LEGACY flag from the mesh when file with old autosmooth is loaded and saved in 4.1/4.2.

If I open your file in 4.0 then auto smooth toggle is enabled. Maybe !119449 is not required

I'm not sure how this situation has occurred. AFAICS, we're already clearing `ME_AUTOSMOOTH_LEGACY` flag from the mesh when file with `old autosmooth` is loaded and saved in 4.1/4.2. If I open your file in 4.0 then `auto smooth` toggle is enabled. Maybe !119449 is not required

@Mets do you have the version of this file before opening & saving in recent Blender? What we need to understand here is why the conversion of these meshes from legacy auto-smooth to modifier did not happen...

To be clear, given current state of data, the behavior of the append code is correct and totally expected.

@Mets do you have the version of this file before opening & saving in recent Blender? What we need to understand here is why the conversion of these meshes from legacy auto-smooth to modifier did not happen... To be clear, given current state of data, the behavior of the append code is correct and totally expected.
Author
Member

Yep, I have versions going back to Nov 17, each version being saved with some blender version that was latest nightly build at that time.
But for the life of me I can't find the date of the original autosmooth versioning commit, and its date... ;_; plz help

Yep, I have versions going back to Nov 17, each version being saved with some blender version that was latest nightly build at that time. But for the life of me I can't find the date of the original autosmooth versioning commit, and its date... ;_; plz help
Member
  • 89e3ba4e25 was the original commit introducing the versioning (October 20)
  • b0cb58ca0e fixed the versioning to clear the auto smooth setting from versioned objects (November 26)

If the versioning to 4.1 happened between those two commits, the new modifier wouldn't have been added but the old "hidden" auto smooth flag would still be set. That's how we would have got into this situation.

I still think it's better to be safe and not process existing objects like is done in #119467.

- 89e3ba4e25c9ff921b2584c294cbc38c3d344c34 was the original commit introducing the versioning (October 20) - b0cb58ca0e7ba925ab22355e140064965213d2e1 fixed the versioning to clear the auto smooth setting from versioned objects (November 26) If the versioning to 4.1 happened between those two commits, the new modifier wouldn't have been added but the old "hidden" auto smooth flag would still be set. That's how we would have got into this situation. I still think it's better to be safe and not process existing objects like is done in #119467.

Let's use this task as central info point?

Known issues so far

  1. Some Mesh IDs may still have their AUTOSMOOTH flag set, even though some of the Object IDs using them may have been converted and already have the expected modifier instead.
    There are at least two ways to reach this situation: some in-dev versions of Blender would not clear the autosmooth flag after conversion, and some objects using linked meshes from other library.
  2. In case of a mesh being used by more than one object, only the first object using it will get the new modifier at conversion.
  3. In link/append case, the code will add a new nodetree every time a new link/append operation is performed on data that needs conversion.
  4. NodeTree is always created as local data, so linked objects will end up using a local nodetree for their new modifier. This is likely the worst issue currently in term of sanity and consistency of the whole data-base.

Proposed solutions

#2 is trivial to fix (see !119471), but imho the best way to address it is to systematically clear the AUTOSMOOTH flag on all meshes after running conversion. This will also solve (most of) #1 issues (some linking-related scenarii are not solvable at all imho, but think they are rare enough in practice, that we can accept the 'loss of autosmooth data' for them).

#3 IMHO should not be too hard to solve? Code could simply lookup in existing nodetrees one that would match (based on name, or whast is in the node tree, and its library), before creating a new one?

#4 is (relatively) trivial to fix now in main, using the new BKE_id_new_in_lib functions. In 4.1, I can only think of creating a local nodetree, assigning the library to it, and re-running the uniquename/sorting code (BKE_id_new_name_validate) on it to ensure it ends up where it should and does have a unique name in the library namespace.

Let's use this task as central info point? ### Known issues so far 1. Some Mesh IDs may still have their `AUTOSMOOTH` flag set, even though some of the Object IDs using them may have been converted and already have the expected modifier instead. _There are at least two ways to reach this situation: some in-dev versions of Blender would not clear the autosmooth flag after conversion, and some objects using linked meshes from other library._ 2. In case of a mesh being used by more than one object, only the first object using it will get the new modifier at conversion. 3. In link/append case, the code will add a new nodetree every time a new link/append operation is performed on data that needs conversion. 4. NodeTree is always created as local data, so linked objects will end up using a local nodetree for their new modifier. This is likely the worst issue currently in term of sanity and consistency of the whole data-base. ### Proposed solutions #2 is trivial to fix (see !119471), but imho the best way to address it is to systematically clear the `AUTOSMOOTH` flag on all meshes after running conversion. This will also solve (most of) #1 issues (_some linking-related scenarii are not solvable at all imho, but think they are rare enough in practice, that we can accept the 'loss of autosmooth data' for them_). #3 IMHO should not be _too_ hard to solve? Code could simply lookup in existing nodetrees one that would match (based on name, or whast is in the node tree, and its library), before creating a new one? #4 is (relatively) trivial to fix now in `main`, using the new `BKE_id_new_in_lib` functions. In 4.1, I can only think of creating a local nodetree, assigning the library to it, and re-running the uniquename/sorting code (`BKE_id_new_name_validate`) on it to ensure it ends up where it should and does have a unique name in the library namespace.
Member

Thanks so much for writing that all down. I agree with your points and it sounds like a good plan. I'll work on implementing this tomorrow morning.

Thanks so much for writing that all down. I agree with your points and it sounds like a good plan. I'll work on implementing this tomorrow morning.
Member
5bfe6ad8f8ce5b6b7fcfdaa011ff1e9d7c75f429
Member

Just to clarify, in this case the modifier will be added again to these objects since the flag wasn't cleared properly by the initial versioning and the modifiers were removed in the meantime. After that everything should work properly though.

Just to clarify, in this case the modifier will be added again to these objects since the flag wasn't cleared properly by the initial versioning and the modifiers were removed in the meantime. After that everything should work properly though.
Blender Bot added
Status
Archived
and removed
Status
Confirmed
labels 2024-03-18 21:47:52 +01:00
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
4 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#119447
No description provided.