From 0681b531414c37158c40e6af360d09bd297463e2 Mon Sep 17 00:00:00 2001 From: Swann Date: Fri, 5 Nov 2021 15:39:46 +0100 Subject: [PATCH] fix: version check --- multi_user/bl_types/__init__.py | 2 +- multi_user/bl_types/bl_gpencil.py | 4 ++-- multi_user/bl_types/bl_lightprobe.py | 4 ++-- multi_user/bl_types/bl_object.py | 6 +++--- multi_user/environment.py | 2 +- multi_user/operators.py | 4 ++-- tests/test_bl_types/test_lightprobes.py | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/multi_user/bl_types/__init__.py b/multi_user/bl_types/__init__.py index dd79887..754819d 100644 --- a/multi_user/bl_types/__init__.py +++ b/multi_user/bl_types/__init__.py @@ -43,7 +43,7 @@ __all__ = [ "bl_particle", ] # Order here defines execution order -if bpy.app.version[1] >= 91: +if bpy.app.version >= (2,91,0): __all__.append('bl_volume') from . import * diff --git a/multi_user/bl_types/bl_gpencil.py b/multi_user/bl_types/bl_gpencil.py index 87aa200..8eab87f 100644 --- a/multi_user/bl_types/bl_gpencil.py +++ b/multi_user/bl_types/bl_gpencil.py @@ -53,12 +53,12 @@ STROKE = [ "uv_translation", "vertex_color_fill", ] -if bpy.app.version[1] >= 91: +if bpy.app.version >= (2,91,0): STROKE.append('use_cyclic') else: STROKE.append('draw_cyclic') -if bpy.app.version[1] >= 83: +if bpy.app.version >= (2,83,0): STROKE_POINT.append('vertex_color') def dump_stroke(stroke): diff --git a/multi_user/bl_types/bl_lightprobe.py b/multi_user/bl_types/bl_lightprobe.py index 009a77a..1bdabf6 100644 --- a/multi_user/bl_types/bl_lightprobe.py +++ b/multi_user/bl_types/bl_lightprobe.py @@ -37,7 +37,7 @@ class BlLightprobe(ReplicatedDatablock): def construct(data: dict) -> object: type = 'CUBE' if data['type'] == 'CUBEMAP' else data['type'] # See https://developer.blender.org/D6396 - if bpy.app.version[1] >= 83: + if bpy.app.version >= (2,83,0): return bpy.data.lightprobes.new(data["name"], type) else: logging.warning("Lightprobe replication only supported since 2.83. See https://developer.blender.org/D6396") @@ -49,7 +49,7 @@ class BlLightprobe(ReplicatedDatablock): @staticmethod def dump(datablock: object) -> dict: - if bpy.app.version[1] < 83: + if bpy.app.version < (2,83,0): logging.warning("Lightprobe replication only supported since 2.83. See https://developer.blender.org/D6396") dumper = Dumper() diff --git a/multi_user/bl_types/bl_object.py b/multi_user/bl_types/bl_object.py index bc3cad2..1d671be 100644 --- a/multi_user/bl_types/bl_object.py +++ b/multi_user/bl_types/bl_object.py @@ -48,7 +48,7 @@ SHAPEKEY_BLOCK_ATTR = [ ] -if bpy.app.version[1] >= 93: +if bpy.app.version >= (2,93,0): SUPPORTED_GEOMETRY_NODE_PARAMETERS = (int, str, float) else: SUPPORTED_GEOMETRY_NODE_PARAMETERS = (int, str) @@ -198,12 +198,12 @@ def find_data_from_name(name=None): instance = bpy.data.speakers[name] elif name in bpy.data.lightprobes.keys(): # Only supported since 2.83 - if bpy.app.version[1] >= 83: + if bpy.app.version >= (2,83,0): instance = bpy.data.lightprobes[name] else: logging.warning( "Lightprobe replication only supported since 2.83. See https://developer.blender.org/D6396") - elif bpy.app.version[1] >= 91 and name in bpy.data.volumes.keys(): + elif bpy.app.version >= (2,91,0) and name in bpy.data.volumes.keys(): # Only supported since 2.91 instance = bpy.data.volumes[name] return instance diff --git a/multi_user/environment.py b/multi_user/environment.py index dc4b13c..a748cbc 100644 --- a/multi_user/environment.py +++ b/multi_user/environment.py @@ -134,7 +134,7 @@ def install_modules(dependencies: list, python_path: str, install_dir: str): module_can_be_imported(package_name) def register(): - if bpy.app.version[1] >= 91: + if bpy.app.version >= (2,91,0): python_binary_path = sys.executable else: python_binary_path = bpy.app.binary_path_python diff --git a/multi_user/operators.py b/multi_user/operators.py index addd380..741effd 100644 --- a/multi_user/operators.py +++ b/multi_user/operators.py @@ -238,7 +238,7 @@ class SessionConnectOperator(bpy.types.Operator): settings.generate_supported_types() - if bpy.app.version[1] >= 91: + if bpy.app.version >= (2,91,0): python_binary_path = sys.executable else: python_binary_path = bpy.app.binary_path_python @@ -309,7 +309,7 @@ class SessionHostOperator(bpy.types.Operator): settings.generate_supported_types() - if bpy.app.version[1] >= 91: + if bpy.app.version >= (2,91,0): python_binary_path = sys.executable else: python_binary_path = bpy.app.binary_path_python diff --git a/tests/test_bl_types/test_lightprobes.py b/tests/test_bl_types/test_lightprobes.py index e5d27d6..4a5614e 100644 --- a/tests/test_bl_types/test_lightprobes.py +++ b/tests/test_bl_types/test_lightprobes.py @@ -7,7 +7,7 @@ import bpy from multi_user.bl_types.bl_lightprobe import BlLightprobe -@pytest.mark.skipif(bpy.app.version[1] < 83, reason="requires blender 2.83 or higher") +@pytest.mark.skipif(bpy.app.version < (2,83,0), reason="requires blender 2.83 or higher") @pytest.mark.parametrize('lightprobe_type', ['PLANAR','GRID','CUBEMAP']) def test_lightprobes(clear_blend, lightprobe_type): bpy.ops.object.lightprobe_add(type=lightprobe_type)