-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathVDFaceTracking.cs
More file actions
97 lines (81 loc) · 3.53 KB
/
VDFaceTracking.cs
File metadata and controls
97 lines (81 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using FrooxEngine;
using ResoniteModLoader;
using System;
namespace VDFaceTracking
{
public class VDFaceTracking : ResoniteMod
{
internal const string VERSION_CONSTANT = "1.1.4";
internal const string AUTHORS_CONSTANT = "Zeith, dfgHiatus, Geenz, Earthmark, Delta, Modern";
[AutoRegisterConfigKey]
private static readonly ModConfigurationKey<float> EyeOpennessExponent =
new("quest_pro_eye_open_exponent",
"Exponent to apply to eye openness. Can be updated at runtime. Useful for applying different curves for how open your eyes are.",
() => 1.0f);
[AutoRegisterConfigKey]
private static readonly ModConfigurationKey<float> EyeWideMultiplier =
new("quest_pro_eye_wide_multiplier",
"Multiplier to apply to eye wideness. Can be updated at runtime. Useful for multiplying the amount your eyes can widen by.",
() => 1.0f);
[AutoRegisterConfigKey]
private static readonly ModConfigurationKey<float> EyeMovementMultiplier =
new("quest_pro_eye_movement_multiplier",
"Multiplier to adjust the movement range of the user's eyes. Can be updated at runtime.", () => 1.0f);
[AutoRegisterConfigKey]
private static readonly ModConfigurationKey<float> EyeExpressionMultiplier =
new("quest_pro_eye_expression_multiplier",
"Multiplier to adjust the range of the user's eye expressions. Can be updated at runtime.", () => 1.0f);
private static ModConfiguration _config;
public override string Name => "VDFaceTracking";
public override string Author => AUTHORS_CONSTANT;
public override string Version => VERSION_CONSTANT;
public static VDProxy proxy;
public static float EyeOpenExponent = 1.0f;
public static float EyeWideMult = 1.0f;
public static float EyeMoveMult = 1.0f;
public static float EyeExpressionMult = 1.0f;
public override void OnEngineInit()
{
_config = GetConfiguration();
_config.OnThisConfigurationChanged += OnConfigurationChanged;
Engine.Current.RunPostInit(() =>
{
proxy = new VDProxy();
if (!proxy.Initialize()) { return; }
Engine.Current.InputInterface.RegisterInputDriver(proxy);
Engine.Current.OnShutdown += () => proxy.Teardown();
});
}
private void OnConfigurationChanged(ConfigurationChangedEvent @event)
{
if (@event.Key == EyeOpennessExponent)
{
if (@event.Config.TryGetValue(EyeOpennessExponent, out var openExp))
{
EyeOpenExponent = openExp;
}
}
if (@event.Key == EyeWideMultiplier)
{
if (@event.Config.TryGetValue(EyeWideMultiplier, out var wideMulti))
{
EyeWideMult = wideMulti;
}
}
if (@event.Key == EyeMovementMultiplier)
{
if (@event.Config.TryGetValue(EyeMovementMultiplier, out var moveMulti))
{
EyeMoveMult = moveMulti;
}
}
if (@event.Key == EyeExpressionMultiplier)
{
if (@event.Config.TryGetValue(EyeExpressionMultiplier, out var eyeExpressionMulti))
{
EyeExpressionMult = eyeExpressionMulti;
}
}
}
}
}