From 7c6894614dcc3ebc5d4c8839b64f4da761b5ccf0 Mon Sep 17 00:00:00 2001 From: yum Date: Thu, 2 Feb 2023 01:02:03 -0800 Subject: Begin work adding emotes Done: * Users can add images to Fonts/Emotes/ * The basename of that image ('clueless.png' becomes 'clueless') is the keyword to make the image show up in game. * Fix a bug in the shader where letters on the 2nd texture and later would have UV outside of [0.0, 1.0] Not yet implemented: * transcribed words are encoded using emotes mapping --- GUI/GUI/GUI/PythonWrapper.cpp | 34 ++++++++++++++++++++++++++++++++++ GUI/package.ps1 | 1 + 2 files changed, 35 insertions(+) (limited to 'GUI') diff --git a/GUI/GUI/GUI/PythonWrapper.cpp b/GUI/GUI/GUI/PythonWrapper.cpp index c2515e8..72897b7 100644 --- a/GUI/GUI/GUI/PythonWrapper.cpp +++ b/GUI/GUI/GUI/PythonWrapper.cpp @@ -11,6 +11,10 @@ using ::Logging::Log; +namespace { + constexpr const char kEmotesPickle[] = "Resources/Fonts/Bitmaps/emotes.map"; +} // namespace + class PythonProcess : public wxProcess { public: PythonProcess(std::function&& exit_callback) : exit_cb_(exit_callback) { @@ -185,6 +189,7 @@ wxProcess* PythonWrapper::StartApp( "--window_duration_s", config.window_duration, "--cpu", config.use_cpu ? "1" : "0", "--use_builtin", config.use_builtin ? "1" : "0", + "--emotes_pickle", kEmotesPickle, }, std::move(exit_callback)); } @@ -199,6 +204,7 @@ bool PythonWrapper::GenerateAnimator( // Python script locations std::string libunity_path = "Resources/Scripts/libunity.py"; std::string libtastt_path = "Resources/Scripts/libtastt.py"; + std::string generate_emotes_path = "Resources/Scripts/emotes_v2.py"; std::string generate_params_path = "Resources/Scripts/generate_params.py"; std::string generate_menu_path = "Resources/Scripts/generate_menu.py"; std::string generate_shader_path = "Resources/Scripts/generate_shader.py"; @@ -262,6 +268,34 @@ bool PythonWrapper::GenerateAnimator( return false; } } + { + Log(out, "Generating emotes... "); + + std::string py_stdout, py_stderr; + if (InvokeWithArgs({ generate_emotes_path, + "Resources/Fonts/Emotes/", + /*board_aspect_ratio=*/ std::to_string(6), + /*texture_aspect_ratio=*/ std::to_string(2), + "Resources/Fonts/Bitmaps/emotes.png", + kEmotesPickle + }, + &py_stdout, &py_stderr)) { + Log(out, "success!\n"); + Log(out, py_stdout.c_str()); + if (!py_stdout.empty()) { + Log(out, "\n"); + } + Log(out, py_stderr.c_str()); + if (!py_stderr.empty()) { + Log(out, "\n"); + } + } + else { + wxLogError("Failed to generate emotes: %s", py_stderr.c_str()); + Log(out, "failed!\n"); + return false; + } + } { Log(out, "Creating {}\n", tastt_generated_dir_path.string()); std::filesystem::create_directories(tastt_generated_dir_path); diff --git a/GUI/package.ps1 b/GUI/package.ps1 index 96e641e..74fd7c7 100644 --- a/GUI/package.ps1 +++ b/GUI/package.ps1 @@ -62,6 +62,7 @@ mkdir $install_dir/Resources > $null cp -Recurse ../Animations TaSTT/Resources/Animations mkdir TaSTT/Resources/Fonts cp -Recurse ../Fonts/Bitmaps TaSTT/Resources/Fonts/Bitmaps +cp -Recurse ../Fonts/Emotes TaSTT/Resources/Fonts/Emotes cp -Recurse ../Images TaSTT/Resources/Images cp -Recurse Python TaSTT/Resources/Python cp -Recurse PortableGit TaSTT/Resources/PortableGit -- cgit v1.2.3