diff --git a/__init__.py b/__init__.py index bbc3f00..696ee00 100644 --- a/__init__.py +++ b/__init__.py @@ -14,7 +14,7 @@ import bpy from bpy.props import StringProperty, BoolProperty, CollectionProperty, EnumProperty -from model_import import import_model +from .model_import import import_model class PyWMDPreferences(bpy.types.AddonPreferences): @@ -50,7 +50,7 @@ def execute(self, context): else: directory = Path(self.filepath).absolute() for file in self.files: - import_model(file) + import_model(str(directory / file.name)) return {'FINISHED'} def invoke(self, context, event): @@ -63,11 +63,17 @@ def invoke(self, context, event): register_, unregister_ = bpy.utils.register_classes_factory(classes) +def menu_import(self, context): + self.layout.operator(WMD_import_OT_operator.bl_idname, text="Pragma model (.wmd)") + + def register(): register_() + bpy.types.TOPBAR_MT_file_import.append(menu_import) def unregister(): + bpy.types.TOPBAR_MT_file_import.remove(menu_import) unregister_() diff --git a/model_import.py b/model_import.py index 809f32d..6573625 100644 --- a/model_import.py +++ b/model_import.py @@ -1,13 +1,8 @@ import random from pathlib import Path -if __name__ == '__main__': - import sys - - sys.path.append(r"F:\PYTHON_STUFF\blender_wmd") - -from PyWMD.byte_io_wmd import ByteIO -from PyWMD.pragma_model import PragmaModel, PragmaBone, PragmaMeshV24Plus +from .PyWMD.byte_io_wmd import ByteIO +from .PyWMD.pragma_model import PragmaModel, PragmaBone, PragmaMeshV24Plus import bpy from mathutils import Vector, Quaternion, Matrix