Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions Content.Client/Lobby/UI/HumanoidProfileEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,6 @@ SPDX-License-Identifier: AGPL-3.0-or-later
<Button Name="BarkVoicePlayButton" Text="{Loc 'humanoid-profile-editor-voice-play'}" MaxWidth="80" />
</BoxContainer>
<!-- Corvax-Frontier-Barks-End -->
<!-- Art-TTS End -->
<CheckBox Name="ToggleTTS" Text="{Loc 'humanoid-profile-editor-tts-enable'}" HorizontalAlignment="Right" Margin="0 8 0 0"/>
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-voice-label'}"/>
<Control HorizontalExpand="True"/>
<OptionButton Name="VoiceButton"
HorizontalAlignment="Right"/>
<Button Name="VoicePlayButton"
Text="▶"
MaxWidth="80"/>
</BoxContainer>
<!-- Art-TTS End -->
</BoxContainer>
<!-- Skin -->
<BoxContainer Margin="10" HorizontalExpand="True" Orientation="Vertical">
Expand Down
74 changes: 56 additions & 18 deletions Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
using Content.Client._Arcane.ERP.OrgansAppearance;
using Content.Client._Arcane.ERP.Preferences;
using Content.Shared._Arcane.ERP.Preferences;
using Content.Client._Art.TTS;
using Content.Shared._Art.TTS;

namespace Content.Client.Lobby.UI
{
[GenerateTypedNameReferences]
Expand Down Expand Up @@ -98,6 +101,7 @@ public sealed partial class HumanoidProfileEditor : BoxContainer

// One at a time.
private LoadoutWindow? _loadoutWindow;
private TTSTab? _ttsTab; // Art

private bool _exporting;
private bool _imaging;
Expand Down Expand Up @@ -242,8 +246,6 @@ public HumanoidProfileEditor(

#endregion Sex

InitializeVoice(); // Art-TTS

#region Age

AgeEdit.OnTextChanged += args =>
Expand Down Expand Up @@ -282,15 +284,6 @@ public HumanoidProfileEditor(

#endregion

// Arcane-start
_cfgManager.OnValueChanged(ACCVars.UseTTS, OnUseTTSChanged, true);

ToggleTTS.OnPressed += _ =>
{
_cfgManager.SetCVar(ACCVars.UseTTS, ToggleTTS.Pressed);
};
// Arcane-end

RefreshSpecies();

SpeciesButton.OnItemSelected += args =>
Expand Down Expand Up @@ -600,6 +593,8 @@ public HumanoidProfileEditor(

RefreshFlavorText();

RefreshVoiceTab(); // Art

#region Dummy

SpriteRotateLeft.OnPressed += _ =>
Expand Down Expand Up @@ -985,6 +980,56 @@ private void OnNsfwTagsFlavorTextChange(string content)
}
// Orion-End

// Art-TTS-Start
#region Voice

private void RefreshVoiceTab()
{
if (!_cfgManager.GetCVar(ACCVars.UseTTS))
return;

_ttsTab = new TTSTab();
var children = new List<Control>();
foreach (var child in TabContainer.Children)
children.Add(child);

TabContainer.RemoveAllChildren();

for (int i = 0; i < children.Count; i++)
{
if (i == 1) // Set the tab to the 2nd place.
{
TabContainer.AddChild(_ttsTab);
}
TabContainer.AddChild(children[i]);
}

TabContainer.SetTabTitle(1, Loc.GetString("humanoid-profile-editor-voice-tab"));

_ttsTab.OnVoiceSelected += voiceId =>
{
SetVoice(voiceId);
_ttsTab.SetSelectedVoice(voiceId);
};

_ttsTab.OnPreviewRequested += voiceId =>
{
_entManager.System<TTSSystem>().RequestGlobalTTS(VoiceRequestType.Preview, voiceId);
};
}

private void UpdateTTSVoicesControls()
{
if (Profile is null || _ttsTab is null)
return;

_ttsTab.UpdateControls(Profile, Profile.Sex);
_ttsTab.SetSelectedVoice(Profile.Voice);
}

#endregion
// Art-TTS-End

/// <summary>
/// Refreshes traits selector
/// </summary>
Expand Down Expand Up @@ -2486,12 +2531,5 @@ private static void SetFlavorPreviewMarkup(RichTextLabel label, string content)
label.SetMessage(FormattedMessage.FromMarkupPermissive(safeContent), SafeMarkupTags.Basic);
}
// Orion-End

// Arcane-start
private void OnUseTTSChanged(bool value)
{
ToggleTTS.Pressed = value;
}
// Arcane-end
}
}
67 changes: 0 additions & 67 deletions Content.Client/_Art/TTS/HumanoidProfileEditor.TTS.cs

This file was deleted.

2 changes: 2 additions & 0 deletions Content.Client/_Art/TTS/TTSSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ private void OnPlayTTS(PlayTTSEvent ev)

if (ev.SourceUid != null)
{
if (!TryGetEntity(ev.SourceUid.Value, out _))
return;
var sourceUid = GetEntity(ev.SourceUid.Value);
if (sourceUid.IsValid())
_audio.PlayEntity(audioResource.AudioStream, sourceUid, null, audioParams);
Expand Down
19 changes: 19 additions & 0 deletions Content.Client/_Art/TTS/TTSTab.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Control xmlns="https://spacestation14.io">
<BoxContainer Orientation="Vertical" HorizontalExpand="True">
<BoxContainer Orientation="Horizontal" HorizontalExpand="True" Margin="5">
<LineEdit Name="SearchEdit" MinWidth="600" PlaceHolder="{Loc 'humanoid-profile-editor-voice-placeholder'}"/>
<Label Name="ResultsLabel" MinWidth="100" HorizontalExpand="True" HorizontalAlignment="Right"/>
</BoxContainer>

<BoxContainer Orientation="Horizontal" HorizontalExpand="True" Margin="0 5 0 20">
<Button Name="MaleButton" ToggleMode="True" Text="{Loc 'humanoid-profile-editor-voice-sex-male'}"
StyleClasses="OpenRight" HorizontalExpand="True"/>
<Button Name="FemaleButton" ToggleMode="True" Text="{Loc 'humanoid-profile-editor-voice-sex-female'}"
StyleClasses="OpenLeft" HorizontalExpand="True"/>
</BoxContainer>

<ScrollContainer VerticalExpand="True" Margin="5">
<GridContainer Name="VoicesGrid" Columns="3" HorizontalExpand="True"/>
</ScrollContainer>
</BoxContainer>
</Control>
Loading
Loading