refactor VmcExtBlendVal to have a new constructor option
This commit is contained in:
parent
64fcc22ea2
commit
c72cb2d6ec
|
@ -42,57 +42,94 @@ namespace godotVmcSharp
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var blendShape = (string)m.Data[0].Value;
|
var blendShape = (string)m.Data[0].Value;
|
||||||
if (blendShape == "Joy" || blendShape == "Angry" || blendShape == "Sorrow" || blendShape == "Fun" ||
|
if (isVrm0BlendShape(blendShape))
|
||||||
blendShape == "A" || blendShape == "I" || blendShape == "U" || blendShape == "E" || blendShape == "O" ||
|
|
||||||
blendShape == "Blink_L" || blendShape == "Blink_R")
|
|
||||||
{
|
{
|
||||||
name = blendShape;
|
name = blendShape;
|
||||||
value = (float)m.Data[1].Value;
|
value = (float)m.Data[1].Value;
|
||||||
return;
|
return;
|
||||||
} else if (blendShape == "happy" || blendShape == "angry" || blendShape == "sad" || blendShape == "relaxed" ||
|
}
|
||||||
blendShape == "aa" || blendShape == "ih" || blendShape == "ou" || blendShape == "ee" || blendShape == "oh" ||
|
if (isVrm1Expression(blendShape))
|
||||||
blendShape == "blinkLeft" || blendShape == "blinkRight")
|
|
||||||
{
|
{
|
||||||
name = blendShape;
|
name = blendShape;
|
||||||
value = (float)m.Data[1].Value;
|
value = (float)m.Data[1].Value;
|
||||||
return;
|
return;
|
||||||
} else if (blendShape == "browInnerUp" ||
|
}
|
||||||
blendShape == "browDownLeft" || blendShape == "browDownRight" ||
|
if (isArkitBlendShape(blendShape))
|
||||||
blendShape == "browOuterUpLeft" || blendShape == "browOuterUpRight" ||
|
|
||||||
blendShape == "eyeLookUpLeft" || blendShape == "eyeLookUpRight" ||
|
|
||||||
blendShape == "eyeLookDownLeft" || blendShape == "eyeLookDownRight" ||
|
|
||||||
blendShape == "eyeLookInLeft" || blendShape == "eyeLookInRight" ||
|
|
||||||
blendShape == "eyeLookOutLeft" || blendShape == "eyeLookOutRight" ||
|
|
||||||
blendShape == "eyeBlinkLeft" || blendShape == "eyeBlinkRight" ||
|
|
||||||
blendShape == "eyeSquintLeft" || blendShape == "eyeSquintRight" ||
|
|
||||||
blendShape == "eyeWideLeft" || blendShape == "eyeWideRight" ||
|
|
||||||
blendShape == "cheekPuff" ||
|
|
||||||
blendShape == "cheekSquintLeft" || blendShape == "cheekSquintRight" ||
|
|
||||||
blendShape == "noseSneerLeft" || blendShape == "noseSneerRight" ||
|
|
||||||
blendShape == "jawOpen" || blendShape == "jawForward" ||
|
|
||||||
blendShape == "jawLeft" || blendShape == "jawRight" ||
|
|
||||||
blendShape == "mouthFunnel" || blendShape == "mouthPucker" ||
|
|
||||||
blendShape == "mouthLeft" || blendShape == "mouthRight" ||
|
|
||||||
blendShape == "mouthRollUpper" || blendShape == "mouthRollLower" ||
|
|
||||||
blendShape == "mouthShrugUpper" || blendShape == "mouthShrugLower" ||
|
|
||||||
blendShape == "mouthClose" ||
|
|
||||||
blendShape == "mouthSmileLeft" || blendShape == "mouthSmileRight" ||
|
|
||||||
blendShape == "mouthFrownLeft" || blendShape == "mouthFrownRight" ||
|
|
||||||
blendShape == "mouthDimpleLeft" || blendShape == "mouthDimpleRight" ||
|
|
||||||
blendShape == "mouthUpperUpLeft" || blendShape == "mouthUpperUpRight" ||
|
|
||||||
blendShape == "mouthLowerDownLeft" || blendShape == "mouthLowerDownRight" ||
|
|
||||||
blendShape == "mouthPressLeft" || blendShape == "mouthPressRight" ||
|
|
||||||
blendShape == "mouthStretchLeft" || blendShape == "mouthStretchRight" ||
|
|
||||||
blendShape == "tongueOut")
|
|
||||||
{
|
{
|
||||||
name = blendShape;
|
name = blendShape;
|
||||||
value = (float)m.Data[1].Value;
|
value = (float)m.Data[1].Value;
|
||||||
return;
|
return;
|
||||||
} else
|
}
|
||||||
|
GD.Print($"Invalid argument for {addr}. BlendShape \"{blendShape}\" not in list.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public VmcExtBlendVal(string _name, float _value) : base(new godotOscSharp.Address("VMC/Ext/Blend/Val"))
|
||||||
{
|
{
|
||||||
GD.Print($"Invalid argument for /VMC/Ext/Blend/Val. BlendShape \"{blendShape}\" not in list.");
|
if (isVrm0BlendShape(_name))
|
||||||
|
{
|
||||||
|
name = _name;
|
||||||
|
value = _value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (isVrm1Expression(_name))
|
||||||
|
{
|
||||||
|
name = _name;
|
||||||
|
value = _value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isArkitBlendShape(_name))
|
||||||
|
{
|
||||||
|
name = _name;
|
||||||
|
value = _value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
GD.Print($"Invalid argument for {addr}. BlendShape \"{_name}\" not in list.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool isVrm0BlendShape(string name)
|
||||||
|
{
|
||||||
|
return name == "Joy" || name == "Angry" || name == "Sorrow" || name == "Fun" ||
|
||||||
|
name == "A" || name == "I" || name == "U" || name == "E" || name == "O" ||
|
||||||
|
name == "Blink_L" || name == "Blink_R";
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool isVrm1Expression(string name)
|
||||||
|
{
|
||||||
|
return name == "happy" || name == "angry" || name == "sad" || name == "relaxed" ||
|
||||||
|
name == "aa" || name == "ih" || name == "ou" || name == "ee" || name == "oh" ||
|
||||||
|
name == "blinkLeft" || name == "blinkRight";
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool isArkitBlendShape(string name)
|
||||||
|
{
|
||||||
|
return name == "browInnerUp" ||
|
||||||
|
name == "browDownLeft" || name == "browDownRight" ||
|
||||||
|
name == "browOuterUpLeft" || name == "browOuterUpRight" ||
|
||||||
|
name == "eyeLookUpLeft" || name == "eyeLookUpRight" ||
|
||||||
|
name == "eyeLookDownLeft" || name == "eyeLookDownRight" ||
|
||||||
|
name == "eyeLookInLeft" || name == "eyeLookInRight" ||
|
||||||
|
name == "eyeLookOutLeft" || name == "eyeLookOutRight" ||
|
||||||
|
name == "eyeBlinkLeft" || name == "eyeBlinkRight" ||
|
||||||
|
name == "eyeSquintLeft" || name == "eyeSquintRight" ||
|
||||||
|
name == "eyeWideLeft" || name == "eyeWideRight" ||
|
||||||
|
name == "cheekPuff" ||
|
||||||
|
name == "cheekSquintLeft" || name == "cheekSquintRight" ||
|
||||||
|
name == "noseSneerLeft" || name == "noseSneerRight" ||
|
||||||
|
name == "jawOpen" || name == "jawForward" ||
|
||||||
|
name == "jawLeft" || name == "jawRight" ||
|
||||||
|
name == "mouthFunnel" || name == "mouthPucker" ||
|
||||||
|
name == "mouthLeft" || name == "mouthRight" ||
|
||||||
|
name == "mouthRollUpper" || name == "mouthRollLower" ||
|
||||||
|
name == "mouthShrugUpper" || name == "mouthShrugLower" ||
|
||||||
|
name == "mouthClose" ||
|
||||||
|
name == "mouthSmileLeft" || name == "mouthSmileRight" ||
|
||||||
|
name == "mouthFrownLeft" || name == "mouthFrownRight" ||
|
||||||
|
name == "mouthDimpleLeft" || name == "mouthDimpleRight" ||
|
||||||
|
name == "mouthUpperUpLeft" || name == "mouthUpperUpRight" ||
|
||||||
|
name == "mouthLowerDownLeft" || name == "mouthLowerDownRight" ||
|
||||||
|
name == "mouthPressLeft" || name == "mouthPressRight" ||
|
||||||
|
name == "mouthStretchLeft" || name == "mouthStretchRight" ||
|
||||||
|
name == "tongueOut";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user