Newer
Older
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# Project Name: MakeHuman
# Product Home Page: http://www.makehuman.org/
# Code Home Page: http://code.google.com/p/makehuman/
# Authors: Thomas Larsson
# Script copyright (C) MakeHuman Team 2001-2013
# Coding Standards: See http://www.makehuman.org/node/165
Thomas Larsson
committed
MHX (MakeHuman eXchange format) importer for Blender 2.6x.
This script should be distributed with Blender.
If not, place it in the .blender/scripts/addons dir
Activate the script in the "Addons" tab (user preferences).
Access from the File > Import menu.
Alternatively, run the script in the script editor (Alt-P), and access from the File > Import menu
'name': 'Import: MakeHuman (.mhx)',
'author': 'Thomas Larsson',
Thomas Larsson
committed
'version': (1, 16, 7),
Thomas Larsson
committed
"blender": (2, 68, 0),
'location': "File > Import > MakeHuman (.mhx)",
'description': 'Import files in the MakeHuman eXchange format (.mhx)',
'warning': '',
'wiki_url': 'http://www.makehuman.org/documentation',
'tracker_url': 'https://projects.blender.org/tracker/index.php?'\
MAJOR_VERSION = 1
Thomas Larsson
committed
MINOR_VERSION = 16
Thomas Larsson
committed
FROM_VERSION = 13
Thomas Larsson
committed
SUB_VERSION = 7
Thomas Larsson
committed
majorVersion = MAJOR_VERSION
minorVersion = MINOR_VERSION
#
#
#
import bpy
import os
import time
Thomas Larsson
committed
import math
Thomas Larsson
committed
from mathutils import Vector, Matrix
from bpy.props import *
MHX249 = False
Blender24 = False
Blender25 = True
theDir = "~/makehuman/exports"
One = 1.0/theScale
useMesh = 1
verbosity = 2
warnedTextureDir = False
warnedVersion = False
true = True
false = False
Epsilon = 1e-6
nErrors = 0
theTempDatum = None
T_EnforceVersion = 0x01
T_Clothes = 0x02
T_HardParents = 0x0
Thomas Larsson
committed
T_CrashSafe = 0x0
T_Diamond = 0x10
T_Shapekeys = 0x40
T_ShapeDrivers = 0x80
T_Face = T_Shapekeys
T_Shape = T_Shapekeys
T_Mesh = 0x100
T_Armature = 0x200
T_Proxy = 0x400
T_Cage = 0x800
T_Opcns = 0x2000
Thomas Larsson
committed
DefaultToggle = ( T_EnforceVersion + T_Mesh + T_Armature +
T_Shapekeys + T_ShapeDrivers + T_Proxy + T_Clothes + T_Rigify )
Thomas Larsson
committed
toggle = DefaultToggle
toggleSettings = toggle
loadedData = None
#
# mhxEval(expr) - an attempt at a reasonably safe eval.
# Note that expr never contains any whitespace due to the behavior
# of the mhx tokenizer.
#
def mhxEval(expr, locls={}):
globls = {
'__builtins__' : {},
'toggle' : toggle,
'theScale' : theScale,
Thomas Larsson
committed
'One' : One,
'T_EnforceVersion' : T_EnforceVersion,
'T_Clothes' : T_Clothes,
'T_HardParents' : T_HardParents,
'T_CrashSafe' : T_CrashSafe,
'T_Diamond' : T_Diamond,
'T_Replace' : T_Replace,
'T_Shapekeys' : T_Shapekeys,
'T_ShapeDrivers' : T_ShapeDrivers,
'T_Face' : T_Face,
'T_Shape' : T_Shape,
'T_Mesh' : T_Mesh,
'T_Armature' : T_Armature,
'T_Proxy' : T_Proxy,
'T_Cage' : T_Cage,
'T_Rigify' : T_Rigify,
'T_Opcns' : T_Opcns,
'T_Symm' : T_Symm,
}
return eval(expr, globls, locls)
def initLoadedData():
global loadedData
loadedData = {
'NONE' : {},
'Object' : {},
'Mesh' : {},
'Armature' : {},
'Lamp' : {},
'Camera' : {},
'Lattice' : {},
'Curve' : {},
'Text' : {},
'Material' : {},
'Image' : {},
'MaterialTextureSlot' : {},
'Texture' : {},
Thomas Larsson
committed
'Bone' : {},
'BoneGroup' : {},
'Rigify' : {},
'Action' : {},
'Group' : {},
'MeshTextureFaceLayer' : {},
'MeshColorLayer' : {},
'VertexGroup' : {},
'ShapeKey' : {},
'ParticleSystem' : {},
'ObjectConstraints' : {},
'ObjectModifiers' : {},
'MaterialSlot' : {},
Loading
Loading full blame...