User Preferences should save in blenders user dictionary not in the Plugins Dictionary

This commit is contained in:
Yusarina
2025-03-31 13:03:37 +01:00
parent 77b7b429a5
commit 334f299e0e
+8 -3
View File
@@ -6,9 +6,14 @@ from ..core.logging_setup import logger
from bpy.types import AddonPreferences from bpy.types import AddonPreferences
from typing import Any, Dict from typing import Any, Dict
# Get the directory of the current file # Get the user preferences directory instead of addon directory
PREFERENCES_DIR = os.path.dirname(os.path.abspath(__file__)) def get_preferences_path():
PREFERENCES_FILE = os.path.join(PREFERENCES_DIR, "preferences.json") user_path = bpy.utils.resource_path('USER')
addon_prefs_dir = os.path.join(user_path, "config", "avatar_toolkit_prefs")
os.makedirs(addon_prefs_dir, exist_ok=True)
return os.path.join(addon_prefs_dir, "preferences.json")
PREFERENCES_FILE = get_preferences_path()
def get_current_version(): def get_current_version():
main_dir = os.path.dirname(os.path.dirname(__file__)) main_dir = os.path.dirname(os.path.dirname(__file__))