Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
*.patch
test.py
/.vscode
/.idea
/.old
/archive
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ You can basically import any supported 3d model into Blender (e.g. Blender files

## Requirements ##

* Blender 2.78 or later - [blender.org](http://www.blender.org/download/)
* Blender 2.80 or later - [blender.org](https://www.blender.org/download/)


## Installation ##
Expand Down
42 changes: 21 additions & 21 deletions io_scene_cod/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

from bpy.utils import register_class, unregister_class

import time
from time import perf_counter as clock
import os

bl_info = {
Expand Down Expand Up @@ -151,7 +151,7 @@ def draw(self, context):
from . import PyCoD


class COD_MT_import_xmodel(bpy.types.Operator, ImportHelper):
class COD_MT_import_xmodel(Operator, ImportHelper):
bl_idname = "import_scene.xmodel"
bl_label = "Import XModel"
bl_description = "Import a CoD XMODEL_EXPORT / XMODEL_BIN File"
Expand Down Expand Up @@ -253,7 +253,7 @@ class COD_MT_import_xmodel(bpy.types.Operator, ImportHelper):

def execute(self, context):
from . import import_xmodel
start_time = time.clock()
start_time = clock()

keywords = self.as_keywords(ignore=("filter_glob",
"check_existing",
Expand All @@ -263,15 +263,15 @@ def execute(self, context):

if not result:
self.report({'INFO'}, "Import finished in %.4f sec." %
(time.clock() - start_time))
(clock() - start_time))
return {'FINISHED'}
else:
self.report({'ERROR'}, result)
return {'CANCELLED'}

@classmethod
def poll(self, context):
return (context.scene is not None)
def poll(cls, context):
return context.scene is not None

def draw(self, context):
layout = self.layout
Expand Down Expand Up @@ -308,7 +308,7 @@ def draw(self, context):
sub.prop(self, 'merge_skeleton')


class COD_MT_import_xanim(bpy.types.Operator, ImportHelper):
class COD_MT_import_xanim(Operator, ImportHelper):
bl_idname = "import_scene.xanim"
bl_label = "Import XAnim"
bl_description = "Import a CoD XANIM_EXPORT / XANIM_BIN File"
Expand Down Expand Up @@ -396,7 +396,7 @@ class COD_MT_import_xanim(bpy.types.Operator, ImportHelper):

def execute(self, context):
from . import import_xanim
start_time = time.clock()
start_time = clock()

ignored_properties = ("filter_glob", "files", "apply_unit_scale")
result = import_xanim.load(
Expand All @@ -407,7 +407,7 @@ def execute(self, context):

if not result:
self.report({'INFO'}, "Import finished in %.4f sec." %
(time.clock() - start_time))
(clock() - start_time))
return {'FINISHED'}
else:
self.report({'ERROR'}, result)
Expand Down Expand Up @@ -447,7 +447,7 @@ def draw(self, context):
layout.prop(self, 'anim_offset')


class COD_MT_export_xmodel(bpy.types.Operator, ExportHelper):
class COD_MT_export_xmodel(Operator, ExportHelper):
bl_idname = "export_scene.xmodel"
bl_label = 'Export XModel'
bl_description = "Export a CoD XMODEL_EXPORT / XMODEL_BIN File"
Expand Down Expand Up @@ -604,23 +604,23 @@ class COD_MT_export_xmodel(bpy.types.Operator, ExportHelper):

def execute(self, context):
from . import export_xmodel
start_time = time.clock()
start_time = clock()

ignore = ("filter_glob", "check_existing")
result = export_xmodel.save(self, context,
**self.as_keywords(ignore=ignore))

if not result:
self.report({'INFO'}, "Export finished in %.4f sec." %
(time.clock() - start_time))
(clock() - start_time))
return {'FINISHED'}
else:
self.report({'ERROR'}, result)
return {'CANCELLED'}

@classmethod
def poll(self, context):
return (context.scene is not None)
def poll(cls, context):
return context.scene is not None

def check(self, context):
'''
Expand Down Expand Up @@ -725,7 +725,7 @@ def draw(self, context):
sub.prop(self, 'use_weight_min_threshold')


class COD_MT_export_xanim(bpy.types.Operator, ExportHelper):
class COD_MT_export_xanim(Operator, ExportHelper):
bl_idname = "export_scene.xanim"
bl_label = 'Export XAnim'
bl_description = "Export a CoD XANIM_EXPORT / XANIM_BIN File"
Expand Down Expand Up @@ -865,23 +865,23 @@ class COD_MT_export_xanim(bpy.types.Operator, ExportHelper):

def execute(self, context):
from . import export_xanim
start_time = time.clock()
start_time = clock()
result = export_xanim.save(
self,
context,
**self.as_keywords(ignore=("filter_glob", "check_existing")))

if not result:
msg = "Export finished in %.4f sec." % (time.clock() - start_time)
msg = "Export finished in %.4f sec." % (clock() - start_time)
self.report({'INFO'}, msg)
return {'FINISHED'}
else:
self.report({'ERROR'}, result)
return {'CANCELLED'}

@classmethod
def poll(self, context):
return (context.scene is not None)
def poll(cls, context):
return context.scene is not None

def check(self, context):
'''
Expand Down Expand Up @@ -1065,7 +1065,7 @@ def menu_func_export_submenu(self, context):

def register():
for cls in classes:
bpy.utils.register_class(cls)
register_class(cls)

# __name__ is the same as the package name (io_scene_cod)
preferences = bpy.context.preferences.addons[__name__].preferences
Expand Down Expand Up @@ -1098,7 +1098,7 @@ def unregister():
bpy.types.TOPBAR_MT_file_export.remove(menu_func_export_submenu)

for cls in classes:
bpy.utils.unregister_class(cls)
unregister_class(cls)


if __name__ == "__main__":
Expand Down
Loading