Skip to content

Commit

Permalink
Remove Blender version hard requirement
Browse files Browse the repository at this point in the history
From now own Malt can work with any future version as long as there's no
Blender Python API breakage.
  • Loading branch information
pragma37 committed Jul 20, 2024
1 parent 43b25c0 commit d92263d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/BlenderMalt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ jobs:
body: |
[**BlenderMalt-Windows.zip**](https://github.com/${{github.repository}}/releases/download/${{env.BRANCH_NAME}}-latest/BlenderMalt-Windows.zip)
[**BlenderMalt-Linux.zip**](https://github.com/${{github.repository}}/releases/download/${{env.BRANCH_NAME}}-latest/BlenderMalt-Linux.zip)
*(Requires Blender 4.1)*
- name: Rollback Tagged Release
uses: author/action-rollback@stable
Expand All @@ -56,7 +55,6 @@ jobs:
[**BlenderMalt-Windows.zip**](https://github.com/${{github.repository}}/releases/download/${{github.ref_name}}/BlenderMalt-Windows.zip)
[**BlenderMalt-Linux.zip**](https://github.com/${{github.repository}}/releases/download/${{github.ref_name}}/BlenderMalt-Linux.zip)
*(Requires Blender 4.1)*
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
Expand Down
20 changes: 4 additions & 16 deletions BlenderMalt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@
from os import path
import bpy

def version_missmatch():
return bpy.app.version[:2] != bl_info['blender'][:2]
def version_missmatch_message():
if version_missmatch():
v = bl_info['blender']
return f"Malt loading aborted. The installed Malt version only works with Blender {v[0]}.{v[1]}"

#Add Malt and dependencies to the import path
__CURRENT_DIR = path.dirname(path.realpath(__file__))
__MALT_PATH = path.join(__CURRENT_DIR, '.MaltPath')
Expand Down Expand Up @@ -63,10 +56,6 @@ def update_debug_mode(self, context):
def draw(self, context):
layout = self.layout

if version_missmatch():
layout.label(text=version_missmatch_message(), icon='ERROR')
return

if context.scene.render.engine == 'MALT':
layout.operator('wm.path_open', text="Open Session Log").filepath=sys.stdout.log_path
else:
Expand Down Expand Up @@ -130,9 +119,12 @@ def do_windows_fixes():
if platform.system() == 'Windows':
sys.executable = sys._base_executable
# Use python-gpu on windows (patched python with NvOptimusEnablement and AmdPowerXpressRequestHighPerformance)
python_gpu_path = path.join(__MALT_DEPENDENCIES_PATH, 'python-gpu-{}.exe'.format(_PY_VERSION))
if os.path.exists(python_gpu_path) == False:
print(f"MALT WARNING: python-gpu-{_PY_VERSION}.exe not found. Performance might be affected.")
return
python_executable = path.join(sys.exec_prefix, 'bin', 'python-gpu-{}.exe'.format(_PY_VERSION))
if os.path.exists(python_executable) == False:
python_gpu_path = path.join(__MALT_DEPENDENCIES_PATH, 'python-gpu-{}.exe'.format(_PY_VERSION))
try:
copy(python_gpu_path, python_executable)
except PermissionError as e:
Expand Down Expand Up @@ -201,10 +193,6 @@ def get_modules():

def register():
for _class in classes: bpy.utils.register_class(_class)

if version_missmatch():
print(version_missmatch_message())
return

import importlib
for module in get_modules():
Expand Down

0 comments on commit d92263d

Please sign in to comment.