Fix #116477: Node group sockets with subtypes have broken idnames #117133

Merged
Lukas Tönne merged 7 commits from LukasTonne/blender:fix-node-socket-subtype-idnames into main 2024-01-16 15:32:43 +01:00
Member

Loading pre-4.0.20 node groups with sockets using subtypes causes
broken socket identifiers. This is because the node tree interface now
expects sockets to use the base identifiers ("NodeSocketFloat" instead
of "NodeSocketFloatFactor" etc.).

To correct this the conversion code now replaces socket idnames that
include a subtype suffix with their base names. This fix is also applied
to files between versions 4.0.20 and 4.1.10, where the socket types
may have been converted incorrectly.

Loading pre-4.0.20 node groups with sockets using subtypes causes broken socket identifiers. This is because the node tree interface now expects sockets to use the base identifiers ("NodeSocketFloat" instead of "NodeSocketFloatFactor" etc.). To correct this the conversion code now replaces socket idnames that include a subtype suffix with their base names. This fix is also applied to files between versions 4.0.20 and 4.1.10, where the socket types may have been converted incorrectly.
Lukas Tönne added 1 commit 2024-01-15 16:10:49 +01:00
da1cc3130a Fix #116477: Node group sockets with subtypes have broken idnames.
Loading pre-4.0.20 node groups with sockets using subtypes causes
broken socket identifiers. This is because the node tree interface now
expects sockets to use the base identifiers ("NodeSocketFloat" instead
of "NodeSocketFloatFactor" etc.).

To correct this the conversion code now replaces socket idnames that
include a subtype suffix with their base names. This fix is also applied
to files between versions 4.0.20 and 4.1.10, where the socket types
may have been converted incorrectly.
Lukas Tönne added 1 commit 2024-01-15 16:11:38 +01:00
Lukas Tönne requested review from Brecht Van Lommel 2024-01-15 16:11:54 +01:00
Lukas Tönne added 1 commit 2024-01-15 16:15:27 +01:00

How does this affect forward compatibility?

Does it change anything regarding how well older Blender versions can load .blend files with this fix?

How does this affect forward compatibility? Does it change anything regarding how well older Blender versions can load .blend files with this fix?
Author
Member

How does this affect forward compatibility?

Hmm good point. For pre-4.0 versions we reconstruct the old bNodeSocket ListBase interface during writing. This will now use only the base socket_type, discarding the subtype information. I will need to add a conversion there too, which takes the subtype into account when making the socket.idname for the old interface.

35e8959d77/source/blender/blenkernel/intern/node.cc (L511)

> How does this affect forward compatibility? Hmm good point. For pre-4.0 versions we reconstruct the old `bNodeSocket` `ListBase` interface during writing. This will now use only the base `socket_type`, discarding the subtype information. I will need to add a conversion there too, which takes the subtype into account when making the `socket.idname` for the old interface. https://projects.blender.org/blender/blender/src/commit/35e8959d77767f5bd349ea336f001f5b23ea5ba1/source/blender/blenkernel/intern/node.cc#L511
Lukas Tönne added 1 commit 2024-01-15 18:00:56 +01:00
5956fc2b33 Forward compatibility code for node group socket subtypes.
This augments the `idname` for legacy interface sockets with the subtype
as expected by pre-4.0 node trees.
Author
Member

I've added code that extends the legacy idname with the subtype for relevant socket types now.

I've added code that extends the legacy `idname` with the subtype for relevant socket types now.
Brecht Van Lommel requested review from Jacques Lucke 2024-01-15 19:40:28 +01:00
Brecht Van Lommel approved these changes 2024-01-15 19:40:59 +01:00
Brecht Van Lommel left a comment
Owner

I'm not super confident about my review so would not mind another pair of eyes.

I'm not super confident about my review so would not mind another pair of eyes.
@ -502,2 +503,4 @@
}
/* Include the subtype suffix for old socket idnames. */
static StringRef get_socket_subtype_idname(StringRef idname, const void *socket_data)

Can you put legacy in this function name?

So it's clear this does not have to be kept up to date or get used by new code.

Can you put `legacy` in this function name? So it's clear this does not have to be kept up to date or get used by new code.
LukasTonne marked this conversation as resolved
Lukas Tönne added 1 commit 2024-01-16 09:35:30 +01:00
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
56bfc71f02
Add "legacy" in forward compatibility function name.
Author
Member

For forward compatibility testing purposes: if you save this file before the patch and load it in 3.6, the socket subtypes will be reset to None (sockets named to indicate subtype). After the patch the correct subtype is loaded in 3.6.

For forward compatibility testing purposes: if you save this file before the patch and load it in 3.6, the socket subtypes will be reset to `None` (sockets named to indicate subtype). After the patch the correct subtype is loaded in 3.6.
Author
Member

@blender-bot build

@blender-bot build
Lukas Tönne added 1 commit 2024-01-16 10:56:02 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
2d8b75a7e3
Fix bl_node_group_compat test.
This test was incorrectly assuming that the interface `socket_idname`
matches the socket `idname`, but it generally should not include the
subtype any more.
Author
Member

@blender-bot build

@blender-bot build
Hans Goudey approved these changes 2024-01-16 15:21:13 +01:00
Lukas Tönne added 1 commit 2024-01-16 15:32:12 +01:00
Lukas Tönne merged commit 83d3ba8a58 into main 2024-01-16 15:32:43 +01:00
Lukas Tönne deleted branch fix-node-socket-subtype-idnames 2024-01-16 15:32:49 +01:00
Jacques Lucke approved these changes 2024-01-16 15:35:01 +01:00
@ -476,6 +476,7 @@ static void write_node_socket_interface(BlendWriter *writer, const bNodeSocket *
static bNodeSocket *make_socket(bNodeTree *ntree,
const eNodeSocketInOut in_out,
const StringRef idname,
Member

unnecessary newline

unnecessary newline
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#117133
No description provided.