From 96bb18de1e130ae950bffe151799e1f84d87a025 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Wed, 1 Oct 2025 11:23:25 +0200 Subject: [PATCH] Nodes: add versioning to set new optional label flag for existing menu sockets Before this option existed, all menu sockets were drawn as if this setting was enabled. This patch sets this flag by default for all menu sockets to avoid changing the drawing of existing node group inputs. Ref: #146939 Pull Request: https://projects.blender.org/blender/blender/pulls/147107 --- .../blender/blenkernel/BKE_blender_version.h | 2 +- .../blenloader/intern/versioning_500.cc | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index b3df809b4db..e4e6999425b 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -27,7 +27,7 @@ /* Blender file format version. */ #define BLENDER_FILE_VERSION BLENDER_VERSION -#define BLENDER_FILE_SUBVERSION 96 +#define BLENDER_FILE_SUBVERSION 97 /* Minimum Blender version that supports reading file written with the current * version. Older Blender versions will test this and cancel loading the file, showing a warning to diff --git a/source/blender/blenloader/intern/versioning_500.cc b/source/blender/blenloader/intern/versioning_500.cc index 8c6e1fdea38..336b63c2386 100644 --- a/source/blender/blenloader/intern/versioning_500.cc +++ b/source/blender/blenloader/intern/versioning_500.cc @@ -3694,6 +3694,24 @@ void blo_do_versions_500(FileData *fd, Library * /*lib*/, Main *bmain) } } + if (!MAIN_VERSION_FILE_ATLEAST(bmain, 500, 97)) { + /* Enable new "Optional Label" setting for all menu sockets. This was implicit before. */ + FOREACH_NODETREE_BEGIN (bmain, tree, id) { + tree->tree_interface.foreach_item([&](bNodeTreeInterfaceItem &item) { + if (item.item_type != NODE_INTERFACE_SOCKET) { + return true; + } + auto &socket = reinterpret_cast(item); + if (!STREQ(socket.socket_type, "NodeSocketMenu")) { + return true; + } + socket.flag |= NODE_INTERFACE_SOCKET_OPTIONAL_LABEL; + return true; + }); + } + FOREACH_NODETREE_END; + } + /** * Always bump subversion in BKE_blender_version.h when adding versioning * code here, and wrap it inside a MAIN_VERSION_FILE_ATLEAST check.