talking expression: random phoneme selection and forced talking

This commit is contained in:
Turánszki János
2023-04-07 14:06:05 +02:00
parent e5783a98db
commit daae2dd380
9 changed files with 138 additions and 28 deletions
+16 -1
View File
@@ -9,7 +9,7 @@ void ExpressionWindow::Create(EditorComponent* _editor)
editor = _editor;
wi::gui::Window::Create(ICON_EXPRESSION " Expression", wi::gui::Window::WindowControls::COLLAPSE | wi::gui::Window::WindowControls::CLOSE);
SetSize(XMFLOAT2(670, 550));
SetSize(XMFLOAT2(670, 580));
closeButton.SetTooltip("Delete ExpressionComponent");
OnClose([=](wi::gui::EventArgs args) {
@@ -36,6 +36,19 @@ void ExpressionWindow::Create(EditorComponent* _editor)
infoLabel.SetText("Tip: If you also attach a Sound component to this entity, the mouth expression (if available) will be animated based on the sound playing.");
AddWidget(&infoLabel);
talkCheckBox.Create("Force Talking: ");
talkCheckBox.SetTooltip("Force continuous talking animation, even if no voice is playing");
talkCheckBox.SetSize(XMFLOAT2(hei, hei));
talkCheckBox.OnClick([=](wi::gui::EventArgs args) {
wi::scene::Scene& scene = editor->GetCurrentScene();
ExpressionComponent* expression_mastering = scene.expressions.GetComponent(entity);
if (expression_mastering == nullptr)
return;
expression_mastering->SetForceTalkingEnabled(args.bValue);
});
AddWidget(&talkCheckBox);
blinkFrequencySlider.Create(0, 1, 0, 1000, "Blinks: ");
blinkFrequencySlider.SetTooltip("Specifies the number of blinks per second.");
blinkFrequencySlider.SetSize(XMFLOAT2(wid, hei));
@@ -274,6 +287,7 @@ void ExpressionWindow::SetEntity(Entity entity)
blinkCountSlider.SetValue(expression_mastering->blink_count);
lookFrequencySlider.SetValue(expression_mastering->look_frequency);
lookLengthSlider.SetValue(expression_mastering->look_length);
talkCheckBox.SetCheck(expression_mastering->IsForceTalkingEnabled());
expressionList.ClearItems();
for (const ExpressionComponent::Expression& expression : expression_mastering->expressions)
@@ -321,6 +335,7 @@ void ExpressionWindow::ResizeLayout()
};
add_fullwidth(infoLabel);
add_right(talkCheckBox);
add(blinkFrequencySlider);
add(blinkLengthSlider);
add(blinkCountSlider);