Skip to content

Commit

Permalink
Make addon version check universal
Browse files Browse the repository at this point in the history
  • Loading branch information
vanous committed Jun 2, 2024
1 parent b84a6e8 commit 5dfa576
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
17 changes: 17 additions & 0 deletions blender_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import glob
import sys
import importlib
import toml
import bpy

from .i18n import DMX_Lang

Expand Down Expand Up @@ -124,3 +126,18 @@ def reload_addon():
except Exception as e:
return SimpleNamespace(ok=False, error=str(e))
return SimpleNamespace(ok=True, error="")

def get_extension_manifest():
folder_path = os.path.dirname(os.path.realpath(__file__))
toml_path = os.path.join(folder_path, "blender_manifest.toml")
data=toml.load(toml_path)
return data

def get_application_version():
if bpy.app.version > (4, 1):
data = get_extension_manifest()
version = data["version"]
return tuple(version.split("."))
else:
from . import bl_info as application_info
return application_info["version"]
4 changes: 1 addition & 3 deletions panels/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from ..gdtf import *
from ..panels import profiles as Profiles
from .. import blender_utils as blender_utils
#from .. import bl_info as application_info
from bpy.props import (StringProperty, CollectionProperty)
from ..logging import DMX_Log

Expand Down Expand Up @@ -338,8 +337,7 @@ def callback(self, data, context):
text = data["error"]
else:
try:
#current_version = application_info["version"]
current_version = 1
current_version = blender_utils.get_application_version()
new_version = data["name"]
res = blender_utils.version_compare(current_version, new_version)
except Exception as e:
Expand Down

0 comments on commit 5dfa576

Please sign in to comment.