[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3442] trunk/py/scripts/addons/ io_import_scene_mhx.py: MHX importer: Lipsync tool now works with prop drivers and without drivers for facial shapekeys .
Thomas Larsson
thomas_larsson_01 at hotmail.com
Sun Jun 3 11:42:59 CEST 2012
Revision: 3442
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3442
Author: thomasl
Date: 2012-06-03 09:42:50 +0000 (Sun, 03 Jun 2012)
Log Message:
-----------
MHX importer: Lipsync tool now works with prop drivers and without drivers for facial shapekeys.
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-06-03 01:48:59 UTC (rev 3441)
+++ trunk/py/scripts/addons/io_import_scene_mhx.py 2012-06-03 09:42:50 UTC (rev 3442)
@@ -26,7 +26,7 @@
"""
Abstract
MHX (MakeHuman eXchange format) importer for Blender 2.5x.
-Version 1.13.0
+Version 1.13.1
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, 13, 0),
+ 'version': (1, 13, 1),
"blender": (2, 6, 3),
'location': "File > Import > MakeHuman (.mhx)",
'description': 'Import files in the MakeHuman eXchange format (.mhx)',
@@ -2021,6 +2021,7 @@
ob = loadedData['Object'][human]
except:
return
+ ob["MhxShapekeyDrivers"] = (toggle&T_Shapekeys and toggle&T_ShapeDrivers)
bpy.context.scene.objects.active = ob
bpy.ops.object.mode_set(mode='POSE')
amt = ob.data
@@ -2056,7 +2057,7 @@
except:
ob = None
if toggle & T_Diamond == 0 and ob:
- deleteDiamonds(ob)
+ deleteDiamonds(ob)
return
#
@@ -2949,7 +2950,7 @@
#
# visemes
#
-
+"""
stopStaringVisemes = ({
'Rest' : [
('PMouth', (0,0)),
@@ -3032,118 +3033,206 @@
'Blink' : [('PUpLid', (0,1.0)), ('PLoLid', (0,-1.0))],
'Unblink' : [('PUpLid', (0,0)), ('PLoLid', (0,0))],
})
-
+"""
bodyLanguageVisemes = ({
'Rest' : [
- ('PMouth', (0,0)),
- ('PMouthMid', (0,-0.6)),
- ('PUpLipMid', (0,0)),
- ('PLoLipMid', (0,0)),
- ('PJaw', (0,0)),
- ('PTongue', (0,0))],
+ ('MouthNarrow_L', 0),
+ ('MouthNarrow_R', 0),
+ ('LipsPart', 0.6),
+ ('UpLipsMidHeight', 0),
+ ('LoLipsMidHeight', 0),
+ ('LoLipsIn', 0),
+ ('MouthOpen', 0),
+ ('TongueBackHeight', 0),
+ ('TongueHeight', 0),
+ ],
'Etc' : [
- ('PMouth', (0,0)),
- ('PMouthMid', (0,-0.4)),
- ('PUpLipMid', (0,0)),
- ('PLoLipMid', (0,0)),
- ('PJaw', (0,0)),
- ('PTongue', (0,0))],
+ ('MouthNarrow_L', 0),
+ ('MouthNarrow_R', 0),
+ ('LipsPart', 0.4),
+ ('UpLipsMidHeight', 0),
+ ('LoLipsMidHeight', 0),
+ ('LoLipsIn', 0),
+ ('MouthOpen', 0),
+ ('TongueBackHeight', 0),
+ ('TongueHeight', 0),
+ ],
'MBP' : [
- ('PMouth', (0,0)),
- ('PMouthMid', (0,0)),
- ('PUpLipMid', (0,0)),
- ('PLoLipMid', (0,0)),
- ('PJaw', (0,0)),
- ('PTongue', (0,0))],
+ ('MouthNarrow_L', 0),
+ ('MouthNarrow_R', 0),
+ ('LipsPart', 0),
+ ('UpLipsMidHeight', 0),
+ ('LoLipsMidHeight', 0),
+ ('LoLipsIn', 0),
+ ('MouthOpen', 0),
+ ('TongueBackHeight', 0),
+ ('TongueHeight', 0),
+ ],
'OO' : [
- ('PMouth', (-1.0,0)),
- ('PMouthMid', (0,0)),
- ('PUpLipMid', (0,0)),
- ('PLoLipMid', (0,0)),
- ('PJaw', (0,0.4)),
- ('PTongue', (0,0))],
+ ('MouthNarrow_L', 1.0),
+ ('MouthNarrow_R', 1.0),
+ ('LipsPart', 0),
+ ('UpLipsMidHeight', 0),
+ ('LoLipsMidHeight', 0),
+ ('LoLipsIn', 0),
+ ('MouthOpen', 0.4),
+ ('TongueBackHeight', 0),
+ ('TongueHeight', 0),
+ ],
'O' : [
- ('PMouth', (-0.9,0)),
- ('PMouthMid', (0,0)),
- ('PUpLipMid', (0,0)),
- ('PLoLipMid', (0,0)),
- ('PJaw', (0,0.8)),
- ('PTongue', (0,0))],
+ ('MouthNarrow_L', 0.9),
+ ('MouthNarrow_R', 0.9),
+ ('LipsPart', 0),
+ ('UpLipsMidHeight', 0),
+ ('LoLipsMidHeight', 0),
+ ('LoLipsIn', 0),
+ ('MouthOpen', 0.8),
+ ('TongueBackHeight', 0),
+ ('TongueHeight', 0),
+ ],
'R' : [
- ('PMouth', (-0.5,0)),
- ('PMouthMid', (0,0)),
- ('PUpLipMid', (0,-0.2)),
- ('PLoLipMid', (0,0.2)),
- ('PJaw', (0,0)),
- ('PTongue', (0,0))],
+ ('MouthNarrow_L', 0.5),
+ ('MouthNarrow_R', 0.5),
+ ('LipsPart', 0),
+ ('UpLipsMidHeight', 0.2),
+ ('LoLipsMidHeight', -0.2),
+ ('LoLipsIn', 0),
+ ('MouthOpen', 0),
+ ('TongueBackHeight', 0),
+ ('TongueHeight', 0),
+ ],
'FV' : [
- ('PMouth', (-0.2,0)),
- ('PMouthMid', (0,1.0)),
- ('PUpLipMid', (0,0)),
- ('PLoLipMid', (-0.6,-0.3)),
- ('PJaw', (0,0)),
- ('PTongue', (0,0))],
+ ('MouthNarrow_L', -0.2),
+ ('MouthNarrow_R', -0.2),
+ ('LipsPart', 1.0),
+ ('UpLipsMidHeight', 0),
+ ('LoLipsMidHeight', 0.3),
+ ('LoLipsIn', 0.6),
+ ('MouthOpen', 0),
+ ('TongueBackHeight', 0),
+ ('TongueHeight', 0),
+ ],
'S' : [
- ('PMouth', (0,0)),
- ('PMouthMid', (0,0)),
- ('PUpLipMid', (0,-0.5)),
- ('PLoLipMid', (0,0.7)),
- ('PJaw', (0,0)),
- ('PTongue', (0,0))],
+ ('MouthNarrow_L', 0),
+ ('MouthNarrow_R', 0),
+ ('LipsPart', 0),
+ ('UpLipsMidHeight', 0.5),
+ ('LoLipsMidHeight', -0.7),
+ ('LoLipsIn', 0),
+ ('MouthOpen', 0),
+ ('TongueBackHeight', 0),
+ ('TongueHeight', 0),
+ ],
'SH' : [
- ('PMouth', (-0.8,0)),
- ('PMouthMid', (0,0)),
- ('PUpLipMid', (0,-1.0)),
- ('PLoLipMid', (0,1.0)),
- ('PJaw', (0,0)),
- ('PTongue', (0,0))],
+ ('MouthNarrow_L', -0.8),
+ ('MouthNarrow_R', -0.8),
+ ('LipsPart', 0),
+ ('UpLipsMidHeight', 1.0),
+ ('LoLipsMidHeight', -1.0),
+ ('LoLipsIn', 0),
+ ('MouthOpen', 0),
+ ('TongueBackHeight', 0),
+ ('TongueHeight', 0),
+ ],
'EE' : [
- ('PMouth', (0.2,0)),
- ('PMouthMid', (0,0)),
- ('PUpLipMid', (0,-0.6)),
- ('PLoLipMid', (0,0.6)),
- ('PJaw', (0,0.05)),
- ('PTongue', (0,0))],
+ ('MouthNarrow_L', -0.2),
+ ('MouthNarrow_R', -0.2),
+ ('LipsPart', 0),
+ ('UpLipsMidHeight', 0.6),
+ ('LoLipsMidHeight', -0.6),
+ ('LoLipsIn', 0),
+ ('MouthOpen', 0.5),
+ ('TongueBackHeight', 0),
+ ('TongueHeight', 0),
+ ],
'AH' : [
- ('PMouth', (0,0)),
- ('PMouthMid', (0,0)),
- ('PUpLipMid', (0,-0.4)),
- ('PLoLipMid', (0,0)),
- ('PJaw', (0,0.7)),
- ('PTongue', (0,0))],
+ ('MouthNarrow_L', 0),
+ ('MouthNarrow_R', 0),
+ ('LipsPart', 0),
+ ('UpLipsMidHeight', 0.4),
+ ('LoLipsMidHeight', 0),
+ ('LoLipsIn', 0),
+ ('MouthOpen', 0.7),
+ ('TongueBackHeight', 0),
+ ('TongueHeight', 0),
+ ],
'EH' : [
- ('PMouth', (0,0)),
- ('PMouthMid', (0,0)),
- ('PUpLipMid', (0,-0.5)),
- ('PLoLipMid', (0,0.6)),
- ('PJaw', (0,0.25)),
- ('PTongue', (0,0))],
+ ('MouthNarrow_L', 0),
+ ('MouthNarrow_R', 0),
+ ('LipsPart', 0),
+ ('UpLipsMidHeight', 0.5),
+ ('LoLipsMidHeight', -0.6),
+ ('LoLipsIn', 0),
+ ('MouthOpen', 0.25),
+ ('TongueBackHeight', 0),
+ ('TongueHeight', 0),
+ ],
'TH' : [
- ('PMouth', (0,0)),
- ('PMouthMid', (0,0)),
- ('PUpLipMid', (0,0)),
- ('PLoLipMid', (0,0)),
- ('PJaw', (0,0.2)),
- ('PTongue', (1.0,1.0))],
+ ('MouthNarrow_L', 0),
+ ('MouthNarrow_R', 0),
+ ('LipsPart', 0),
+ ('UpLipsMidHeight', 0),
+ ('LoLipsMidHeight', 0),
+ ('LoLipsIn', 0),
+ ('MouthOpen', 0.2),
+ ('TongueBackHeight', 1.0),
+ ('TongueHeight', 1.0)
+ ],
'L' : [
- ('PMouth', (0,0)),
- ('PMouthMid', (0,0)),
- ('PUpLipMid', (0,-0.5)),
- ('PLoLipMid', (0,0.5)),
- ('PJaw', (0,-0.2)),
- ('PTongue', (1.0,1.0))],
+ ('MouthNarrow_L', 0),
+ ('MouthNarrow_R', 0),
+ ('LipsPart', 0),
+ ('UpLipsMidHeight', 0.5),
+ ('LoLipsMidHeight', -0.5),
+ ('LoLipsIn', 0),
+ ('MouthOpen', -0.2),
+ ('TongueBackHeight', 1.0),
+ ('TongueHeight', 1.0),
+ ],
'G' : [
- ('PMouth', (0,0)),
- ('PMouthMid', (0,0)),
- ('PUpLipMid', (0,-0.5)),
- ('PLoLipMid', (0,0.5)),
- ('PJaw', (0,-0.2)),
- ('PTongue', (-1.0,0))],
+ ('MouthNarrow_L', 0),
+ ('MouthNarrow_R', 0),
+ ('LipsPart', 0),
+ ('UpLipsMidHeight', 0.5),
+ ('LoLipsMidHeight', -0.5),
+ ('LoLipsIn', 0),
+ ('MouthOpen', -0.2),
+ ('TongueBackHeight', 1.0),
+ ('TongueHeight', 0),
+ ],
- 'Blink' : [('PUpLid', (0,1.0)), ('PLoLid', (0,-1.0))],
- 'Unblink' : [('PUpLid', (0,0)), ('PLoLid', (0,0))],
+ 'Blink' : [
+ ('UpLidUp_L', 1),
+ ('UpLidUp_R', 1),
+ ('LoLidDown_L', 1),
+ ('LoLidDown_R', 1)
+ ],
+
+ 'Unblink' : [
+ ('UpLidUp_L', 0),
+ ('UpLidUp_R', 0),
+ ('LoLidDown_L', 0),
+ ('LoLidDown_R', 0)
+ ],
})
+VisemePanelBones = {
+ 'MouthOpen' : ('PJaw', (0,0.25)),
+ 'UpLipsMidHeight' : ('PUpLipMid', (0,-0.25)),
+ 'LoLipsMidHeight' : ('PLoLipMid', (0,-0.25)),
+ 'LoLipsIn': ('PLoLipMid', (-0.25,0)),
+ 'MouthNarrow_L' : ('PMouth_L', (-0.25,0)),
+ 'MouthNarrow_R' : ('PMouth_R', (0.25,0)),
+ 'LipsPart' : ('PMouthMid', (0, -0.25)),
+ 'TongueBackHeight': ('PTongue', (-0.25, 0)),
+ 'TongueHeight' : ('PTongue', (0, -0.25)),
+
+ 'UpLidUp_L' : ('PUpLid_L', (0,1.0)),
+ 'UpLidUp_R' : ('PUpLid_R', (0,1.0)),
+ 'LoLidDown_L' : ('PLoLid_L', (0,-1.0)),
+ 'LoLidDown_R' : ('PLoLid_R', (0,-1.0)),
+}
+
VisemeList = [
('Rest', 'Etc', 'AH'),
('MBP', 'OO', 'O'),
@@ -3294,40 +3383,51 @@
else:
raise MhxError("Unknown viseme set %s" % visset)
+
def setViseme(context, vis, setKey, frame):
- rig = getMhxRig(context.object)
- pbones = rig.pose.bones
- try:
- scale = pbones['PFace'].bone.length
- except:
- return
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list