[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2930] trunk/py/scripts/addons/ io_import_scene_mhx.py: MHX importer: vertex groups can no be loaded in chunks.

Thomas Larsson thomas_larsson_01 at hotmail.com
Mon Jan 23 05:16:19 CET 2012


Revision: 2930
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2930
Author:   thomasl
Date:     2012-01-23 04:16:01 +0000 (Mon, 23 Jan 2012)
Log Message:
-----------
MHX importer: vertex groups can no be loaded in chunks. Also changed definition of helper geometry, to faces with material >= 4. This allows helpers to have different colors in the viewport.

Modified Paths:
--------------
    trunk/py/scripts/addons/io_import_scene_mhx.py

Modified: trunk/py/scripts/addons/io_import_scene_mhx.py
===================================================================
--- trunk/py/scripts/addons/io_import_scene_mhx.py	2012-01-23 03:36:36 UTC (rev 2929)
+++ trunk/py/scripts/addons/io_import_scene_mhx.py	2012-01-23 04:16:01 UTC (rev 2930)
@@ -26,7 +26,7 @@
 """
 Abstract
 MHX (MakeHuman eXchange format) importer for Blender 2.5x.
-Version 1.9.0
+Version 1.10.0
 
 This script should be distributed with Blender.
 If not, place it in the .blender/scripts/addons dir
@@ -39,7 +39,7 @@
 bl_info = {
     'name': 'Import: MakeHuman (.mhx)',
     'author': 'Thomas Larsson',
-    'version': (1, 9, 2),
+    'version': (1, 10, 0),
     "blender": (2, 5, 9),
     'location': "File > Import > MakeHuman (.mhx)",
     'description': 'Import files in the MakeHuman eXchange format (.mhx)',
@@ -50,8 +50,8 @@
     'category': 'Import-Export'}
 
 MAJOR_VERSION = 1
-MINOR_VERSION = 9
-SUB_VERSION = 2
+MINOR_VERSION = 10
+SUB_VERSION = 0
 BLENDER_VERSION = (2, 59, 2)
 
 #
@@ -173,7 +173,10 @@
 #    Dictionaries
 #
 
-loadedData = {
+def initLoadedData():
+    global loadedData
+
+    loadedData = {
     'NONE' : {},
 
     'Object' : {},
@@ -206,7 +209,8 @@
     'ObjectConstraints' : {},
     'ObjectModifiers' : {},
     'MaterialSlot' : {},
-}
+    }
+    return
 
 Plural = {
     'Object' : 'objects',
@@ -261,6 +265,7 @@
     defaultScale = theScale
     One = 1.0/theScale
     warnedVersion = False
+    initLoadedData()
 
     fileName = os.path.expanduser(filePath)
     (shortName, ext) = os.path.splitext(fileName)
@@ -1455,8 +1460,11 @@
         return
 
     if (toggle & T_Armature) or (grpName in ['Eye_L', 'Eye_R', 'Gums', 'Head', 'Jaw', 'Left', 'Middle', 'Right', 'Scalp']):
-        group = ob.vertex_groups.new(grpName)
-        loadedData['VertexGroup'][grpName] = group
+        try:
+            group = loadedData['VertexGroup'][grpName]
+        except KeyError:
+            group = ob.vertex_groups.new(grpName)
+            loadedData['VertexGroup'][grpName] = group
         for (key, val, sub) in tokens:
             if key == 'wv':
                 group.add( [int(val[0])], float(val[1]), 'REPLACE' )
@@ -2065,7 +2073,7 @@
     bpy.ops.object.mode_set(mode='OBJECT')
     me = ob.data
     for f in me.faces:    
-        if f.material_index == 1:
+        if f.material_index >= 4:
             for vn in f.vertices:
                 me.vertices[vn].select = True
     bpy.ops.object.mode_set(mode='EDIT')
@@ -3646,7 +3654,7 @@
     (( 1,    'FK Spine', 'MhxFKSpine'),
      (17,    'IK Spine', 'MhxIKSpine')),
     ((13,    'Inv FK Spine', 'MhxInvFKSpine'),
-     (29,    'Inv IK Spine', 'MhxInvIKSpine')),
+     (16,    'Clothes', 'MhxClothes')),
     ('Left', 'Right'),
     (( 2,    'IK Arm', 'MhxIKArm'),
      (18,    'IK Arm', 'MhxIKArm')),



More information about the Bf-extensions-cvs mailing list