Fix #111332: 4.0 files cannot be opened in 3.6, invalid region types #111483

Merged
Julian Eisel merged 4 commits from JulianEisel/blender:temp-fix-invalid-region-type into blender-v3.6-release 2023-08-29 13:52:22 +02:00
Member

4.0 files now include asset shelf regions in 3D views. This region type is not
known to older Blender versions. So far, in such cases we would just change
the region type to be the first known region type and keep the region storage
otherwise. This was arbitrary, and in fact unsafe: the reused settings may
violate invariants/assumptions for a region type and worse, the
ARegion.regiondata can only be interpreted and correctly written to files
if the region type is known.

Case in point, in this specific case the asset shelf regions would be set to
use RGN_TYPE_XR or before that was introduced, RGN_TYPE_HUD. Both of
these are not designed to be used as regular regions. Plus, the asset shelf's
region data pointer would be written to files, for a now different region
type and without the necessary SDNA available.

Make sure all invalid regions (regions where the type cannot be restored) are
removed on file read. This is the only safe solution Bastien and I could see.

Note: This patch is made against the 3.6 branch. Should be ported to main
too (to provide a proper solution for future cases like this) but this will
cause conflicts.

4.0 files now include asset shelf regions in 3D views. This region type is not known to older Blender versions. So far, in such cases we would just change the region type to be the first known region type and keep the region storage otherwise. This was arbitrary, and in fact unsafe: the reused settings may violate invariants/assumptions for a region type and worse, the `ARegion.regiondata` can only be interpreted and correctly written to files if the region type is known. Case in point, in this specific case the asset shelf regions would be set to use `RGN_TYPE_XR` or before that was introduced, `RGN_TYPE_HUD`. Both of these are not designed to be used as regular regions. Plus, the asset shelf's region data pointer would be written to files, for a now different region type and without the necessary SDNA available. Make sure all invalid regions (regions where the type cannot be restored) are removed on file read. This is the only safe solution Bastien and I could see. Note: This patch is made against the 3.6 branch. Should be ported to `main` too (to provide a proper solution for future cases like this) but this will cause conflicts.
Julian Eisel added 3 commits 2023-08-24 18:12:12 +02:00
Julian Eisel requested review from Campbell Barton 2023-08-24 18:12:24 +02:00
Julian Eisel requested review from Bastien Montagne 2023-08-24 18:12:24 +02:00
Iliya Katushenock changed title from Fix 111332: 4.0 files cannot be opened in 3.6, invalid region types to Fix #111332: 4.0 files cannot be opened in 3.6, invalid region types 2023-08-24 18:20:52 +02:00
Bastien Montagne approved these changes 2023-08-25 11:18:12 +02:00
Bastien Montagne left a comment
Owner

LGTM.

LGTM.
Campbell Barton approved these changes 2023-08-29 08:55:52 +02:00
Campbell Barton left a comment
Owner

LGTM.

Tested with 4.0 files & 2.49x files (although those files contain space-types which have been removed, not regions.)

Very minor changed requested inline.

LGTM. Tested with 4.0 files & 2.49x files (although those files contain space-types which have been removed, not regions.) Very minor changed requested inline.
Campbell Barton reviewed 2023-08-29 08:57:31 +02:00
@ -1484,0 +1479,4 @@
continue;
}
printf("Error, region type %d missing in space type \"%s\" (id: %d) - removing region\n",

This should be made into a Warning as an error indicates something went wrong, when in fact this is expected when opening newer files.

It could even be suppressed when opening files when newer versions of Blender although I don't have such a strong opinion on this.

This should be made into a `Warning` as an error indicates something went wrong, when in fact this is expected when opening newer files. It could even be suppressed when opening files when newer versions of Blender although I don't have such a strong opinion on this.
JulianEisel marked this conversation as resolved
Julian Eisel added 1 commit 2023-08-29 11:58:44 +02:00
Julian Eisel merged commit e2d4403497 into blender-v3.6-release 2023-08-29 13:52:22 +02:00
Julian Eisel deleted branch temp-fix-invalid-region-type 2023-08-29 13:52:27 +02: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
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
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#111483
No description provided.