fe8f5f69d5
- Re-wrote how the plugin registers itself. - No longer need @register_wrapper classes get auto detected and added. - The new Auto loader is much better then the old way, no longer need "if "bpy" not in locals():" this was an old way of doing things and wasn't really efficient. using auto_load.py provides several advantages: - It automatically discovers and loads all modules in the addon. - It handles dependencies between classes correctly through topological sorting. - It manages registration order automatically. - It properly handles unregistration in the correct order. This approach is much less error prone and I not had any issues so far. However it still needs testing fully. I have also start to re-organise files into folders as well, this is going to be needed so we don't have a long list of files as Avatar Toolkit is getting larger then i originally planned.
39 lines
1.5 KiB
Python
39 lines
1.5 KiB
Python
import bpy
|
|
from .main_panel import AvatarToolKit_PT_AvatarToolkitPanel, CATEGORY_NAME
|
|
from ..core.translations import t
|
|
|
|
class AvatarToolkitSettingsPanel(bpy.types.Panel):
|
|
bl_label = t("Settings.label")
|
|
bl_idname = "OBJECT_PT_avatar_toolkit_settings"
|
|
bl_space_type = 'VIEW_3D'
|
|
bl_region_type = 'UI'
|
|
bl_category = CATEGORY_NAME
|
|
bl_parent_id = AvatarToolKit_PT_AvatarToolkitPanel.bl_idname
|
|
bl_order = 8
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
|
|
layout.label(text=t("Settings.language.label"))
|
|
layout.prop(context.scene.avatar_toolkit, "language", text="", icon='WORLD')
|
|
|
|
class AVATAR_TOOLKIT_OT_translation_restart_popup(bpy.types.Operator):
|
|
bl_idname = "avatar_toolkit.translation_restart_popup"
|
|
bl_label = t("Settings.translation_restart_popup.label")
|
|
bl_description = t("Settings.translation_restart_popup.description")
|
|
bl_options = {'INTERNAL'}
|
|
|
|
def execute(self, context):
|
|
if context.scene.avatar_toolkit.language_changed:
|
|
bpy.ops.script.reload()
|
|
context.scene.avatar_toolkit.language_changed = False
|
|
return {'FINISHED'}
|
|
|
|
def invoke(self, context, event):
|
|
return context.window_manager.invoke_props_dialog(self, width=300)
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
layout.label(text=t("Settings.translation_restart_popup.message1"), icon='INFO')
|
|
layout.label(text=t("Settings.translation_restart_popup.message2"), icon='FILE_REFRESH')
|