From cc6d977edc7fa617f441d149ec5d597e9ab2ff13 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sun, 28 Feb 2021 12:32:29 -0800 Subject: [PATCH] Relax minimum blender requirement, add constants to easily update blender version --- hecl/blender/hecl_blendershell.py | 8 +++++--- hecl/lib/Blender/Connection.cpp | 7 ++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/hecl/blender/hecl_blendershell.py b/hecl/blender/hecl_blendershell.py index f3454e7e8..7af8a934f 100644 --- a/hecl/blender/hecl_blendershell.py +++ b/hecl/blender/hecl_blendershell.py @@ -7,6 +7,8 @@ def _quitblender(): bpy.ops.wm.quit_blender() quit() +MIN_BLENDER_MAJOR = 2 +MIN_BLENDER_MINOR = 83 # Extract pipe file descriptors from arguments print('HECL Blender Launch', sys.argv) if '--' not in sys.argv: @@ -57,9 +59,9 @@ class PathHasher: read_str = readpipestr() return int(read_str[0:8], 16) -# Ensure Blender 2.90+ is being used -if bpy.app.version < (2, 90, 0): - writepipestr(b'NOT290') +# Ensure Blender 2.83+ is being used +if bpy.app.version < (MIN_BLENDER_MAJOR, MIN_BLENDER_MINOR, 0): + writepipestr(b'INVALIDBLENDERVER') _quitblender() # If there's a third argument, use it as the .zip path containing the addon diff --git a/hecl/lib/Blender/Connection.cpp b/hecl/lib/Blender/Connection.cpp index 0e1b17bff..4aff5250d 100644 --- a/hecl/lib/Blender/Connection.cpp +++ b/hecl/lib/Blender/Connection.cpp @@ -50,7 +50,7 @@ namespace hecl::blender { static const uint32_t MinBlenderMajorSearch = 2; static const uint32_t MaxBlenderMajorSearch = 2; -static const uint32_t MinBlenderMinorSearch = 90; +static const uint32_t MinBlenderMinorSearch = 83; static const uint32_t MaxBlenderMinorSearch = 91; logvisor::Module BlenderLog("hecl::blender::Connection"); @@ -547,9 +547,10 @@ Connection::Connection(int verbosityLevel) { else BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to find blender at '{}'")), DEFAULT_BLENDER_BIN); #endif - } else if (lineStr == "NOT290") { + } else if (lineStr == "INVALIDBLENDERVER") { _closePipe(); - BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Installed blender version must be >= 2.90"))); + BlenderLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Installed blender version must be >= {}.{}")), + MinBlenderMajorSearch, MinBlenderMinorSearch); } else if (lineStr == "NOADDON") { _closePipe(); if (blenderAddonPath != _SYS_STR("SKIPINSTALL"))