forked from dfgHiatus/VRCFT-Babble
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Decoupled expressions from module, now in config file
- Loading branch information
Showing
7 changed files
with
447 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,86 @@ | ||
namespace VRCFaceTracking.Babble; | ||
public partial class BabbleOSC | ||
using Newtonsoft.Json; | ||
using System.Reflection; | ||
using VRCFaceTracking.Core.Params.Expressions; | ||
using VRCFaceTracking.Babble.Collections; | ||
|
||
namespace VRCFaceTracking.Babble; | ||
public static class BabbleExpressions | ||
{ | ||
public Dictionary<string, float> BabbleExpressionMap = new() | ||
private const string BabbleExpressionsPath = "BabbleExpressions.json"; | ||
|
||
public static readonly TwoKeyDictionary<UnifiedExpressions, string, float> BabbleExpressionMap; | ||
static BabbleExpressions() | ||
{ | ||
{ "/cheekPuffLeft", 0f }, | ||
{ "/cheekPuffRight", 0f }, | ||
{ "/cheekSuckLeft", 0f }, | ||
{ "/cheekSuckRight", 0f }, | ||
{ "/jawOpen", 0f }, | ||
{ "/jawForward", 0f }, | ||
{ "/jawLeft", 0f }, | ||
{ "/jawRight", 0f }, | ||
{ "/noseSneerLeft", 0f }, | ||
{ "/noseSnerrRight", 0f }, | ||
{ "/mouthFunnel", 0f }, | ||
{ "/mouthPucker", 0f }, | ||
{ "/mouthLeft", 0f }, | ||
{ "/mouthRight", 0f }, | ||
{ "/mouthRollUpper", 0f }, | ||
{ "/mouthRollLower", 0f }, | ||
{ "/mouthShrugUpper", 0f }, | ||
{ "/mouthShrugLower", 0f }, | ||
{ "/mouthClose", 0f }, | ||
{ "/mouthSmileLeft", 0f }, | ||
{ "/mouthSmileRight", 0f }, | ||
{ "/mouthFrownLeft", 0f }, | ||
{ "/mouthFrownRight", 0f }, | ||
{ "/mouthDimpleLeft", 0f }, | ||
{ "/mouthDimpleRight", 0f }, | ||
{ "/mouthUpperUpLeft", 0f }, | ||
{ "/mouthUpperUpRight", 0f }, | ||
{ "/mouthLowerDownLeft", 0f }, | ||
{ "/mouthLowerDownRight", 0f }, | ||
{ "/mouthPressLeft", 0f }, | ||
{ "/mouthPressRight", 0f }, | ||
{ "/mouthStretchLeft", 0f }, | ||
{ "/mouthStretchRight", 0f }, | ||
{ "/tongueOut", 0f }, | ||
{ "/tongueUp", 0f }, | ||
{ "/tongueDown", 0f }, | ||
{ "/tongueLeft", 0f }, | ||
{ "/tongueRight", 0f }, | ||
{ "/tongueRoll", 0f }, | ||
{ "/tongueBendDown", 0f }, | ||
{ "/tongueCurlUp", 0f }, | ||
{ "/tongueSquish", 0f }, | ||
{ "/tongueFlat", 0f }, | ||
{ "/tongueTwistLeft", 0f }, | ||
{ "/tognueTwistRight", 0f } | ||
var expressions = Path.Combine( | ||
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, | ||
BabbleExpressionsPath); | ||
var converter = new TwoKeyDictionaryConverter<UnifiedExpressions, string, float>(); | ||
if (!File.Exists(expressions)) | ||
{ | ||
string json = JsonConvert.SerializeObject( | ||
DefaultBabbleExpressionMap, converter); | ||
File.WriteAllText(expressions, json); | ||
} | ||
|
||
BabbleExpressionMap = JsonConvert.DeserializeObject | ||
<TwoKeyDictionary<UnifiedExpressions, string, float>> | ||
(File.ReadAllText(expressions), converter)!; | ||
} | ||
|
||
private static readonly TwoKeyDictionary<UnifiedExpressions, string, float> DefaultBabbleExpressionMap = new() | ||
{ | ||
{ UnifiedExpressions.CheekPuffLeft, "/cheekPuffLeft", 0f }, | ||
{ UnifiedExpressions.CheekPuffRight, "/cheekPuffRight", 0f }, | ||
{ UnifiedExpressions.CheekSuckLeft, "/cheekSuckLeft", 0f }, | ||
{ UnifiedExpressions.CheekSuckRight, "/cheekSuckRight", 0f }, | ||
{ UnifiedExpressions.JawOpen, "/jawOpen", 0f }, | ||
{ UnifiedExpressions.JawForward, "/jawForward", 0f }, | ||
{ UnifiedExpressions.JawLeft, "/jawLeft", 0f }, | ||
{ UnifiedExpressions.JawRight, "/jawRight", 0f }, | ||
{ UnifiedExpressions.NoseSneerLeft, "/noseSneerLeft", 0f }, | ||
{ UnifiedExpressions.NoseSneerRight, "/noseSneerRight", 0f }, | ||
{ UnifiedExpressions.LipFunnelLowerLeft, "/mouthFunnel", 0f }, | ||
{ UnifiedExpressions.LipFunnelLowerRight, "/mouthFunnel", 0f }, | ||
{ UnifiedExpressions.LipFunnelUpperLeft, "/mouthFunnel", 0f }, | ||
{ UnifiedExpressions.LipFunnelUpperRight, "/mouthFunnel", 0f }, | ||
{ UnifiedExpressions.LipPuckerLowerLeft, "/mouthPucker", 0f }, | ||
{ UnifiedExpressions.LipPuckerLowerRight, "/mouthPucker", 0f }, | ||
{ UnifiedExpressions.LipPuckerUpperLeft, "/mouthPucker", 0f }, | ||
{ UnifiedExpressions.LipPuckerUpperRight, "/mouthPucker", 0f }, | ||
{ UnifiedExpressions.MouthPressLeft, "/mouthLeft", 0f }, | ||
{ UnifiedExpressions.MouthPressRight, "/mouthRight", 0f }, | ||
{ UnifiedExpressions.LipSuckUpperLeft, "/mouthRollUpper", 0f }, | ||
{ UnifiedExpressions.LipSuckUpperRight, "/mouthRollUpper", 0f }, | ||
{ UnifiedExpressions.LipSuckLowerLeft, "/mouthRollLower", 0f }, | ||
{ UnifiedExpressions.LipSuckLowerRight, "/mouthRollLower", 0f }, | ||
{ UnifiedExpressions.MouthRaiserUpper, "/mouthShrugUpper", 0f }, | ||
{ UnifiedExpressions.MouthRaiserLower, "/mouthShrugLower", 0f }, | ||
{ UnifiedExpressions.MouthClosed, "/mouthClose", 0f }, | ||
{ UnifiedExpressions.MouthCornerPullLeft, "/mouthSmileLeft", 0f }, | ||
{ UnifiedExpressions.MouthCornerPullRight, "/mouthSmileRight", 0f }, | ||
{ UnifiedExpressions.MouthFrownLeft, "/mouthFrownLeft", 0f }, | ||
{ UnifiedExpressions.MouthFrownRight, "/mouthFrownRight", 0f }, | ||
{ UnifiedExpressions.MouthDimpleLeft, "/mouthDimpleLeft", 0f }, | ||
{ UnifiedExpressions.MouthDimpleRight, "/mouthDimpleRight", 0f }, | ||
{ UnifiedExpressions.MouthUpperUpLeft, "/mouthUpperUpLeft", 0f }, | ||
{ UnifiedExpressions.MouthUpperUpRight, "/mouthUpperUpRight", 0f }, | ||
{ UnifiedExpressions.MouthLowerDownLeft, "/mouthLowerDownLeft", 0f }, | ||
{ UnifiedExpressions.MouthLowerDownRight, "/mouthLowerDownRight", 0f }, | ||
{ UnifiedExpressions.MouthPressLeft, "/mouthPressLeft", 0f }, | ||
{ UnifiedExpressions.MouthPressRight, "/mouthPressRight", 0f }, | ||
{ UnifiedExpressions.MouthStretchLeft, "/mouthStretchLeft", 0f }, | ||
{ UnifiedExpressions.MouthStretchRight, "/mouthStretchRight", 0f }, | ||
{ UnifiedExpressions.TongueOut, "/tongueOut", 0f }, | ||
{ UnifiedExpressions.TongueUp, "/tongueUp", 0f }, | ||
{ UnifiedExpressions.TongueDown, "/tongueDown", 0f }, | ||
{ UnifiedExpressions.TongueLeft, "/tongueLeft", 0f }, | ||
{ UnifiedExpressions.TongueRight, "/tongueRight", 0f }, | ||
{ UnifiedExpressions.TongueRoll, "/tongueRoll", 0f }, | ||
{ UnifiedExpressions.TongueBendDown, "/tongueBendDown", 0f }, | ||
{ UnifiedExpressions.TongueCurlUp, "/tongueCurlUp", 0f }, | ||
{ UnifiedExpressions.TongueSquish, "/tongueSquish", 0f }, | ||
{ UnifiedExpressions.TongueFlat, "/tongueFlat", 0f }, | ||
{ UnifiedExpressions.TongueTwistLeft, "/tongueTwistLeft", 0f }, | ||
{ UnifiedExpressions.TongueTwistRight, "/tongueTwistRight", 0 } | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.