summaryrefslogtreecommitdiffstats
path: root/GUI
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2023-02-02 01:02:03 -0800
committeryum <yum.food.vr@gmail.com>2023-02-13 14:36:20 -0800
commit7c6894614dcc3ebc5d4c8839b64f4da761b5ccf0 (patch)
tree6232b86b09190fd162aeb67229da359971b2e517 /GUI
parent2fc3b1b978b6e24814e9de7200865b912108bd34 (diff)
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
Diffstat (limited to 'GUI')
-rw-r--r--GUI/GUI/GUI/PythonWrapper.cpp34
-rw-r--r--GUI/package.ps11
2 files changed, 35 insertions, 0 deletions
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<void(wxProcess* proc, int ret)>&& 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";
@@ -263,6 +269,34 @@ bool PythonWrapper::GenerateAnimator(
}
}
{
+ 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