[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4258] trunk/py/scripts/addons/ io_scene_ms3d: fixed missing model comment.

Alexander Nussbaumer alpha-beta-release at gmx.net
Sun Feb 10 19:03:40 CET 2013


Revision: 4258
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4258
Author:   beta-tester
Date:     2013-02-10 18:03:39 +0000 (Sun, 10 Feb 2013)
Log Message:
-----------
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

Modified Paths:
--------------
    trunk/py/scripts/addons/io_scene_ms3d/__init__.py
    trunk/py/scripts/addons/io_scene_ms3d/ms3d_export.py
    trunk/py/scripts/addons/io_scene_ms3d/ms3d_import.py
    trunk/py/scripts/addons/io_scene_ms3d/ms3d_spec.py
    trunk/py/scripts/addons/io_scene_ms3d/ms3d_strings.py
    trunk/py/scripts/addons/io_scene_ms3d/ms3d_ui.py
    trunk/py/scripts/addons/io_scene_ms3d/ms3d_utils.py

Modified: trunk/py/scripts/addons/io_scene_ms3d/__init__.py
===================================================================
--- trunk/py/scripts/addons/io_scene_ms3d/__init__.py	2013-02-10 16:46:54 UTC (rev 4257)
+++ trunk/py/scripts/addons/io_scene_ms3d/__init__.py	2013-02-10 18:03:39 UTC (rev 4258)
@@ -23,7 +23,7 @@
     '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 @@
 
 # ##### BEGIN COPYRIGHT BLOCK #####
 #
-# initial script copyright (c)2011,2012 Alexander Nussbaumer
+# initial script copyright (c)2011-2013 Alexander Nussbaumer
 #
 # ##### END COPYRIGHT BLOCK #####
 

Modified: trunk/py/scripts/addons/io_scene_ms3d/ms3d_export.py
===================================================================
--- trunk/py/scripts/addons/io_scene_ms3d/ms3d_export.py	2013-02-10 16:46:54 UTC (rev 4257)
+++ trunk/py/scripts/addons/io_scene_ms3d/ms3d_export.py	2013-02-10 18:03:39 UTC (rev 4258)
@@ -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 @@
         Ms3dRotationKeyframe,
         Ms3dTranslationKeyframe,
         Ms3dCommentEx,
+        Ms3dComment,
         )
 from io_scene_ms3d.ms3d_utils import (
         select_all,
@@ -227,6 +228,9 @@
                     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 @@
                                 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
+                                    normalized_weight = int(weight * weight_normalize * 100)
+                                    weights[index] = normalized_weight
                                     weight_sum -= normalized_weight
-                                    weights[index] = 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]

Modified: trunk/py/scripts/addons/io_scene_ms3d/ms3d_import.py
===================================================================
--- trunk/py/scripts/addons/io_scene_ms3d/ms3d_import.py	2013-02-10 16:46:54 UTC (rev 4257)
+++ trunk/py/scripts/addons/io_scene_ms3d/ms3d_import.py	2013-02-10 18:03:39 UTC (rev 4258)
@@ -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 @@
         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

Modified: trunk/py/scripts/addons/io_scene_ms3d/ms3d_spec.py
===================================================================
--- trunk/py/scripts/addons/io_scene_ms3d/ms3d_spec.py	2013-02-10 16:46:54 UTC (rev 4257)
+++ trunk/py/scripts/addons/io_scene_ms3d/ms3d_spec.py	2013-02-10 18:03:39 UTC (rev 4258)
@@ -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 #####
 

Modified: trunk/py/scripts/addons/io_scene_ms3d/ms3d_strings.py
===================================================================
--- trunk/py/scripts/addons/io_scene_ms3d/ms3d_strings.py	2013-02-10 16:46:54 UTC (rev 4257)
+++ trunk/py/scripts/addons/io_scene_ms3d/ms3d_strings.py	2013-02-10 18:03:39 UTC (rev 4258)
@@ -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"

Modified: trunk/py/scripts/addons/io_scene_ms3d/ms3d_ui.py
===================================================================
--- trunk/py/scripts/addons/io_scene_ms3d/ms3d_ui.py	2013-02-10 16:46:54 UTC (rev 4257)
+++ trunk/py/scripts/addons/io_scene_ms3d/ms3d_ui.py	2013-02-10 18:03:39 UTC (rev 4258)
@@ -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 @@
         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'],

Modified: trunk/py/scripts/addons/io_scene_ms3d/ms3d_utils.py
===================================================================
--- trunk/py/scripts/addons/io_scene_ms3d/ms3d_utils.py	2013-02-10 16:46:54 UTC (rev 4257)
+++ trunk/py/scripts/addons/io_scene_ms3d/ms3d_utils.py	2013-02-10 18:03:39 UTC (rev 4258)
@@ -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 #####
 



More information about the Bf-extensions-cvs mailing list