Two flags were added to OpenSeeVRMDriver to allow reinitialization of different parts.
This commit is contained in:
parent
2c08712aef
commit
626ce2a1ae
1 changed files with 13 additions and 5 deletions
|
|
@ -26,6 +26,8 @@ public class OpenSeeVRMDriver : MonoBehaviour {
|
||||||
new OpenSeeVRMExpression("angry", BlendShapePreset.Angry, 1f, 1f, true, true),
|
new OpenSeeVRMExpression("angry", BlendShapePreset.Angry, 1f, 1f, true, true),
|
||||||
new OpenSeeVRMExpression("sorrow", BlendShapePreset.Sorrow, 1f, 1f, true, true)
|
new OpenSeeVRMExpression("sorrow", BlendShapePreset.Sorrow, 1f, 1f, true, true)
|
||||||
};
|
};
|
||||||
|
[Tooltip("The expression configuration is initialized on startup. If it is changed and needs to be reinitialized, this can be triggered by using this flag or calling InitExpressionMap. This flag is reset to false afterwards.")]
|
||||||
|
public bool reloadExpressions = false;
|
||||||
[Header("Lip sync settings")]
|
[Header("Lip sync settings")]
|
||||||
[Tooltip("This allows you to select the OVRLipSync provider.")]
|
[Tooltip("This allows you to select the OVRLipSync provider.")]
|
||||||
public OVRLipSync.ContextProviders provider = OVRLipSync.ContextProviders.Enhanced;
|
public OVRLipSync.ContextProviders provider = OVRLipSync.ContextProviders.Enhanced;
|
||||||
|
|
@ -35,8 +37,8 @@ public class OpenSeeVRMDriver : MonoBehaviour {
|
||||||
public AudioSource audioSource = null;
|
public AudioSource audioSource = null;
|
||||||
[Tooltip("This is the microphone audio will be captured from. A list can be retrieved from Microphone.devices.")]
|
[Tooltip("This is the microphone audio will be captured from. A list can be retrieved from Microphone.devices.")]
|
||||||
public string mic = null;
|
public string mic = null;
|
||||||
[Tooltip("When enabled, the lip sync function will start right away.")]
|
[Tooltip("When enabled, the lip sync function will be initialized or reinitialized in the next Update or FixedUpdate call, according to the fixedUpdate flag. This flag is reset to false afterwards. It is also possible to call InitializeLipSync instead.")]
|
||||||
public bool autoStartLipSync = false;
|
public bool initializeLipSync = false;
|
||||||
[Range(1, 100)]
|
[Range(1, 100)]
|
||||||
[Tooltip("This sets the viseme smoothing in a range from 1 to 100, where 1 means no smoothing and values above 90 mean pretty much no visemes.")]
|
[Tooltip("This sets the viseme smoothing in a range from 1 to 100, where 1 means no smoothing and values above 90 mean pretty much no visemes.")]
|
||||||
public int smoothAmount = 50;
|
public int smoothAmount = 50;
|
||||||
|
|
@ -154,7 +156,7 @@ public class OpenSeeVRMDriver : MonoBehaviour {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitExpressionMap() {
|
public void InitExpressionMap() {
|
||||||
expressionMap = new Dictionary<string, OpenSeeVRMExpression>();
|
expressionMap = new Dictionary<string, OpenSeeVRMExpression>();
|
||||||
foreach (var expression in expressions) {
|
foreach (var expression in expressions) {
|
||||||
expression.blendShapeKey = new BlendShapeKey(expression.blendShapePreset);
|
expression.blendShapeKey = new BlendShapeKey(expression.blendShapePreset);
|
||||||
|
|
@ -163,6 +165,10 @@ public class OpenSeeVRMDriver : MonoBehaviour {
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateExpression() {
|
void UpdateExpression() {
|
||||||
|
if (reloadExpressions) {
|
||||||
|
InitExpressionMap();
|
||||||
|
reloadExpressions = false;
|
||||||
|
}
|
||||||
if (vrmBlendShapeProxy == null) {
|
if (vrmBlendShapeProxy == null) {
|
||||||
currentExpression = null;
|
currentExpression = null;
|
||||||
return;
|
return;
|
||||||
|
|
@ -399,11 +405,13 @@ public class OpenSeeVRMDriver : MonoBehaviour {
|
||||||
|
|
||||||
void Start() {
|
void Start() {
|
||||||
InitExpressionMap();
|
InitExpressionMap();
|
||||||
if (autoStartLipSync)
|
|
||||||
InitializeLipSync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunUpdates() {
|
void RunUpdates() {
|
||||||
|
if (initializeLipSync) {
|
||||||
|
InitializeLipSync();
|
||||||
|
initializeLipSync = false;
|
||||||
|
}
|
||||||
UpdateExpression();
|
UpdateExpression();
|
||||||
BlinkEyes();
|
BlinkEyes();
|
||||||
ReadAudio();
|
ReadAudio();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue