From c27d3fdcdf3b13dbe0df7a0a153cb53673d1b6c2 Mon Sep 17 00:00:00 2001 From: yum Date: Tue, 30 Jul 2024 13:38:24 -0700 Subject: Support as few as 1 char per sync in custom chatbox --- GUI/GUI/GUI/Frame.cpp | 10 +++++++--- Scripts/generate_utils.py | 3 +-- Scripts/libtastt.py | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/GUI/GUI/GUI/Frame.cpp b/GUI/GUI/GUI/Frame.cpp index e3c1964..77447bc 100644 --- a/GUI/GUI/GUI/Frame.cpp +++ b/GUI/GUI/GUI/Frame.cpp @@ -484,6 +484,10 @@ namespace { constexpr int kModelTranslationDefault = 2; // base.en const wxString kCharsPerSync[] = { + "1", + "2", + "3", + "4", "5", "6", "7", @@ -2027,7 +2031,7 @@ void Frame::OnGenerateFX(wxCommandEvent& event) ASSIGN_OR_RETURN_BOOL(int, rows, stoiInRange(transcribe_out_, unity_rows_->GetValue().ToStdString(), "rows", 1, 10)); ASSIGN_OR_RETURN_BOOL(int, cols, stoiInRange(transcribe_out_, unity_cols_->GetValue().ToStdString(), "cols", 1, 120)); ASSIGN_OR_RETURN_BOOL(int, texture_sz, stoiInRange(transcribe_out_, unity_texture_sz_->GetValue().ToStdString(), "texture_sz", 128, 8192)); - ASSIGN_OR_RETURN_BOOL(int, chars_per_sync, stoiInRange(transcribe_out_, kCharsPerSync[chars_per_sync_idx].ToStdString(), "chars_per_sync", 5, 24)); + ASSIGN_OR_RETURN_BOOL(int, chars_per_sync, stoiInRange(transcribe_out_, kCharsPerSync[chars_per_sync_idx].ToStdString(), "chars_per_sync", 1, 24)); ASSIGN_OR_RETURN_BOOL(int, bytes_per_char, stoiInRange(transcribe_out_, kBytesPerChar[bytes_per_char_idx].ToStdString(), "bytes_per_char", 1, 2)); app_c_->assets_path = unity_assets_path.string(); @@ -2383,7 +2387,7 @@ void Frame::OnUnityParamChangeImpl() { if (chars_per_sync_idx == wxNOT_FOUND) { chars_per_sync_idx = kCharsDefault; } - ASSIGN_OR_RETURN_VOID(int, chars_per_sync, stoiInRange(transcribe_out_, kCharsPerSync[chars_per_sync_idx].ToStdString(), "chars_per_sync", 5, 24)); + ASSIGN_OR_RETURN_VOID(int, chars_per_sync, stoiInRange(transcribe_out_, kCharsPerSync[chars_per_sync_idx].ToStdString(), "chars_per_sync", 1, 24)); int bytes_per_char_idx = unity_bytes_per_char_->GetSelection(); if (bytes_per_char_idx == wxNOT_FOUND) { bytes_per_char_idx = kBytesDefault; @@ -2497,7 +2501,7 @@ void Frame::OnAppStart(wxCommandEvent& event) { ASSIGN_OR_RETURN_VOID(int, rows, stoiInRange(transcribe_out_, py_app_rows_->GetValue().ToStdString(), "rows", 1, 10)); ASSIGN_OR_RETURN_VOID(int, cols, stoiInRange(transcribe_out_, py_app_cols_->GetValue().ToStdString(), "cols", 1, 120)); - ASSIGN_OR_RETURN_VOID(int, chars_per_sync, stoiInRange(transcribe_out_, kCharsPerSync[chars_per_sync_idx].ToStdString(), "chars_per_sync", 5, 24)); + ASSIGN_OR_RETURN_VOID(int, chars_per_sync, stoiInRange(transcribe_out_, kCharsPerSync[chars_per_sync_idx].ToStdString(), "chars_per_sync", 1, 24)); ASSIGN_OR_RETURN_VOID(int, bytes_per_char, stoiInRange(transcribe_out_, kBytesPerChar[bytes_per_char_idx].ToStdString(), "bytes_per_char", 1, 2)); ASSIGN_OR_RETURN_VOID(int, gpu_idx, stoiInRange(transcribe_out_, py_app_gpu_idx_->GetValue().ToStdString(), "gpu_idx", 0, 10)); ASSIGN_OR_RETURN_VOID(int, min_silence_duration_ms, stoiInRange(transcribe_out_, py_app_min_silence_duration_ms_->GetValue().ToStdString(), "min_silence_duration_ms", 50, 5000)); diff --git a/Scripts/generate_utils.py b/Scripts/generate_utils.py index 7d231f9..ccc92fc 100644 --- a/Scripts/generate_utils.py +++ b/Scripts/generate_utils.py @@ -26,8 +26,7 @@ class Config(): def layerNeedsParity(self, which_layer): num_cells = self.BOARD_ROWS * self.BOARD_COLS layers_in_last_region = num_cells % self.CHARS_PER_SYNC - float_result = num_cells / self.CHARS_PER_SYNC - if which_layer >= layers_in_last_region: + if layers_in_last_region > 0 and which_layer >= layers_in_last_region: return True else: return False diff --git a/Scripts/libtastt.py b/Scripts/libtastt.py index 4b4dda9..81baa8b 100644 --- a/Scripts/libtastt.py +++ b/Scripts/libtastt.py @@ -761,7 +761,7 @@ def generateFXLayer(which_layer: int, anim: libunity.UnityAnimator, layer: dummy_param = generate_utils.getDummyParam() anim.addTransitionBooleanCondition(state, home_state_transition, dummy_param, False) - + if generate_utils.config.layerNeedsParity(which_layer): # There may be layers which never write to the text box. In this case, # when those layers are turned on to write to that last region, they -- cgit v1.2.3