[Bf-extensions-cvs] [e2ebaa8] master: remove .mhx i/o re: T49021

meta-androcto noreply at git.blender.org
Fri Aug 5 12:18:15 CEST 2016


Commit: e2ebaa80b48550cdbb0e47f29e39e59ab57085b1
Author: meta-androcto
Date:   Fri Aug 5 20:17:48 2016 +1000
Branches: master
https://developer.blender.org/rBAe2ebaa80b48550cdbb0e47f29e39e59ab57085b1

remove .mhx i/o re: T49021

===================================================================

D	io_import_scene_mhx.py

===================================================================

diff --git a/io_import_scene_mhx.py b/io_import_scene_mhx.py
deleted file mode 100644
index 764c363..0000000
--- a/io_import_scene_mhx.py
+++ /dev/null
@@ -1,4861 +0,0 @@
-# ##### 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
-
-"""
-Abstract
-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
-"""
-
-bl_info = {
-    "name": "Import: MakeHuman (.mhx)",
-    "author": "Thomas Larsson",
-    "version": "1.16.12",
-    "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",
-    "category": "Import-Export",
-}
-
-MAJOR_VERSION = 1
-MINOR_VERSION = 16
-FROM_VERSION = 13
-SUB_VERSION = 12
-
-majorVersion = MAJOR_VERSION
-minorVersion = MINOR_VERSION
-
-#
-#
-#
-
-import bpy
-import os
-import time
-import math
-import mathutils
-from mathutils import Vector, Matrix, Quaternion
-from bpy.props import *
-
-MHX249 = False
-Blender24 = False
-Blender25 = True
-theDir = "~/makehuman/exports"
-
-#
-#
-#
-
-theScale = 1.0
-One = 1.0/theScale
-useMesh = 1
-verbosity = 2
-warnedTextureDir = False
-warnedVersion = False
-
-true = True
-false = False
-Epsilon = 1e-6
-nErrors = 0
-theTempDatum = None
-theMessage = ""
-theMhxFile = ""
-
-#
-#    toggle flags
-#
-
-T_EnforceVersion = 0x01
-T_Clothes = 0x02
-T_HardParents = 0x0
-T_CrashSafe = 0x0
-
-T_Diamond = 0x10
-T_Replace = 0x20
-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_Rigify = 0x1000
-T_Opcns = 0x2000
-T_Symm = 0x4000
-
-DefaultToggle = ( T_EnforceVersion + T_Mesh + T_Armature +
-    T_Shapekeys + T_ShapeDrivers + T_Proxy + T_Clothes + T_Rigify )
-
-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,
-        '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)
-
-#
-#    Dictionaries
-#
-
-def initLoadedData():
-    global loadedData
-
-    loadedData = {
-    'NONE' : {},
-
-    'Object' : {},
-    'Mesh' : {},
-    'Armature' : {},
-    'Lamp' : {},
-    'Camera' : {},
-    'Lattice' : {},
-    'Curve' : {},
-    'Text' : {},
-
-    'Material' : {},
-    'Image' : {},
-    'MaterialTextureSlot' : {},
-    'Texture' : {},
-
-    'Bone' : {},
-    'BoneGroup' : {},
-    'Rigify' : {},
-
-    'Action' : {},
-    'Group' : {},
-
-    'MeshTextureFaceLayer' : {},
-    'MeshColorLayer' : {},
-    'VertexGroup' : {},
-    'ShapeKey' : {},
-    'ParticleSystem' : {},
-
-    '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',
-    'Mesh' : 'meshes',
-    'Lattice' : 'lattices',
-    'Curve' : 'curves',
-    'Text' : 'texts',
-    'Group' : 'groups',
-    'Empty' : 'empties',
-    'Armature' : 'armatures',
-    'Bone' : 'bones',
-    'BoneGroup' : 'bone_groups',
-    'Pose' : 'poses',
-    'PoseBone' : 'pose_bones',
-    'Material' : 'materials',
-    'Texture' : 'textures',
-    'Image' : 'images',
-    'Camera' : 'cameras',
-    'Lamp' : 'lamps',
-    'World' : 'worlds',
-}
-
-#
-#    readMhxFile(filePath):
-#
-
-def readMhxFile(filePath):
-    global nErrors, theScale, theArmature, defaultScale, One
-    global toggle, warnedVersion, theMessage, alpha7, theDir
-
-    defaultScale = theScale
-    One = 1.0/theScale
-    theArmature = None
-    alpha7 = False
-    warnedVersion = False
-    initLoadedData()
-    theMessage = ""
-
-    theDir = os.path.dirname(filePath)
-    fileName = os.path.expanduser(filePath)
-    _,ext = os.path.splitext(fileName)
-    if ext.lower() != ".mhx":
-        print("Error: Not a mhx file: %s" % fileName.encode('utf-8', 'strict'))
-        return
-    print( "Opening MHX file %s " % fileName.encode('utf-8', 'strict') )
-    print("Toggle %x" % toggle)
-    time1 = time.clock()
-
-    # ignore = False  # UNUSED
-    stack = []
-    tokens = []
-    key = "toplevel"
-    level = 0
-    nErrors = 0
-    comment = 0
-    nesting = 0
-
-    file= open(fileName, "rU")
-    print( "Tokenizing" )
-    lineNo = 0
-    for line in file:
-        # print(line)
-        lineSplit= line.split()
-        lineNo += 1
-        if len(lineSplit) == 0:
-            pass
-        elif lineSplit[0][0] == '#':
-            if lineSplit[0] == '#if':
-                if comment == nesting:
-                    try:
-                        res = mhxEval(lineSplit[1])
-                    except:
-                        res = False
-                    if res:
-                        comment += 1
-                nesting += 1
-            elif lineSplit[0] == '#else':
-                if comment == nesting-1:
-                    comment += 1
-                elif comment == nesting:
-                    comment -= 1
-            elif lineSplit[0] == '#endif':
-                if comment == nesting:
-                    comment -= 1
-                nesting -= 1
-        elif comment < nesting:
-            pass
-        elif lineSplit[0] == 'end':
-            try:
-                sub = tokens
-                tokens = stack.pop()
-                if tokens:
-                    tokens[-1][2] = sub
-                level -= 1
-            except:
-                print( "Tokenizer error at or before line %d.\nThe mhx file has been corrupted.\nTry to export it again from MakeHuman." % lineNo )
-                print( line )
-                stack.pop()
-        elif lineSplit[-1] == ';':
-            if lineSplit[0] == '\\':
-                key = lineSplit[1]
-                tokens.append([key,lineSplit[2:-1],[]])
-            else:
-                key = lineSplit[0]
-                tokens.append([key,lineSplit[1:-1],[]])
-        else:
-            key = lineSplit[0]
-            tokens.append([key,lineSplit[1:],[]])
-            stack.append(tokens)
-            level += 1
-            tokens = []
-    file.close()
-
-    if level != 0:
-        MyError("Tokenizer error (%d).\nThe mhx file has been corrupted.\nTry to export it again from MakeHuman." % level)
-    scn = clearScene()
-    print( "Parsing" )
-    parse(tokens)
-
-    scn.objects.active = theArmature
-    bpy.ops.object.mode_set(mode='OBJECT')
-    bpy.ops.object.select_all(action='DESELECT')
-    theArmature.select = True
-    bpy.ops.object.mode_set(mode='POSE')
-    theArmature.MhAlpha8 = not alpha7
-    #bpy.ops.wm.properties_edit(data_path="object", property="MhxRig", value=theArmature["MhxRig"])
-
-    time2 = time.clock()
-    msg = "File %s loaded in %g s" % (fileName, time2-time1)
-    if nErrors:
-        msg += " but there where %d errors. " % (nErrors)
-    print(msg)
-    return
-
-#
-#    getObject(name, var):
-#
-
-def getObject(name, var):
-    try:
-        return loadedData['Object'][name]
-    except:
-        raise MhxError("Bug: object %s not found" % ob)
-
-#
-#    checkMhxVersion(major, minor):
-#
-
-def checkMhxVersion(major, minor):
-    global warnedVersion
-    print("MHX", (major,minor), (MAJOR_VERSION, MINOR_VERSION), warnedVersion)
-    if  major != MAJOR_VERSION or minor < FROM_VERSION:
-        if warnedVersion:
-            return
-        else:
-            msg = (
-"Wrong MHX version\n" +
-"Expected MHX %d.%02d but the loaded file " % (MAJOR_VERSION, MINOR_VERSION) +
-"has version MHX %d.%02d\n" % (major, minor))
-            if minor < FROM_VERSION:
-                msg += (
-"You can disable this error message by deselecting the \n" +
-"Enforce version option when importing. Better:\n" +
-"Export the MHX file again with an updated version of MakeHuman.\n" +
-"The most up-to-date version of MakeHuman is the nightly build.\n")
-  

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list