From ac576bc05e65b5fecde7908ef42a46f92a805e4c Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Sun, 15 Feb 2026 21:23:38 -0600 Subject: [PATCH] Part: Migrate version check to ProgramVersion class Also add v1.2 to the recognized program version enumeration. --- src/Base/ProgramVersion.h | 2 ++ src/Mod/Part/App/AttachExtension.cpp | 9 +++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Base/ProgramVersion.h b/src/Base/ProgramVersion.h index f18ec2e62c..c635a8e805 100644 --- a/src/Base/ProgramVersion.h +++ b/src/Base/ProgramVersion.h @@ -43,6 +43,7 @@ enum class Version : std::uint8_t v0_22, v1_0, v1_1, + v1_2, v1_x, }; @@ -64,6 +65,7 @@ inline Version getVersion(std::string_view str) {.name="0.22", .version=Version::v0_22}, {.name="1.0" , .version=Version::v1_0 }, {.name="1.1" , .version=Version::v1_1 }, + {.name="1.2" , .version=Version::v1_2 }, }; // clang-format on auto it = std::ranges::find_if(items, [str](const auto& item) { diff --git a/src/Mod/Part/App/AttachExtension.cpp b/src/Mod/Part/App/AttachExtension.cpp index 5994b5bdb5..fa756e23e8 100644 --- a/src/Mod/Part/App/AttachExtension.cpp +++ b/src/Mod/Part/App/AttachExtension.cpp @@ -24,6 +24,7 @@ #include +#include #include #include @@ -522,12 +523,8 @@ void AttachExtension::handleLegacyTangentPlaneOrientation() } // check stored document program version (applies to v1.0 and earlier only) - int major, minor; - if (sscanf(getExtendedObject()->getDocument()->getProgramVersion(), "%d.%d", &major, &minor) - != 2) { - return; - } - if (major > 1 || (major == 1 && minor > 0)) { + if (Base::getVersion(getExtendedObject()->getDocument()->getProgramVersion()) + > Base::Version::v1_0) { return; }