diff options
author | Alexander N <alpha-beta-release@gmx.net> | 2013-03-17 22:29:43 +0400 |
---|---|---|
committer | Alexander N <alpha-beta-release@gmx.net> | 2013-03-17 22:29:43 +0400 |
commit | e56284b89d7a3c68f234a8c7c12aa7f1e620404c (patch) | |
tree | fffcc7ba354c95207814cbb59b052563880f0924 /io_scene_ms3d/ms3d_import.py | |
parent | 50a08afe70a91a55b410e5cc4b16244956e6814d (diff) |
fix: invalid header warning; changed: verbose modes from bool to enum; changed: position of update scene;
Diffstat (limited to 'io_scene_ms3d/ms3d_import.py')
-rw-r--r-- | io_scene_ms3d/ms3d_import.py | 78 |
1 files changed, 20 insertions, 58 deletions
diff --git a/io_scene_ms3d/ms3d_import.py b/io_scene_ms3d/ms3d_import.py index a9bfed19..c9e87c23 100644 --- a/io_scene_ms3d/ms3d_import.py +++ b/io_scene_ms3d/ms3d_import.py @@ -87,7 +87,7 @@ class Ms3dImporter(): """ def __init__(self, report, - verbose=False, + verbose='NONE', use_extended_normal_handling=False, use_animation=True, use_quaternion_rotation=False, @@ -131,13 +131,16 @@ class Ms3dImporter(): # open ms3d file with io.FileIO(filepath, 'rb') as raw_io: # read and inject ms3d data from disk to internal structure - ms3d_model.read(raw_io) + debug_out = ms3d_model.read(raw_io) raw_io.close() + + if self.options_verbose in Ms3dUi.VERBOSE_MAXIMAL: + print(debug_out) finally: pass # if option is set, this time will enlargs the io time - if self.options_verbose: + if self.options_verbose in Ms3dUi.VERBOSE_MAXIMAL: ms3d_model.print_internal() t2 = time() @@ -148,23 +151,20 @@ class Ms3dImporter(): # inject ms3d data to blender self.to_blender(blender_context, ms3d_model) - blender_scene = blender_context.scene - - # finalize/restore environment - blender_scene.update() - post_setup_environment(self, blender_context) - print() - print("##########################################################") - print("Import from MS3D to Blender") - print(statistics) - print("##########################################################") + if self.options_verbose in Ms3dUi.VERBOSE_NORMAL: + print() + print("##########################################################") + print("Import from MS3D to Blender") + print(statistics) + print("##########################################################") except Exception: type, value, traceback = exc_info() - print("read - exception in try block\n type: '{0}'\n" - " value: '{1}'".format(type, value, traceback)) + if self.options_verbose in Ms3dUi.VERBOSE_NORMAL: + print("read - exception in try block\n type: '{0}'\n" + " value: '{1}'".format(type, value, traceback)) if t2 is None: t2 = time() @@ -175,50 +175,12 @@ class Ms3dImporter(): pass t3 = time() - print(ms3d_str['SUMMARY_IMPORT'].format( - (t3 - t1), (t2 - t1), (t3 - t2))) - - return {"FINISHED"} - - - def internal_read(self, blender_context, raw_io): - try: - # setup environment - pre_setup_environment(self, blender_context) - - try: - ms3d_model.read(raw_io) - finally: - pass - # if option is set, this time will enlargs the io time - if self.options_verbose: - ms3d_model.print_internal() - - is_valid, statistics = ms3d_model.is_valid() + if self.options_verbose in Ms3dUi.VERBOSE_NORMAL: + print(ms3d_str['SUMMARY_IMPORT'].format( + (t3 - t1), (t2 - t1), (t3 - t2))) - if is_valid: - # inject ms3d data to blender - blender_empty_object, blender_mesh_object = self.to_blender(blender_context, ms3d_model) - - blender_scene = blender_context.scene - - # finalize/restore environment - blender_scene.update() - - post_setup_environment(self, blender_context) - - except Exception: - type, value, traceback = exc_info() - print("read - exception in try block\n type: '{0}'\n" - " value: '{1}'".format(type, value, traceback)) - - raise - - else: - pass - - return blender_empty_object, blender_mesh_object + return {"FINISHED"} ########################################################################### @@ -629,7 +591,7 @@ class Ms3dImporter(): # end BMesh stuff #################################################### - blender_mesh.validate(self.options_verbose) + blender_mesh.validate(self.options_verbose in Ms3dUi.VERBOSE_MAXIMAL) return blender_mesh_object |