diff options
| author | yum <yum.food.vr@gmail.com> | 2023-02-12 13:21:03 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2023-02-12 13:22:18 -0800 |
| commit | 2fc3b1b978b6e24814e9de7200865b912108bd34 (patch) | |
| tree | 66722a3524131a84992002846c890acc5e6d9d81 | |
| parent | c218e2a1957520fe6e6a200e51d44aeaec93a3d3 (diff) | |
Add checkbox to clear OSC configsv0.6.0
VRC SDK does not correctly regenerate OSC configs when adding
parameters to an avatar, causing the custom text box to be
non-functional for new users. This checkbox clears configs,
forcing the SDK to fully regenerate them on upload.
* Make start/stop transcription buttons bigger so they're easier to
click in VR.
* Fix a couple tooltip messages.
* Tooltips take much longer to disappear.
| -rw-r--r-- | GUI/GUI/GUI/Config.cpp | 5 | ||||
| -rw-r--r-- | GUI/GUI/GUI/Config.h | 1 | ||||
| -rw-r--r-- | GUI/GUI/GUI/Frame.cpp | 33 | ||||
| -rw-r--r-- | GUI/GUI/GUI/Frame.h | 1 | ||||
| -rw-r--r-- | GUI/GUI/GUI/PythonWrapper.cpp | 23 |
5 files changed, 56 insertions, 7 deletions
diff --git a/GUI/GUI/GUI/Config.cpp b/GUI/GUI/GUI/Config.cpp index 3994e62..874a56c 100644 --- a/GUI/GUI/GUI/Config.cpp +++ b/GUI/GUI/GUI/Config.cpp @@ -141,7 +141,8 @@ UnityAppConfig::UnityAppConfig() chars_per_sync(20),
bytes_per_char(1),
rows(4),
- cols(48)
+ cols(48),
+ clear_osc(false)
{}
bool UnityAppConfig::Serialize(const std::filesystem::path& path) {
@@ -156,6 +157,7 @@ bool UnityAppConfig::Serialize(const std::filesystem::path& path) { root["bytes_per_char"] << bytes_per_char;
root["rows"] << rows;
root["cols"] << cols;
+ root["clear_osc"] << clear_osc;
return Config::Serialize(path, &t);
}
@@ -179,6 +181,7 @@ bool UnityAppConfig::Deserialize(const std::filesystem::path& path) { root.get_if("bytes_per_char", &c.bytes_per_char);
root.get_if("rows", &c.rows);
root.get_if("cols", &c.cols);
+ root.get_if("clear_osc", &c.clear_osc);
root.get_if("assets_path", &c.assets_path);
root.get_if("fx_path", &c.fx_path);
diff --git a/GUI/GUI/GUI/Config.h b/GUI/GUI/GUI/Config.h index 511ba01..cbf9713 100644 --- a/GUI/GUI/GUI/Config.h +++ b/GUI/GUI/GUI/Config.h @@ -72,4 +72,5 @@ public: int bytes_per_char;
int rows;
int cols;
+ bool clear_osc;
};
diff --git a/GUI/GUI/GUI/Frame.cpp b/GUI/GUI/GUI/Frame.cpp index 75d9e82..53e658b 100644 --- a/GUI/GUI/GUI/Frame.cpp +++ b/GUI/GUI/GUI/Frame.cpp @@ -58,6 +58,7 @@ namespace { ID_UNITY_BYTES_PER_CHAR,
ID_UNITY_ROWS,
ID_UNITY_COLS,
+ ID_UNITY_CLEAR_OSC,
ID_DEBUG_PANEL,
ID_DEBUG_OUT,
ID_DEBUG_CONFIG_PANEL,
@@ -480,8 +481,10 @@ Frame::Frame() );
py_app_use_builtin_ = py_app_use_builtin;
- auto* py_app_start_button = new wxButton(py_config_panel, ID_PY_APP_START_BUTTON, "Begin transcribing");
- auto* py_app_stop_button = new wxButton(py_config_panel, ID_PY_APP_STOP_BUTTON, "Stop transcribing");
+ // Hack: Add newlines before and after the button text to make
+ // the buttons bigger, and easier to click from inside VR.
+ auto* py_app_start_button = new wxButton(py_config_panel, ID_PY_APP_START_BUTTON, "\nBegin transcribing\n\n");
+ auto* py_app_stop_button = new wxButton(py_config_panel, ID_PY_APP_STOP_BUTTON, "\nStop transcribing\n\n");
auto* sizer = new wxBoxSizer(wxVERTICAL);
py_config_panel->SetSizer(sizer);
@@ -525,7 +528,7 @@ Frame::Frame() unity_assets_file_picker->SetToolTip(
"The path to the Assets folder for your avatar's "
"Unity project. Example:\n"
- "py_c:\\Users\\yum\\unity\\kumadan\\Assets");
+ "C:\\Users\\yum\\unity\\kumadan\\Assets");
unity_assets_file_picker_ = unity_assets_file_picker;
auto* unity_animator_file_picker = new wxFilePickerCtrl(
@@ -540,7 +543,7 @@ Frame::Frame() unity_animator_file_picker->SetToolTip(
"The path to your avatar's FX layer. You can find "
"this in your avatar descriptor. Example:\n"
- "py_c:\\Users\\yum\\unity\\kumadan\\Assets\\kumadan_fx.controller");
+ "C:\\Users\\yum\\unity\\kumadan\\Assets\\kumadan_fx.controller");
unity_animator_file_picker_ = unity_animator_file_picker;
auto* unity_parameters_file_picker = new wxFilePickerCtrl(
@@ -555,7 +558,7 @@ Frame::Frame() unity_parameters_file_picker->SetToolTip(
"The path to your avatar's parameters. You can find "
"this in your avatar descriptor. Example:\n"
- "py_c:\\Users\\yum\\unity\\kumadan\\Assets\\kumadan_parameters.asset");
+ "C:\\Users\\yum\\unity\\kumadan\\Assets\\kumadan_parameters.asset");
unity_parameters_file_picker_ = unity_parameters_file_picker;
auto* unity_menu_file_picker = new wxFilePickerCtrl(
@@ -570,7 +573,7 @@ Frame::Frame() unity_menu_file_picker->SetToolTip(
"The path to your avatar's menu. You can find "
"this in your avatar descriptor. Example:\n"
- "py_c:\\Users\\yum\\unity\\kumadan\\Assets\\kumadan_menu.asset");
+ "C:\\Users\\yum\\unity\\kumadan\\Assets\\kumadan_menu.asset");
unity_menu_file_picker_ = unity_menu_file_picker;
auto* unity_animator_generated_dir = new wxTextCtrl(unity_config_panel_pairs,
@@ -700,12 +703,26 @@ Frame::Frame() sizer->Add(unity_cols, /*proportion=*/0, /*flags=*/wxEXPAND);
}
+ auto* clear_osc = new wxCheckBox(unity_config_panel,
+ ID_UNITY_CLEAR_OSC, "Clear OSC configs");
+ clear_osc->SetValue(unity_c.clear_osc);
+ clear_osc->SetToolTip(
+ "If checked, VRChat's OSC configs will be cleared. "
+ "VRC SDK has a bug where parameters added to an "
+ "existing avatar are not added to the avatar's OSC "
+ "config. By clearing configs, VRC SDK is forced to "
+ "regenerate them. The regenerated config will include "
+ "the STT parameters. Check this if you are updating "
+ "an existing avatar.");
+ unity_clear_osc_ = clear_osc;
+
auto* unity_button_gen_fx = new wxButton(unity_config_panel, ID_UNITY_BUTTON_GEN_ANIMATOR, "Generate avatar assets");
unity_button_gen_fx->SetWindowStyleFlag(wxBU_EXACTFIT);
auto* sizer = new wxBoxSizer(wxVERTICAL);
unity_config_panel->SetSizer(sizer);
sizer->Add(unity_config_panel_pairs);
+ sizer->Add(clear_osc);
sizer->Add(unity_button_gen_fx, /*proportion=*/0, /*flags=*/wxEXPAND);
}
@@ -810,6 +827,9 @@ Frame::Frame() wxImage::AddHandler(&png_handler_);
LoadAndSetIcons();
+ // Make tooltips show up for longer.
+ wxToolTip::SetAutoPop(/*milliseconds=*/ 10 * 1000);
+
Resize();
OnUnityParamChangeImpl();
@@ -976,6 +996,7 @@ void Frame::OnGenerateFX(wxCommandEvent& event) unity_c.chars_per_sync = chars_per_sync;
unity_c.rows = rows;
unity_c.cols = cols;
+ unity_c.clear_osc = unity_clear_osc_->GetValue();
unity_c.Serialize(UnityAppConfig::kConfigPath);
std::string out;
diff --git a/GUI/GUI/GUI/Frame.h b/GUI/GUI/GUI/Frame.h index d179728..3ec08ff 100644 --- a/GUI/GUI/GUI/Frame.h +++ b/GUI/GUI/GUI/Frame.h @@ -55,6 +55,7 @@ private: wxCheckBox* py_app_enable_local_beep_;
wxCheckBox* py_app_use_cpu_;
wxCheckBox* py_app_use_builtin_;
+ wxCheckBox* unity_clear_osc_;
wxProcess* py_app_;
wxProcess* env_proc_;
diff --git a/GUI/GUI/GUI/PythonWrapper.cpp b/GUI/GUI/GUI/PythonWrapper.cpp index 2bf1a47..c2515e8 100644 --- a/GUI/GUI/GUI/PythonWrapper.cpp +++ b/GUI/GUI/GUI/PythonWrapper.cpp @@ -410,6 +410,29 @@ bool PythonWrapper::GenerateAnimator( return false; } } + if (config.clear_osc) { + std::filesystem::path osc_path = "C:/Users"; + osc_path /= wxGetUserName().ToStdString(); + osc_path /= "AppData/LocalLow/VRChat/vrchat/OSC"; + osc_path = osc_path.lexically_normal(); + Log(out, "OSC configs are stored at {}\n", osc_path.string()); + Log(out, "Clearing OSC configs... "); + + if (std::filesystem::is_directory(osc_path)) { + std::error_code err; + if (std::filesystem::remove_all(osc_path, err)) { + Log(out, "success!\n"); + } + else { + wxLogError("Failed to delete OSC configs: %s", err.message()); + Log(out, "failed!\n"); + } + } + else { + Log(out, "OSC configs do not exist at {}, assuming already " + "cleared!\n", osc_path.string()); + } + } Log(out, "Done!\n"); return true; |
