This commit is contained in:
Yusarina
2024-10-22 00:08:07 +01:00
parent 2e06cc9945
commit 1b908a4200
4 changed files with 100 additions and 14 deletions
+8
View File
@@ -1,5 +1,6 @@
import bpy
import os
import toml
import json
from bpy.types import AddonPreferences
from typing import Any, Dict
@@ -8,6 +9,13 @@ from typing import Any, Dict
PREFERENCES_DIR = os.path.dirname(os.path.abspath(__file__))
PREFERENCES_FILE = os.path.join(PREFERENCES_DIR, "preferences.json")
def get_current_version():
main_dir = os.path.dirname(os.path.dirname(__file__))
manifest_path = os.path.join(main_dir, "blender_manifest.toml")
with open(manifest_path, 'r') as f:
manifest_data = toml.load(f)
return manifest_data.get('version', 'Unknown')
def save_preference(key: str, value: Any) -> None:
"""Save a single preference to the JSON file."""
prefs = load_preferences()