Merge branch 'main' into main

This commit is contained in:
Yusarina
2024-07-22 22:16:55 +01:00
committed by GitHub
4 changed files with 52 additions and 2 deletions
+35
View File
@@ -6,6 +6,7 @@ from ..functions.translations import t
from ..core.import_pmx import import_pmx
from ..core.import_pmd import import_pmd
from ..core.importer import import_fbx
@register_wrap
class AvatarToolkitQuickAccessPanel(bpy.types.Panel):
@@ -48,6 +49,7 @@ class AVATAR_TOOLKIT_OT_import_menu(bpy.types.Operator):
layout.label(text="Select Import Method")
layout.operator("avatar_toolkit.import_pmx", text=t("Quick_Access.import_pmx"))
layout.operator("avatar_toolkit.import_pmd", text=t("Quick_Access.import_pmd"))
layout.operator("avatar_toolkit.import_fbx", text="Import FBX")
@register_wrap
class AVATAR_TOOLKIT_OT_export_menu(bpy.types.Operator):
@@ -55,6 +57,10 @@ class AVATAR_TOOLKIT_OT_export_menu(bpy.types.Operator):
bl_label = t("Quick_Access.export_menu.label")
bl_description = t("Quick_Access.import_pmx.desc")
@classmethod
def poll(cls, context):
return any(obj.type == 'MESH' for obj in context.scene.objects)
def execute(self, context: Context):
return {'FINISHED'}
@@ -66,6 +72,7 @@ class AVATAR_TOOLKIT_OT_export_menu(bpy.types.Operator):
layout = self.layout
layout.label(text=t("Quick_Access.select_export.label"))
layout.operator("avatar_toolkit.export_resonite", text=t("Quick_Access.select_export_resonite.label"))
layout.operator("avatar_toolkit.export_fbx", text="Export FBX")
@register_wrap
class AVATAR_TOOLKIT_OT_import_pmx(bpy.types.Operator):
@@ -96,3 +103,31 @@ class AVATAR_TOOLKIT_OT_import_pmd(bpy.types.Operator):
def invoke(self, context: Context, event):
context.window_manager.fileselect_add(self)
return {'RUNNING_MODAL'}
@register_wrap
class AVATAR_TOOLKIT_OT_import_fbx(bpy.types.Operator):
bl_idname = "avatar_toolkit.import_fbx"
bl_label = "Import FBX"
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
def execute(self, context):
import_fbx(self.filepath)
return {'FINISHED'}
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
return {'RUNNING_MODAL'}
@register_wrap
class AVATAR_TOOLKIT_OT_export_fbx(bpy.types.Operator):
bl_idname = 'avatar_toolkit.export_fbx'
bl_label = "Export FBX"
bl_description = "Export the model as FBX"
bl_options = {'REGISTER', 'UNDO', 'INTERNAL'}
def execute(self, context):
bpy.ops.export_scene.fbx('INVOKE_DEFAULT')
return {'FINISHED'}
-1
View File
@@ -37,4 +37,3 @@ class AVATAR_TOOLKIT_OT_translation_restart_popup(bpy.types.Operator):
layout = self.layout
layout.label(text=t("Settings.translation_restart_popup.message1"))
layout.label(text=t("Settings.translation_restart_popup.message2"))