mirror of
https://github.com/open-goal/jak-project
synced 2026-06-17 15:17:27 -04:00
c87db7e670
The main thing that was done here was to slightly modify the new subtitle-v2 JSON schema to be more similar to the existing one so that it can properly be used in Crowdin. Draft while I double-check the diff myself Along the way the following was also done (among other things): - got rid of as much duplication as was feasible in the serialization and editor code - separated the text serialization code from the subtitle code for better organization - simplified "base language" in the editor. The new subtitle format has built-in support for defining a base language so the editor doesn't have to be used as a crutch. Also, cutscenes only defined in the base come first in the list now as that is generally the order you'd work from (what you havn't done first) - got rid of the GOAL subtitle format code completely - switched jak 2 text translations to the JSON format as well - found a few mistakes in the jak 1 subtitle metadata files - added a couple minor features to the editor - consolidate and removed complexity, ie. recently all jak 1 hints were forced to the `named` type, so I got rid of the two types as there isn't a need anymore. - removed subtitle editor groups for jak 1, the only reason they existed was so when the GOAL file was manually written out they were somewhat organized, the editor has a decent filter control, there's no need for them. - removed the GOAL -> JSON python script helper, it's been a month or so and no one has come forward with existing translations that they need help with migrating. If they do need it, the script will be in the git history. I did some reasonably through testing in Jak1/Jak 2 and everything seemed to work. But more testing is always a good idea. --------- Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>
78 lines
2.5 KiB
C++
78 lines
2.5 KiB
C++
#pragma once
|
|
|
|
#include <optional>
|
|
|
|
#include "subtitle_editor_db.h"
|
|
#include "subtitle_editor_repl_client.h"
|
|
|
|
#include "common/serialization/subtitles/subtitles_v2.h"
|
|
|
|
#include "third-party/imgui/imgui.h"
|
|
|
|
class SubtitleEditor {
|
|
public:
|
|
SubtitleEditor();
|
|
void draw_window();
|
|
|
|
private:
|
|
bool is_v1_format();
|
|
|
|
void draw_edit_options();
|
|
void draw_repl_options();
|
|
|
|
void draw_speaker_options();
|
|
|
|
void draw_scene_section_header(const bool non_cutscenes);
|
|
void draw_scene_node(const bool base_cutscenes,
|
|
const std::string& scene_name,
|
|
GameSubtitleSceneInfo& scene_info,
|
|
std::unordered_set<std::string>& scenes_to_delete);
|
|
void draw_all_cutscenes(bool base_cutscenes = false);
|
|
void draw_all_non_cutscenes(bool base_cutscenes = false);
|
|
std::string subtitle_line_summary(const SubtitleLine& line,
|
|
const SubtitleLineMetadata& line_meta,
|
|
const std::shared_ptr<GameSubtitleBank> bank);
|
|
void draw_subtitle_options(GameSubtitleSceneInfo& scene, bool current_scene = false);
|
|
void draw_new_scene_line_form();
|
|
|
|
bool m_db_loaded = false;
|
|
bool m_db_failed_to_load = false;
|
|
GameSubtitleDB m_subtitle_db;
|
|
SubtitleEditorReplClient m_repl;
|
|
GameSubtitleDB::SubtitleFormat m_subtitle_version;
|
|
|
|
// Jak 1 Specifics
|
|
Jak1SubtitleEditorDB m_jak1_editor_db;
|
|
|
|
// GUI Controls
|
|
int m_current_language = 0;
|
|
bool m_truncate_summaries = false;
|
|
std::string m_filter_cutscenes;
|
|
std::string m_filter_non_cutscenes;
|
|
GameSubtitleSceneInfo* m_current_scene = nullptr;
|
|
|
|
// GUI Styling
|
|
ImVec4 m_normal_text_color = ImVec4(1.0f, 0.0f, 1.0f, 1.0f);
|
|
int m_selected_text_color = IM_COL32(89, 227, 225, 255);
|
|
ImVec4 m_success_text_color = ImVec4(0.0f, 1.0f, 0.0f, 1.0f);
|
|
ImVec4 m_error_text_color = ImVec4(1.0f, 0.0f, 0.0f, 1.0f);
|
|
ImVec4 m_disabled_text_color = ImVec4(1.0f, 1.0f, 1.0f, 0.7f);
|
|
ImVec4 m_warning_color = ImVec4(0.619f, 0.443f, 0.0f, 1.0f);
|
|
int m_offscreen_text_color = IM_COL32(240, 242, 102, 255);
|
|
|
|
// State
|
|
int m_current_scene_frames[2] = {0, 0};
|
|
std::string m_current_scene_speaker = "";
|
|
std::string m_current_scene_text = "";
|
|
bool m_current_scene_offscreen = false;
|
|
bool m_current_scene_merge = false;
|
|
|
|
std::string m_new_scene_name = "";
|
|
std::string m_new_scene_id = "0";
|
|
|
|
std::string m_filter_placeholder = "Filter List...";
|
|
std::optional<bool> m_files_saved_successfully = {};
|
|
|
|
bool is_scene_in_current_lang(const std::string& scene_name);
|
|
};
|