diff options
-rw-r--r-- | io_scene_ms3d/__init__.py | 4 | ||||
-rw-r--r-- | io_scene_ms3d/ms3d_export.py | 23 | ||||
-rw-r--r-- | io_scene_ms3d/ms3d_import.py | 7 | ||||
-rw-r--r-- | io_scene_ms3d/ms3d_spec.py | 2 | ||||
-rw-r--r-- | io_scene_ms3d/ms3d_strings.py | 2 | ||||
-rw-r--r-- | io_scene_ms3d/ms3d_ui.py | 9 | ||||
-rw-r--r-- | io_scene_ms3d/ms3d_utils.py | 2 |
7 files changed, 28 insertions, 21 deletions
diff --git a/io_scene_ms3d/__init__.py b/io_scene_ms3d/__init__.py index 7dc24ed5..cafc3a7d 100644 --- a/io_scene_ms3d/__init__.py +++ b/io_scene_ms3d/__init__.py @@ -23,7 +23,7 @@ bl_info = { 'description': "Import / Export MilkShape3D MS3D files"\ " (conform with MilkShape3D v1.8.4)", 'author': "Alexander Nussbaumer", - 'version': (0, 95, 2), + 'version': (0, 95, 3), 'blender': (2, 65, 3), 'location': "File > Import & File > Export", 'warning': "", @@ -41,7 +41,7 @@ bl_info = { # ##### BEGIN COPYRIGHT BLOCK ##### # -# initial script copyright (c)2011,2012 Alexander Nussbaumer +# initial script copyright (c)2011-2013 Alexander Nussbaumer # # ##### END COPYRIGHT BLOCK ##### diff --git a/io_scene_ms3d/ms3d_export.py b/io_scene_ms3d/ms3d_export.py index b48ee271..1967558e 100644 --- a/io_scene_ms3d/ms3d_export.py +++ b/io_scene_ms3d/ms3d_export.py @@ -25,7 +25,7 @@ # ##### BEGIN COPYRIGHT BLOCK ##### # -# initial script copyright (c)2011,2012 Alexander Nussbaumer +# initial script copyright (c)2011-2013 Alexander Nussbaumer # # ##### END COPYRIGHT BLOCK ##### @@ -64,6 +64,7 @@ from io_scene_ms3d.ms3d_spec import ( Ms3dRotationKeyframe, Ms3dTranslationKeyframe, Ms3dCommentEx, + Ms3dComment, ) from io_scene_ms3d.ms3d_utils import ( select_all, @@ -227,6 +228,9 @@ class Ms3dExporter(): Ms3dUi.transparency_mode_to_ms3d( blender_mesh.ms3d.transparency_mode) + if blender_mesh.ms3d.comment: + ms3d_model._comment_object = Ms3dComment(blender_mesh.ms3d.comment) + ########################## # prepare ms3d groups if available # works only for exporting active object @@ -397,25 +401,28 @@ class Ms3dExporter(): else: weight_normalize = 1.0 - weight_sum = 1.0 + weight_sum = 100 for index, weight in enumerate(weights): - if index >= count-1: - weights[index] = weight_sum + 0.009 + if index >= count-1 or index >= 2: + # take the full rest instead of calculate, + # that should fill up to exactly 100% + # (in some cases it is only 99% bacaus of roulding errors) + weights[index] = int(weight_sum) break - normalized_weight = weight * weight_normalize - weight_sum -= normalized_weight + normalized_weight = int(weight * weight_normalize * 100) weights[index] = normalized_weight + weight_sum -= normalized_weight # fill up missing values while len(bone_ids) < 3: bone_ids.append(Ms3dSpec.DEFAULT_VERTEX_BONE_ID) while len(weights) < 3: - weights.append(0.0) + weights.append(0) ms3d_vertex._vertex_ex_object._bone_ids = \ tuple(bone_ids) ms3d_vertex._vertex_ex_object._weights = \ - tuple([int(value * 100) for value in weights]) + tuple(weights) if layer_extra: #ms3d_vertex._vertex_ex_object.extra = bmv[layer_extra] diff --git a/io_scene_ms3d/ms3d_import.py b/io_scene_ms3d/ms3d_import.py index f4767f11..a9bfed19 100644 --- a/io_scene_ms3d/ms3d_import.py +++ b/io_scene_ms3d/ms3d_import.py @@ -25,7 +25,7 @@ # ##### BEGIN COPYRIGHT BLOCK ##### # -# initial script copyright (c)2011,2012 Alexander Nussbaumer +# initial script copyright (c)2011-2013 Alexander Nussbaumer # # ##### END COPYRIGHT BLOCK ##### @@ -103,15 +103,16 @@ class Ms3dImporter(): self.options_use_joint_size = use_joint_size self.options_joint_size = joint_size self.options_use_joint_to_bones = use_joint_to_bones + self.directory_name = "" + self.file_name = "" pass ########################################################################### # create empty blender ms3d_model # read ms3d file # fill blender with ms3d_model content - """ read ms3d file and convert ms3d content to bender content """ def read(self, blender_context, filepath): - + """ read ms3d file and convert ms3d content to bender content """ t1 = time() t2 = None self.has_textures = False diff --git a/io_scene_ms3d/ms3d_spec.py b/io_scene_ms3d/ms3d_spec.py index 3afdbb76..740b333c 100644 --- a/io_scene_ms3d/ms3d_spec.py +++ b/io_scene_ms3d/ms3d_spec.py @@ -25,7 +25,7 @@ # ##### BEGIN COPYRIGHT BLOCK ##### # -# initial script copyright (c)2011,2012 Alexander Nussbaumer +# initial script copyright (c)2011-2013 Alexander Nussbaumer # # ##### END COPYRIGHT BLOCK ##### diff --git a/io_scene_ms3d/ms3d_strings.py b/io_scene_ms3d/ms3d_strings.py index 995e9268..98658760 100644 --- a/io_scene_ms3d/ms3d_strings.py +++ b/io_scene_ms3d/ms3d_strings.py @@ -25,7 +25,7 @@ # ##### BEGIN COPYRIGHT BLOCK ##### # -# initial script copyright (c)2011,2012 Alexander Nussbaumer +# initial script copyright (c)2011-2013 Alexander Nussbaumer # # ##### END COPYRIGHT BLOCK ##### SEE_MS3D_DOC = "see MilkShape 3D documentation" diff --git a/io_scene_ms3d/ms3d_ui.py b/io_scene_ms3d/ms3d_ui.py index 291d9197..ee4b6b5c 100644 --- a/io_scene_ms3d/ms3d_ui.py +++ b/io_scene_ms3d/ms3d_ui.py @@ -25,7 +25,7 @@ # ##### BEGIN COPYRIGHT BLOCK ##### # -# initial script copyright (c)2011,2012 Alexander Nussbaumer +# initial script copyright (c)2011-2013 Alexander Nussbaumer # # ##### END COPYRIGHT BLOCK ##### @@ -357,11 +357,10 @@ class Ms3dImportOperator(Operator, ImportHelper): if (self.use_animation): box.prop(self, 'rotation_mode', icon=Ms3dUi.ICON_ROTATION_MODE, expand=False) - box.prop(self, 'use_joint_size') + flow = box.column_flow() + flow.prop(self, 'use_joint_size') if (self.use_joint_size): - col = box.column() - row = col.row() - row.prop(self, 'joint_size') + flow.prop(self, 'joint_size') box.prop(self, 'use_joint_to_bones') if (self.use_joint_to_bones): box.box().label(ms3d_str['LABEL_NAME_JOINT_TO_BONES'], diff --git a/io_scene_ms3d/ms3d_utils.py b/io_scene_ms3d/ms3d_utils.py index db362338..c44b19ca 100644 --- a/io_scene_ms3d/ms3d_utils.py +++ b/io_scene_ms3d/ms3d_utils.py @@ -25,7 +25,7 @@ # ##### BEGIN COPYRIGHT BLOCK ##### # -# initial script copyright (c)2011,2012 Alexander Nussbaumer +# initial script copyright (c)2011-2013 Alexander Nussbaumer # # ##### END COPYRIGHT BLOCK ##### |