mirror of
https://gitlab.com/square-game-liberation-front/F.E.I.S.git
synced 2025-02-28 15:30:32 +01:00
Ok it now fucking works but oh god is it ever slow
This commit is contained in:
parent
d4aa0f3532
commit
71bfa5ba42
@ -9,7 +9,6 @@
|
||||
#include <variant>
|
||||
|
||||
#include "linear_view_colors.hpp"
|
||||
#include "linear_view_mode.hpp"
|
||||
#include "marker.hpp"
|
||||
#include "nowide/fstream.hpp"
|
||||
#include "variant_visitor.hpp"
|
||||
|
@ -728,8 +728,8 @@ void EditorState::display_file_properties() {
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::TextUnformatted(
|
||||
"You must define a time selection in the vertical view first !\n"
|
||||
"Open up 'View' > 'Vertical View' then use the Tab key to set the start, then the end"
|
||||
"You must define a time selection in the linear view first !\n"
|
||||
"Open up 'View' > 'Linear View' then use the Tab key to set the start, then the end"
|
||||
);
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
@ -980,10 +980,18 @@ void EditorState::display_linear_view() {
|
||||
if (chart_state) {
|
||||
auto header_height = ImGui::GetFontSize() + ImGui::GetStyle().FramePadding.y * 2.f;
|
||||
ImGui::SetCursorPos({0, header_height});
|
||||
const auto waveform = [&, this]() -> std::optional<waveform::Cache::const_reference_type> {
|
||||
const auto full_path = this->full_audio_path();
|
||||
if (not full_path) {
|
||||
return {};
|
||||
} else {
|
||||
return waveform_cache.get(*full_path);
|
||||
}
|
||||
}();
|
||||
LinearView::DrawArgs draw_args {
|
||||
ImGui::GetWindowDrawList(),
|
||||
*chart_state,
|
||||
waveform_cache.get(song.metadata.audio),
|
||||
waveform,
|
||||
*applicable_timing,
|
||||
current_exact_beats(),
|
||||
beats_at(editable_range.end),
|
||||
@ -1409,6 +1417,14 @@ void EditorState::reload_jacket() {
|
||||
}
|
||||
};
|
||||
|
||||
std::optional<std::filesystem::path> EditorState::full_audio_path() {
|
||||
if (not song_path.has_value() or song.metadata.audio.empty()) {
|
||||
return {};
|
||||
} else {
|
||||
return song_path->parent_path() / song.metadata.audio;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Reloads music from what's indicated in the "music path" field of the song
|
||||
* Resets the music state in case anything fails
|
||||
@ -1416,15 +1432,14 @@ void EditorState::reload_jacket() {
|
||||
*/
|
||||
void EditorState::reload_music() {
|
||||
const auto status_before = get_status();
|
||||
if (not song_path.has_value() or song.metadata.audio.empty()) {
|
||||
const auto absolute_music_path = full_audio_path();
|
||||
if (not absolute_music_path) {
|
||||
clear_music();
|
||||
return;
|
||||
}
|
||||
|
||||
const auto absolute_music_path = song_path->parent_path() / song.metadata.audio;
|
||||
try {
|
||||
music.emplace(std::make_shared<OpenMusic>(absolute_music_path));
|
||||
waveform_cache.async_emplace(song.metadata.audio);
|
||||
music.emplace(std::make_shared<OpenMusic>(*absolute_music_path));
|
||||
waveform_cache.async_emplace(*absolute_music_path);
|
||||
} catch (const std::exception& e) {
|
||||
clear_music();
|
||||
}
|
||||
|
@ -259,6 +259,8 @@ private:
|
||||
TimingOrigin timing_origin();
|
||||
|
||||
std::filesystem::path assets;
|
||||
|
||||
std::optional<std::filesystem::path> full_audio_path();
|
||||
};
|
||||
|
||||
namespace feis {
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "variant_visitor.hpp"
|
||||
|
||||
namespace linear_view {
|
||||
namespace linear_view::mode {
|
||||
Mode load_from_v1_0_0_table(const toml::table& linear_view) {
|
||||
const auto mode_string = linear_view["mode"].value<std::string>();
|
||||
if (not mode_string) {
|
||||
|
@ -13,8 +13,8 @@ namespace linear_view {
|
||||
using Mode = std::variant<mode::Beats, mode::Waveform>;
|
||||
|
||||
namespace mode {
|
||||
linear_view::Mode load_from_v1_0_0_table(const toml::table& linear_view);
|
||||
void dump_as_v1_0_0(const linear_view::Mode& mode, toml::table& linear_view);
|
||||
Mode load_from_v1_0_0_table(const toml::table& linear_view);
|
||||
void dump_as_v1_0_0(const Mode& mode, toml::table& linear_view);
|
||||
}
|
||||
|
||||
const Mode default_mode = mode::Beats{};
|
||||
|
@ -19,6 +19,7 @@ sources += files(
|
||||
'imgui_extras.cpp',
|
||||
'json_decimal_handling.cpp',
|
||||
'linear_view_colors.cpp',
|
||||
'linear_view_mode.cpp',
|
||||
'linear_view_sizes.cpp',
|
||||
'ln_marker.cpp',
|
||||
'long_note_dummy.cpp',
|
||||
|
@ -41,8 +41,8 @@ namespace linear_view {
|
||||
using LaneOrder = std::variant<lane_order::Default, lane_order::Vertical, lane_order::Custom>;
|
||||
|
||||
namespace lane_order {
|
||||
linear_view::LaneOrder load_from_v1_0_0_table(const toml::table& linear_view);
|
||||
void dump_as_v1_0_0(const linear_view::LaneOrder& lane_order, toml::table& linear_view);
|
||||
LaneOrder load_from_v1_0_0_table(const toml::table& linear_view);
|
||||
void dump_as_v1_0_0(const LaneOrder& lane_order, toml::table& linear_view);
|
||||
}
|
||||
|
||||
const LaneOrder default_lane_order = lane_order::Default{};
|
||||
|
@ -42,6 +42,7 @@ void SelectionRectangle::reset() {
|
||||
}
|
||||
|
||||
LinearView::LinearView(std::filesystem::path assets, config::Config& config_) :
|
||||
mode(config_.linear_view.mode),
|
||||
colors(config_.linear_view.colors),
|
||||
sizes(config_.linear_view.sizes),
|
||||
collision_zone(config_.editor.collision_zone),
|
||||
@ -273,13 +274,14 @@ void LinearView::draw_in_waveform_mode(LinearView::DrawArgs& args) {
|
||||
] = args;
|
||||
|
||||
const auto computed_sizes = linear_view::compute_sizes(window_size, sizes);
|
||||
if (
|
||||
not opt_ref_to_an_opt_waveform
|
||||
or not opt_ref_to_an_opt_waveform.value().get()
|
||||
) {
|
||||
if (not opt_ref_to_an_opt_waveform) {
|
||||
feis::CenteredText("Loading ...");
|
||||
return;
|
||||
}
|
||||
if (not opt_ref_to_an_opt_waveform.value().get()) {
|
||||
feis::CenteredText("Error while loading waveform");
|
||||
}
|
||||
|
||||
const auto waveform = opt_ref_to_an_opt_waveform.value().get().value();
|
||||
if (waveform.channels_per_chunk_size.empty()) {
|
||||
feis::CenteredText("No data ???");
|
||||
@ -729,11 +731,11 @@ void LinearView::set_zoom(int newZoom) {
|
||||
}
|
||||
|
||||
void LinearView::display_settings() {
|
||||
if (ImGui::Begin("Vertical View Settings", &shouldDisplaySettings)) {
|
||||
if (ImGui::SliderInt("Zoom##Vertical View Settings", &zoom, -10, 10, "%d")) {
|
||||
if (ImGui::Begin("Linear View Settings", &shouldDisplaySettings)) {
|
||||
if (ImGui::SliderInt("Zoom##Linear View Settings", &zoom, -10, 10, "%d")) {
|
||||
set_zoom(zoom);
|
||||
}
|
||||
if (ImGui::BeginCombo("Mode##Vertical View Settings", mode_name().c_str())) {
|
||||
if (ImGui::BeginCombo("Mode##Linear View Settings", mode_name().c_str())) {
|
||||
if (ImGui::Selectable(
|
||||
"Beats",
|
||||
std::holds_alternative<linear_view::mode::Beats>(mode)
|
||||
@ -748,7 +750,7 @@ void LinearView::display_settings() {
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
if (ImGui::CollapsingHeader("Notes##Vertical View Settings")) {
|
||||
if (ImGui::CollapsingHeader("Notes##Linear View Settings")) {
|
||||
ImGui::Checkbox("Colored Quantization", &use_quantization_colors);
|
||||
if (use_quantization_colors) {
|
||||
for (auto& [quant, color] : quantization_colors.palette) {
|
||||
@ -766,7 +768,7 @@ void LinearView::display_settings() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ImGui::CollapsingHeader("Lanes##Vertical View Settings")) {
|
||||
if (ImGui::CollapsingHeader("Lanes##Linear View Settings")) {
|
||||
if (ImGui::BeginCombo("Order", lane_order_name().c_str())) {
|
||||
if (ImGui::Selectable(
|
||||
"Default",
|
||||
@ -800,8 +802,8 @@ void LinearView::display_settings() {
|
||||
LaneOrderPreview(order.lane_to_button);
|
||||
}
|
||||
}
|
||||
if (ImGui::CollapsingHeader("Colors##Vertical View Settings")) {
|
||||
if (ImGui::Button("Reset##Colors##Vertical View Settings")) {
|
||||
if (ImGui::CollapsingHeader("Colors##Linear View Settings")) {
|
||||
if (ImGui::Button("Reset##Colors##Linear View Settings")) {
|
||||
colors = linear_view::default_colors;
|
||||
}
|
||||
feis::ColorEdit4("Cursor", colors.cursor);
|
||||
@ -839,8 +841,8 @@ void LinearView::display_settings() {
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
if (ImGui::CollapsingHeader("Metrics##Vertical View Settings")) {
|
||||
if (ImGui::Button("Reset##Metrics##Vertical View Settings")) {
|
||||
if (ImGui::CollapsingHeader("Metrics##Linear View Settings")) {
|
||||
if (ImGui::Button("Reset##Metrics##Linear View Settings")) {
|
||||
sizes = linear_view::default_sizes;
|
||||
}
|
||||
ImGui::DragInt("Cursor Height", &sizes.cursor_height);
|
||||
|
@ -41,8 +41,6 @@ const std::map<unsigned int, sf::Color> reference_note_colors = {{
|
||||
}};
|
||||
const sf::Color reference_note_grey = {134, 110, 116};
|
||||
|
||||
|
||||
|
||||
namespace linear_view {
|
||||
struct ComputedSizes {
|
||||
int x;
|
||||
|
Loading…
x
Reference in New Issue
Block a user