FBX Import
- Add's the ability to import FBX Models.
This commit is contained in:
@@ -0,0 +1,17 @@
|
|||||||
|
import bpy
|
||||||
|
|
||||||
|
# Importers which don't need much code should be added here, however if a importer needs alot of code
|
||||||
|
# Like the PMX and PMD importers, they should be added to their own files.
|
||||||
|
|
||||||
|
|
||||||
|
# FBX Importer settings borrowed form Cat's Blender Plugin
|
||||||
|
def import_fbx(filepath):
|
||||||
|
try:
|
||||||
|
bpy.ops.import_scene.fbx(
|
||||||
|
filepath=filepath,
|
||||||
|
automatic_bone_orientation=False,
|
||||||
|
use_prepost_rot=False,
|
||||||
|
use_anim=False
|
||||||
|
)
|
||||||
|
except (TypeError, ValueError) as e:
|
||||||
|
print(f"Error importing FBX: {str(e)}")
|
||||||
@@ -4,6 +4,7 @@ from .panel import AvatarToolkitPanel
|
|||||||
|
|
||||||
from ..core.import_pmx import import_pmx
|
from ..core.import_pmx import import_pmx
|
||||||
from ..core.import_pmd import import_pmd
|
from ..core.import_pmd import import_pmd
|
||||||
|
from ..core.importer import import_fbx
|
||||||
|
|
||||||
@register_wrap
|
@register_wrap
|
||||||
class AvatarToolkitQuickAccessPanel(bpy.types.Panel):
|
class AvatarToolkitQuickAccessPanel(bpy.types.Panel):
|
||||||
@@ -45,6 +46,8 @@ class AVATAR_TOOLKIT_OT_import_menu(bpy.types.Operator):
|
|||||||
layout.label(text="Select Import Method")
|
layout.label(text="Select Import Method")
|
||||||
layout.operator("avatar_toolkit.import_pmx", text="Import PMX")
|
layout.operator("avatar_toolkit.import_pmx", text="Import PMX")
|
||||||
layout.operator("avatar_toolkit.import_pmd", text="Import PMD")
|
layout.operator("avatar_toolkit.import_pmd", text="Import PMD")
|
||||||
|
layout.operator("avatar_toolkit.import_fbx", text="Import FBX")
|
||||||
|
|
||||||
|
|
||||||
@register_wrap
|
@register_wrap
|
||||||
class AVATAR_TOOLKIT_OT_export_menu(bpy.types.Operator):
|
class AVATAR_TOOLKIT_OT_export_menu(bpy.types.Operator):
|
||||||
@@ -91,3 +94,18 @@ class AVATAR_TOOLKIT_OT_import_pmd(bpy.types.Operator):
|
|||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
context.window_manager.fileselect_add(self)
|
context.window_manager.fileselect_add(self)
|
||||||
return {'RUNNING_MODAL'}
|
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'}
|
||||||
|
|||||||
Reference in New Issue
Block a user