2026-02-16

This commit is contained in:
2026-03-17 15:25:32 -06:00
parent d5dd373de0
commit 60100fbab2
560 changed files with 33397 additions and 20776 deletions
@@ -0,0 +1,32 @@
"""Utility functions for AMZN Character Tools."""
import bpy
def get_addon_preferences():
"""Get the addon preferences, finding the correct addon identifier automatically.
Returns:
The addon preferences object, or None if not found.
"""
# Try common identifiers first
test_names = [
"bl_ext.vscode_development.AmazonCharacterTools", # Extension format
"amzncharactertools", # Manifest ID
"AmazonCharacterTools", # Module name
]
for addon_name in test_names:
addon_prefs = bpy.context.preferences.addons.get(addon_name)
if addon_prefs and hasattr(addon_prefs, 'preferences'):
# Verify it's our preferences class
if hasattr(addon_prefs.preferences, 'amzn_bsdf_materials_path'):
return addon_prefs.preferences
# If not found, search all addons for one with our preferences
for addon_name in bpy.context.preferences.addons.keys():
addon_prefs = bpy.context.preferences.addons.get(addon_name)
if addon_prefs and hasattr(addon_prefs, 'preferences'):
if hasattr(addon_prefs.preferences, 'amzn_bsdf_materials_path'):
return addon_prefs.preferences
return None