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:
authorThomas Larsson <thomas_larsson_01@hotmail.com>2012-01-23 08:16:01 +0400
committerThomas Larsson <thomas_larsson_01@hotmail.com>2012-01-23 08:16:01 +0400
commiteeb3fc50a0a00d267459d239fbc0d6ede8970b7d (patch)
tree5f4b52c333d1e8ea84b61729d03a02d945259901 /io_import_scene_mhx.py
parentd597ef1a781645965145032eb2fae816ae38dbdd (diff)
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.
Diffstat (limited to 'io_import_scene_mhx.py')
-rw-r--r--io_import_scene_mhx.py37
1 files changed, 27 insertions, 10 deletions
diff --git a/io_import_scene_mhx.py b/io_import_scene_mhx.py
index c97d5841..abcae714 100644
--- a/io_import_scene_mhx.py
+++ b/io_import_scene_mhx.py
@@ -26,7 +26,7 @@
"""
Abstract
MHX (MakeHuman eXchange format) importer for Blender 2.5x.
-Version 1.9.0
+Version 1.10.1
This script should be distributed with Blender.
If not, place it in the .blender/scripts/addons dir
@@ -39,7 +39,7 @@ Alternatively, run the script in the script editor (Alt-P), and access from the
bl_info = {
'name': 'Import: MakeHuman (.mhx)',
'author': 'Thomas Larsson',
- 'version': (1, 9, 2),
+ 'version': (1, 10, 1),
"blender": (2, 5, 9),
'location': "File > Import > MakeHuman (.mhx)",
'description': 'Import files in the MakeHuman eXchange format (.mhx)',
@@ -50,8 +50,8 @@ bl_info = {
'category': 'Import-Export'}
MAJOR_VERSION = 1
-MINOR_VERSION = 9
-SUB_VERSION = 2
+MINOR_VERSION = 10
+SUB_VERSION = 1
BLENDER_VERSION = (2, 59, 2)
#
@@ -173,7 +173,10 @@ def setFlagsAndFloats():
# Dictionaries
#
-loadedData = {
+def initLoadedData():
+ global loadedData
+
+ loadedData = {
'NONE' : {},
'Object' : {},
@@ -206,7 +209,16 @@ loadedData = {
'ObjectConstraints' : {},
'ObjectModifiers' : {},
'MaterialSlot' : {},
-}
+ }
+ return
+
+def reinitGlobalData():
+ global loadedData
+ for key in [
+ 'MeshTextureFaceLayer', 'MeshColorLayer', 'VertexGroup', 'ShapeKey',
+ 'ParticleSystem', 'ObjectConstraints', 'ObjectModifiers', 'MaterialSlot']:
+ loadedData[key] = {}
+ return
Plural = {
'Object' : 'objects',
@@ -261,6 +273,7 @@ def readMhxFile(filePath):
defaultScale = theScale
One = 1.0/theScale
warnedVersion = False
+ initLoadedData()
fileName = os.path.expanduser(filePath)
(shortName, ext) = os.path.splitext(fileName)
@@ -446,6 +459,7 @@ def parse(tokens):
elif key == "Object":
parseObject(val, sub)
elif key == "Mesh":
+ reinitGlobalData()
data = parseMesh(val, sub)
elif key == "Armature":
data = parseArmature(val, sub)
@@ -1455,8 +1469,11 @@ def parseVertexGroup(ob, me, args, tokens):
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 +2082,7 @@ def deleteDiamonds(ob):
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 +3663,7 @@ MhxLayers = [
(( 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')),