Moderator: joepal
but I cannot see the problem; perhaps you could explain a bit more, Thomas?I have tried to make a user interface, but it currently messes up the code
diff --git a/blender/python/import_scene_mhx.py b/blender/python/import_scene_mhx.py
index 92caca9..36f514d 100644
--- a/blender/python/import_scene_mhx.py
+++ b/blender/python/import_scene_mhx.py
@@ -1483,10 +1483,11 @@ def clearScene():
#
# User interface
#
-"""
+
DEBUG= False
from bpy.props import *
+"""
def check(flag):
global toggle
if toggle & flag:
@@ -1657,7 +1658,7 @@ bpy.types.register(OBJECT_OT_mhx_import)
bpy.types.register(IMPORT_PT_makehuman_mhx)
"""
-"""
+
class IMPORT_OT_makehuman_mhx(bpy.types.Operator):
'''Import from MHX file format (.mhx)'''
bl_idname = "import_scene.makehuman_mhx"
@@ -1690,12 +1691,12 @@ class IMPORT_OT_makehuman_mhx(bpy.types.Operator):
bpy.types.register(IMPORT_OT_makehuman_mhx)
menu_func = lambda self, context: self.layout.operator(IMPORT_OT_makehuman_mhx.bl_idname, text="MakeHuman (.mhx)...")
bpy.types.INFO_MT_file_import.append(menu_func)
-"""
+
#
# Testing
#
-toggle = T_Replace + T_ArmIK + T_LegIK + T_Face
-readMhxFile("/home/thomas/makehuman/exports/foo-classic-25.mhx")
+#toggle = T_Replace + T_ArmIK + T_LegIK + T_Face
+#readMhxFile("/home/thomas/makehuman/exports/foo-classic-25.mhx")
#readMhxFile("C:/Documents and Settings/xxxxxxxxxxxxxxxxxxxx/Mina dokument/makehuman/exports/foo-classic-25.mhx")
#readMhxFile("/home/thomas/mhx5/test1.mhx")
#readMhxFile("/home/thomas/myblends/mhx4/test1.mhx")
error: this CustomDataLayer must not be written to file
error: this CustomDataLayer must not be written to file
error: this CustomDataLayer must not be written to file
error: this CustomDataLayer must not be written to file
error: this CustomDataLayer must not be written to file
error: this CustomDataLayer must not be written to file
error: this CustomDataLayer must not be written to file
RNA_string_set: IMPORT_SCENE_OT_makehuman_mhx.filename not found.
RNA_string_set: IMPORT_SCENE_OT_makehuman_mhx.directory not found.
Opening MHX file /home/martin/makehuman/exports/test-2010-0219-classic-25.mhx
Tokenizing
clearScene 32 <bpy_struct, Scene("Scene")>
Parsing
Parse Armature
Armature <bpy_struct, Armature("HumanRig.001")> <bpy_struct, Object("HumanRig")>
error: this CustomDataLayer must not be written to file
error: this CustomDataLayer must not be written to file
<bpy_struct, Armature("HumanRig.001")>
Parse Pose
<bpy_struct, Object("HumanRig")>
Parse Object
Found data
Parse Mesh
Mesh <bpy_struct, Mesh("Human.001")> <bpy_struct, Object("Human")>
Could not add material SSS_skinshader
Could not add material Invisio
Could not add material Hair
<bpy_struct, Mesh("Human.001")>
Parse Object
Found data
MOD Armature ARMATURE
MOD2 <bpy_struct, ArmatureModifier("Armature")>
<bpy_struct, Object("Human")> <bpy_struct, Object("Human")>
<bpy_collection[0], Object.particle_systems> []
error: this CustomDataLayer must not be written to file
<bpy_collection[1], Object.particle_systems> [<bpy_struct, ParticleSystem("ParticleSystem")>]
Psys <bpy_struct, ParticleSystem("ParticleSystem")>
Old structrna psys.settings <bpy_struct, ParticleSettings("ParticleSettings.001")>
Old structrna data.effector_weights <bpy_struct, EffectorWeights>
Struct done data.effector_weights
Struct done psys.settings
error: this CustomDataLayer must not be written to file
Parse Mesh
Mesh <bpy_struct, Mesh("MHBall.001")> <bpy_struct, Object("MHBall")>
<bpy_struct, Mesh("MHBall.001")>
Parse Object
Found data
Parse Mesh
Mesh <bpy_struct, Mesh("MHCircle03.001")> <bpy_struct, Object("MHCircle03")>
<bpy_struct, Mesh("MHCircle03.001")>
Parse Object
Found data
Parse Mesh
Mesh <bpy_struct, Mesh("MHCircle05.001")> <bpy_struct, Object("MHCircle05")>
<bpy_struct, Mesh("MHCircle05.001")>
Parse Object
Found data
Parse Mesh
Mesh <bpy_struct, Mesh("MHCircle10.001")> <bpy_struct, Object("MHCircle10")>
<bpy_struct, Mesh("MHCircle10.001")>
Parse Object
Found data
Parse Mesh
Mesh <bpy_struct, Mesh("MHCircle15.001")> <bpy_struct, Object("MHCircle15")>
<bpy_struct, Mesh("MHCircle15.001")>
Parse Object
Found data
Parse Mesh
Mesh <bpy_struct, Mesh("MHFace.001")> <bpy_struct, Object("MHFace")>
<bpy_struct, Mesh("MHFace.001")>
Parse Object
Found data
Failed: ob.active_material = loadedData['Material']['Hair']
Failed: ob.active_material = loadedData['Material']['Hair']
setinfl UpArm_L
setinfl LoArm_L
setinfl Hand_L
setinfl UpArm_R
setinfl LoArm_R
setinfl Hand_R
setinfl UpLeg_L
setinfl LoLeg_L
setinfl Foot_L
setinfl Toe_L
setinfl UpLeg_R
setinfl LoLeg_R
setinfl Foot_R
setinfl Toe_R
File /home/martin/makehuman/exports/test-2010-0219-classic-25.mhx loaded in 28.48 s but there where 2 errors.
diff --git a/blender/python/import_scene_mhx.py b/blender/python/import_scene_mhx.py
index 92caca9..1451a08 100644
--- a/blender/python/import_scene_mhx.py
+++ b/blender/python/import_scene_mhx.py
@@ -70,7 +70,7 @@ toggle = T_Replace + T_ArmIK + T_LegIK
useMesh = 1
doSmash = 1
-verbosity = 2
+verbosity = 3
warnedTextureDir = False
warnedVersion = False
@@ -158,16 +158,6 @@ def vertcolCreator(me, name):
#
-# loadMhx(filePath, context, flags):
-#
-
-def loadMhx(filePath, context, flags):
- global toggle
- toggle = flags
- readMhxFile(filePath)
- return
-
-#
# readMhxFile(filePath):
#
@@ -1483,181 +1473,10 @@ def clearScene():
#
# User interface
#
-"""
+
DEBUG= False
from bpy.props import *
-def check(flag):
- global toggle
- if toggle & flag:
- return "CHECKBOX_HLT"
- else:
- return "CHECKBOX_DEHLT"
-
-class IMPORT_PT_makehuman_mhx(bpy.types.Panel):
- bl_label = "Import MHX"
- bl_space_type = "PROPERTIES"
- bl_region_type = "WINDOW"
- bl_context = "scene"
-
- def draw(self, context):
- row = self.layout.row()
- col = []
- split = row.split(percentage = 1.0/3)
- col.append(split.column())
- col[0].operator("mhxArmIK", icon=check(T_ArmIK))
- col.append(split.column())
- col[1].operator("mhxLegIK", icon=check(T_LegIK))
- col.append(split.column())
- col[2].operator("mhxFingerIK", icon=check(T_FingerIK))
-
- row = self.layout.row()
- col = []
- split = row.split(percentage = 1.0/3)
- col.append(split.column())
- col[0].operator("mhxFKIK", icon=check(T_FKIK))
- col.append(split.column())
- col[1].operator("mhxDispObs", icon=check(T_DispObs))
- col.append(split.column())
- col[2].operator("mhxReplace", icon=check(T_Replace))
-
- row = self.layout.row()
- col = []
- split = row.split(percentage = 1.0/3)
- col.append(split.column())
- col[0].operator("mhxShapes", icon=check(T_Face))
- col.append(split.column())
- col[1].operator("mhxRot90", icon=check(T_Rot90))
- col.append(split.column())
- col[2].operator("mhxTexDir")
-
- row = self.layout.row()
- row.operator("mhxImport")
-
- return
-
-class OBJECT_OT_mhx_arm_ik(bpy.types.Operator):
- bl_label = "Arm IK"
- bl_idname = "mhxArmIK"
- bl_description = "Arm IK"
-
- def invoke(self, context, event):
- global toggle
- toggle ^= T_ArmIK
- return{'FINISHED'}
-
-class OBJECT_OT_mhx_leg_ik(bpy.types.Operator):
- bl_label = "Leg IK"
- bl_idname = "mhxLegIK"
- bl_description = "Leg IK"
-
- def invoke(self, context, event):
- global toggle
- toggle ^= T_LegIK
- return{'FINISHED'}
-
-class OBJECT_OT_mhx_finger_ik(bpy.types.Operator):
- bl_label = "Finger IK"
- bl_idname = "mhxFingerIK"
- bl_description = "Finger IK"
-
- def invoke(self, context, event):
- global toggle
- toggle ^= T_FingerIK
- return{'FINISHED'}
-
-class OBJECT_OT_mhx_fkik(bpy.types.Operator):
- bl_label = "FK/IK"
- bl_idname = "mhxFKIK"
- bl_description = "FK/IK switch"
-
- def invoke(self, context, event):
- global toggle
- toggle ^= T_FKIK
- return{'FINISHED'}
-
-class OBJECT_OT_mhx_dispobs(bpy.types.Operator):
- bl_label = "Dispobs"
- bl_idname = "mhxDispObs"
- bl_description = "Display objects"
-
- def invoke(self, context, event):
- global toggle
- toggle ^= T_DispObs
- return{'FINISHED'}
-
-class OBJECT_OT_mhx_replace(bpy.types.Operator):
- bl_label = "Replace scene"
- bl_idname = "mhxReplace"
- bl_description = "Replace scene"
-
- def invoke(self, context, event):
- global toggle
- toggle ^= T_Replace
- return{'FINISHED'}
-
-
-class OBJECT_OT_mhx_shapes(bpy.types.Operator):
- bl_label = "Shapes"
- bl_idname = "mhxShapes"
- bl_description = "Shape keys"
-
- def invoke(self, context, event):
- global toggle
- toggle ^= T_Face
- return{'FINISHED'}
-
-class OBJECT_OT_mhx_rot90(bpy.types.Operator):
- bl_label = "Rot 90"
- bl_idname = "mhxRot90"
- bl_description = "Rotate 90 degrees (Y up)"
-
- def invoke(self, context, event):
- global toggle
- toggle ^= T_Rot90
- return{'FINISHED'}
-
-class OBJECT_OT_mhx_texdir(bpy.types.Operator):
- bl_label = "Tex dir"
- bl_idname = "mhxTexDir"
- bl_description = "Choose texture directory"
-
- def invoke(self, context, event):
- return{'FINISHED'}
-
-class OBJECT_OT_mhx_import(bpy.types.Operator):
- bl_label = "Import MHX file"
- bl_idname = "mhxImport"
- bl_description = "Import MHX file"
- bl_space_type = "PROPERTIES"
- bl_region_type = "WINDOW"
-
- path = StringProperty(name="File Path", description="File path used for importing the MHX file", maxlen= 1024, default= "")
-
- def execute(self, context):
- readMhxFile(self.properties.path)
- return {'FINISHED'}
-
- def invoke(self, context, event):
- wm = context.manager
- wm.add_fileselect(self)
- return {'RUNNING_MODAL'}
-
-
-bpy.types.register(OBJECT_OT_mhx_arm_ik)
-bpy.types.register(OBJECT_OT_mhx_leg_ik)
-bpy.types.register(OBJECT_OT_mhx_finger_ik)
-bpy.types.register(OBJECT_OT_mhx_fkik)
-bpy.types.register(OBJECT_OT_mhx_dispobs)
-bpy.types.register(OBJECT_OT_mhx_replace)
-bpy.types.register(OBJECT_OT_mhx_shapes)
-bpy.types.register(OBJECT_OT_mhx_rot90)
-bpy.types.register(OBJECT_OT_mhx_texdir)
-bpy.types.register(OBJECT_OT_mhx_import)
-bpy.types.register(IMPORT_PT_makehuman_mhx)
-"""
-
-"""
class IMPORT_OT_makehuman_mhx(bpy.types.Operator):
'''Import from MHX file format (.mhx)'''
bl_idname = "import_scene.makehuman_mhx"
@@ -1677,8 +1496,21 @@ class IMPORT_OT_makehuman_mhx(bpy.types.Operator):
face = BoolProperty(name="Face shapes", description="Include facial shapekeys", default= True)
shape = BoolProperty(name="Body shapes", description="Include body shapekeys", default= False)
rot90 = BoolProperty(name="Rot 90", description="Rotate X 90.", default= False)
+ rigify = BoolProperty(name="Rigify", description="Rigify.", default= False)
def execute(self, context):
+ global toggle
+ O_ArmIK = T_ArmIK if self.properties.armik else 0
+ O_LegIK = T_LegIK if self.properties.legik else 0
+ O_FKIK = T_FKIK if self.properties.armik else 0
+ O_FingerIK = T_FingerIK if self.properties.fkik else 0
+ O_DispObs = T_DispObs if self.properties.dispobs else 0
+ O_Replace = T_Replace if self.properties.replace else 0
+ O_Face = T_Face if self.properties.face else 0
+ O_Shape = T_Shape if self.properties.shape else 0
+ O_Rot90 = T_Rot90 if self.properties.rot90 else 0
+ O_Rigify = T_Rigify if self.properties.rigify else 0
+ toggle = O_ArmIK | O_LegIK | O_FKIK | O_FingerIK | O_DispObs | O_Replace | O_Face | O_Shape | O_Rot90 | O_Rigify
readMhxFile(self.properties.path)
return {'FINISHED'}
@@ -1690,12 +1522,12 @@ class IMPORT_OT_makehuman_mhx(bpy.types.Operator):
bpy.types.register(IMPORT_OT_makehuman_mhx)
menu_func = lambda self, context: self.layout.operator(IMPORT_OT_makehuman_mhx.bl_idname, text="MakeHuman (.mhx)...")
bpy.types.INFO_MT_file_import.append(menu_func)
-"""
+
#
# Testing
#
-toggle = T_Replace + T_ArmIK + T_LegIK + T_Face
-readMhxFile("/home/thomas/makehuman/exports/foo-classic-25.mhx")
+#toggle = T_Replace + T_ArmIK + T_LegIK + T_Face
+#readMhxFile("/home/thomas/makehuman/exports/foo-classic-25.mhx")
#readMhxFile("C:/Documents and Settings/xxxxxxxxxxxxxxxxxxxx/Mina dokument/makehuman/exports/foo-classic-25.mhx")
#readMhxFile("/home/thomas/mhx5/test1.mhx")
#readMhxFile("/home/thomas/myblends/mhx4/test1.mhx")
Opening MHX file /home/martin/makehuman/exports/test20100415b-25.mhx
Tokenizing
Traceback (most recent call last):
File "import_scene_mhx.py", line 2106, in execute
Users browsing this forum: No registered users and 1 guest