Let's not use System path

This commit is contained in:
Yusarina
2025-03-27 20:16:27 +00:00
parent 02c73ccd2a
commit 357aa1b6d9
2 changed files with 72 additions and 127 deletions
+12 -11
View File
@@ -13,7 +13,6 @@ def show_version_error_popup():
bpy.context.window_manager.popup_menu(draw, title="Avatar Toolkit Version Error", icon='ERROR')
def register():
# Check Blender version first
import bpy
version = bpy.app.version
if version[0] > 4 or (version[0] == 4 and version[1] >= 5):
@@ -24,27 +23,29 @@ def register():
try:
import lz4
except ImportError:
import sys
import os
import site
import pip
wheels_dir = os.path.join(os.path.dirname(__file__), "wheels")
for wheel in os.listdir(wheels_dir):
if wheel.endswith(".whl"):
pip.main(['install', os.path.join(wheels_dir, wheel)])
site.addsitedir(site.getsitepackages()[0])
if os.path.exists(wheels_dir):
for wheel in os.listdir(wheels_dir):
if wheel.endswith(".whl"):
pip.main(['install', os.path.join(wheels_dir, wheel)])
# Refresh site packages without modifying sys.path
site.addsitedir(site.getsitepackages()[0])
from .core import auto_load
print("Starting registration")
# Make sure to initialize logging first
# Import modules using relative imports
from . import core
from .core import auto_load
from .core.logging_setup import configure_logging
# Initialize logging
configure_logging(False)
# Then initialize the addon
auto_load.init()
# Register classes in proper order
auto_load.register()
# Verify property registration