Skip to content

Commit

Permalink
Fixes to UI
Browse files Browse the repository at this point in the history
  • Loading branch information
leus committed Sep 26, 2020
1 parent 4634f34 commit 6c9208f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
29 changes: 25 additions & 4 deletions pes-fmdl/CompatibilityLayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,17 @@ def TriangulateMesh(cls, modifiedBlenderMesh, scene):
bpy.data.objects.remove(modifiedBlenderObject)
bpy.data.meshes.remove(modifiedBlenderMesh)
modifiedBlenderMesh = newBlenderMesh


@classmethod
def AppendToImportMenu(cls, newMenuItem):
bpy.types.INFO_MT_file_import.append(newMenuItem)

@classmethod
def AppendToExportMenu(cls, newMenuItem):
bpy.types.INFO_MT_file_export.append(newMenuItem)

def __init__(self):
pass

super().__init__()

class CompatibilityLayer29(CompatibilityLayerBase):

Expand Down Expand Up @@ -371,8 +378,16 @@ def TriangulateMesh(cls, modifiedBlenderMesh, scene):
blenderBmesh.to_mesh(modifiedBlenderMesh)
blenderBmesh.free()

@classmethod
def AppendToImportMenu(cls, newMenuItem):
bpy.types.TOPBAR_MT_file_import.append(newMenuItem)

@classmethod
def AppendToExportMenu(cls, newMenuItem):
bpy.types.TOPBAR_MT_file_export.append(newMenuItem)

def __init__(self):
pass
super().__init__()


class CompatibilityLayer:
Expand Down Expand Up @@ -411,3 +426,9 @@ def ExportUVMaps(self, blenderMaterial, blenderMesh, name, vertexFields):

def TriangulateMesh(self, modifiedBlenderMesh, scene):
self.shim.TriangulateMesh(modifiedBlenderMesh, scene)

def AppendToImportMenu(self, newMenuItem):
self.shim.AppendToImportMenu(newMenuItem)

def AppendToExportMenu(self, newMenuItem):
self.shim.AppendToExportMenu(newMenuItem)
9 changes: 5 additions & 4 deletions pes-fmdl/UI.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import bpy.props
import bpy_extras.io_utils

from . import FmdlFile, Ftex, IO
from . import FmdlFile, Ftex, IO, CompatibilityLayer



Expand Down Expand Up @@ -36,7 +36,7 @@ class FMDL_Scene_Import(bpy.types.Operator, bpy_extras.io_utils.ImportHelper):
bl_idname = "import_scene.fmdl"
bl_label = "Import Fmdl"
bl_options = {'REGISTER', 'UNDO'}

extensions_enabled = bpy.props.BoolProperty(name = "Enable blender-pes-fmdl extensions", default = True)
loop_preservation = bpy.props.BoolProperty(name = "Preserve split vertices", default = True)
mesh_splitting = bpy.props.BoolProperty(name = "Autosplit overlarge meshes", default = True)
Expand Down Expand Up @@ -781,6 +781,7 @@ def draw(self, context):


def register():
shim = CompatibilityLayer.CompatibilityLayer()
bpy.types.Object.fmdl_file = bpy.props.BoolProperty(name = "Is FMDL file", options = {'SKIP_SAVE'})
bpy.types.Object.fmdl_filename = bpy.props.StringProperty(name = "FMDL filename", options = {'SKIP_SAVE'})
bpy.types.Object.fmdl_export_extensions_enabled = bpy.props.BoolProperty(name = "Enable blender-pes-fmdl extensions", default = True)
Expand All @@ -804,8 +805,8 @@ def register():
for c in classes:
bpy.utils.register_class(c)

bpy.types.INFO_MT_file_import.append(FMDL_Scene_FMDL_Import_MenuItem)
bpy.types.INFO_MT_file_export.append(FMDL_Scene_FMDL_Export_MenuItem)
shim.AppendToImportMenu(FMDL_Scene_FMDL_Import_MenuItem)
shim.AppendToExportMenu(FMDL_Scene_FMDL_Export_MenuItem)
bpy.types.TEXTURE_PT_image.append(FMDL_Texture_Load_Ftex_Button)

bpy.app.handlers.scene_update_post.append(FMDL_Mesh_BoneGroup_TrackVertexGroupUsageUpdates)
Expand Down

0 comments on commit 6c9208f

Please sign in to comment.