Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander N <alpha-beta-release@gmx.net>2013-02-10 22:03:39 +0400
committerAlexander N <alpha-beta-release@gmx.net>2013-02-10 22:03:39 +0400
commit620993a65f3087e45aca67badfb09c7464604137 (patch)
tree0eb77927a219963375b4801692667668a264464f /io_scene_ms3d/ms3d_export.py
parent7639368f18430c38aef18ce6af5c33e06a22ae82 (diff)
fixed missing model comment.
and tiny other things e.g. fix: sum of weights sometimes reaches only 99% instead of 100% mod: come # comments - year to 2013 mod: ui of importer - joint size bit closer to other item
Diffstat (limited to 'io_scene_ms3d/ms3d_export.py')
-rw-r--r--io_scene_ms3d/ms3d_export.py23
1 files changed, 15 insertions, 8 deletions
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]