Fix #129207: GPv3: Linked GPv2 objects disappear when reopening file. #129220

Merged
Bastien Montagne merged 2 commits from mont29/blender:tmp-gpv3-link-gpv2-obdata into main 2024-10-21 11:13:48 +02:00

This happens because blender 4.3 only knows about GPv3 IDs, and
therefore stores a reference to a directly linked GPv2 obdata as a GPv3
one, which cannot be found again on next file load in the GPv2 library.

The idea of this fix is, if the lookup of an idcode+idname fails, to also
search for the same name but with an older, deprecated ID code.

This happens because blender 4.3 only knows about GPv3 IDs, and therefore stores a reference to a directly linked GPv2 obdata as a GPv3 one, which cannot be found again on next file load in the GPv2 library. The idea of this fix is, if the lookup of an idcode+idname fails, to also search for the same name but with an older, deprecated ID code.
Bastien Montagne added 1 commit 2024-10-18 16:49:52 +02:00
Fix #129207: GPv3: Linked GPv2 objects disappear when reopening file.
Some checks failed
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
a9605b841f
This happens because blender 4.3 only knows about GPv3 IDs, and
therefore stores a reference to a directly linked GPv2 obdata as a GPv3
one, which cannot be found again on next file load in the GPv2 library.

The idea of this fix is, if the looup of a idcode+idname fails, to also
search for the same name but with an older, deprecated ID code.
Author
Owner

@blender-bot build

@blender-bot build
Bastien Montagne requested review from Sergey Sharybin 2024-10-18 16:50:22 +02:00
Bastien Montagne requested review from Falk David 2024-10-18 16:50:22 +02:00
Author
Owner

@Sergey pulling you in here as this affects quite low-level aspect of our readfile code.

TBH I do not know how I feel about this solution. On one hand it's fairly simple and I do not really see how it could turn bad/cause issues. On the other hand, it feels fuzzy and hard to foresee all potential consequences.

We could also have a more restricted and controlled way to do this fallback-lookup, but that would be more involved to find all places that need it, and would not solve the root 'weirdness' of loading a different ID type than the one required.

Or we could also just decide that this is a corner case and accept the current behavior... People should link Objects or Collections anyway, usually not obdata. ;)

@Sergey pulling you in here as this affects quite low-level aspect of our readfile code. TBH I do not know how I feel about this solution. On one hand it's fairly simple and I do not really see how it could turn bad/cause issues. On the other hand, it feels fuzzy and hard to foresee all potential consequences. We could also have a more restricted and controlled way to do this fallback-lookup, but that would be more involved to find all places that need it, and would not solve the root 'weirdness' of loading a different ID type than the one required. Or we could also just decide that this is a corner case and accept the current behavior... People should link Objects or Collections anyway, usually _not_ obdata. ;)
Sergey Sharybin reviewed 2024-10-18 17:12:06 +02:00
Sergey Sharybin left a comment
Owner

I can not think of any ceses where it could fail. It is also probably something we'd need in the future when we'd be removing legacy curves?

Alternative would be to forbid linking legacy IDs to avoid situations when non-informed artist might loose their work.

I can not think of any ceses where it could fail. It is also probably something we'd need in the future when we'd be removing legacy curves? Alternative would be to forbid linking legacy IDs to avoid situations when non-informed artist might loose their work.
@ -50,0 +54,4 @@
/* ID_GD_LEGACY (Grease Pencil v2) is now converted to ID_GP (Grease Pencil v3). */
return ID_GD_LEGACY;
default:
return 0;

Should it be ID_LINK_PLACEHOLDER? Otherwise it is a bit unclear for a reader that it is the same thing (return 0 here, and ID_LINK_PLACEHOLDER in the caller).

Should it be `ID_LINK_PLACEHOLDER`? Otherwise it is a bit unclear for a reader that it is the same thing (return 0 here, and `ID_LINK_PLACEHOLDER` in the caller).
Author
Owner

Indeed.... forgot that one when I did the renaming :|

Indeed.... forgot that one when I did the renaming :|
mont29 marked this conversation as resolved
@ -27,0 +38,4 @@
* \returns The old, deprecated ID type code if any matches the given `id_code_new` one, otherwise
* `ID_LINK_PLACEHOLDER`.
*/
short do_versions_new_to_old_idcode_get(const short id_code_new);

const in declaration is meaningless, think clang-tidy even generates a warning about it.

`const` in declaration is meaningless, think clang-tidy even generates a warning about it.
mont29 marked this conversation as resolved
Falk David refused to review 2024-10-18 18:03:15 +02:00
Member

I'm not familiar with this part of the code, so I think it's better that others comment on it.

I'm not familiar with this part of the code, so I think it's better that others comment on it.
Bastien Montagne added 1 commit 2024-10-18 18:06:36 +02:00
Fixes from review.
All checks were successful
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
35e4aeb86a
Author
Owner

@blender-bot build

@blender-bot build
Sergey Sharybin approved these changes 2024-10-21 09:55:28 +02:00
Bastien Montagne merged commit 7937a7eadf into main 2024-10-21 11:13:48 +02:00
Bastien Montagne deleted branch tmp-gpv3-link-gpv2-obdata 2024-10-21 11:13:53 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
3 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#129220
No description provided.