diff --git a/src/imgui/window/items.cpp b/src/imgui/window/items.cpp index c4160ad..09b8486 100644 --- a/src/imgui/window/items.cpp +++ b/src/imgui/window/items.cpp @@ -2,6 +2,7 @@ #include +#include "path.hpp" #include "util/imgui/input.hpp" #include "util/imgui/layout.hpp" @@ -32,6 +33,23 @@ namespace anm2ed::imgui return std::vformat(localize.get(FORMAT_LAYER), std::make_format_args(layer.id, layer.name, layer.spritesheetId)); } + // Tooltip lines for what a layer shows: its spritesheet, or its animation and the library it's from. + void layer_source_tooltip_draw(const Document& document, const model::Layer& layer) + { + if (!layer.is_animation()) + { + ImGui::TextUnformatted(localize_format(FORMAT_SPRITESHEET_ID, layer.spritesheetId).c_str()); + return; + } + auto library = model::item_get(document.model.content.libraries, layer.libraryId); + auto libraryLabel = library ? std::format("#{} {}", library->id, util::path::to_utf8(library->path)) + : std::string(localize.get(TEXT_SELF)); + ImGui::TextUnformatted(localize_format(FORMAT_LAYER_ANIMATION_NAME, layer.animation).c_str()); + ImGui::TextUnformatted(localize_format(FORMAT_LAYER_LIBRARY, libraryLabel).c_str()); + if (document.is_layer_animation_missing(layer)) + ImGui::TextUnformatted(localize.get(TOOLTIP_LAYER_ANIMATION_MISSING)); + } + model::Layer item_edit_layer_get(const Manager::ItemEdit& edit) { return {.name = edit.name, @@ -175,12 +193,7 @@ namespace anm2ed::imgui { auto layer = model::item_get(layers, id); item_tooltip_draw(resources, layer->name, id); - if (document.is_layer_animation_missing(*layer)) - ImGui::TextUnformatted(localize.get(TOOLTIP_LAYER_ANIMATION_MISSING)); - else if (!layer->is_animation()) - ImGui::TextUnformatted(std::vformat(localize.get(FORMAT_SPRITESHEET_ID), - std::make_format_args(layer->spritesheetId)) - .c_str()); + layer_source_tooltip_draw(document, *layer); }, .activate = [&](int id) { manager.item_properties_open(ElementType::LAYER_ELEMENT, id); }}; list_panel_draw(panel, actions, {{ACTION_ADD, ACTION_REMOVE_UNUSED}}, diff --git a/src/imgui/window/panel.hpp b/src/imgui/window/panel.hpp index b16ca68..5abe337 100644 --- a/src/imgui/window/panel.hpp +++ b/src/imgui/window/panel.hpp @@ -151,6 +151,8 @@ namespace anm2ed::imgui void events_update(Panel&); void sounds_update(Panel&); std::string layer_label_get(const model::Layer&); + void layer_source_tooltip_draw(const Document&, const model::Layer&); + void layer_source_tooltip_draw(const Document&, const model::Layer&); model::Layer item_edit_layer_get(const Manager::ItemEdit&); model::Null item_edit_null_get(const Manager::ItemEdit&); void layer_source_draw(Document&, Manager::ItemEdit&); diff --git a/src/imgui/window/timeline/tracks.cpp b/src/imgui/window/timeline/tracks.cpp index e59fef1..e60e470 100644 --- a/src/imgui/window/timeline/tracks.cpp +++ b/src/imgui/window/timeline/tracks.cpp @@ -321,9 +321,7 @@ namespace anm2ed::imgui ImGui::PopFont(); ImGui::TextUnformatted(std::vformat(localize.get(FORMAT_ID), std::make_format_args(id)).c_str()); - ImGui::TextUnformatted( - std::vformat(localize.get(FORMAT_SPRITESHEET_ID), std::make_format_args(layer->spritesheetId)) - .c_str()); + layer_source_tooltip_draw(document, *layer); ImGui::TextUnformatted( std::vformat(localize.get(FORMAT_VISIBLE), std::make_format_args(visibleLabel)).c_str()); ImGui::TextUnformatted( diff --git a/src/resource/strings.hpp b/src/resource/strings.hpp index 71251b7..5031273 100644 --- a/src/resource/strings.hpp +++ b/src/resource/strings.hpp @@ -245,6 +245,8 @@ namespace anm2ed X(FORMAT_ISAAC_TRIGGER_SOUNDS, "{} trigger(s) have sounds, which the game doesn't read from animations; they will be dropped.", "{} disparador(es) tienen sonidos, que el juego no lee de las animaciones; se descartarán.", "{} триггер(ов) имеют звуки, которые игра не читает из анимаций; они будут отброшены.", "{} 个触发器带有声音,游戏不会从动画中读取,将被舍弃。", "트리거 {}개에 게임이 애니메이션에서 읽지 않는 사운드가 있습니다. 사운드는 제거됩니다.") \ X(FORMAT_ISAAC_VECTOR_SPRITESHEETS, "{} spritesheet(s) are SVGs, which the game can't load; export them as PNGs for it.", "{} spritesheet(s) son SVG, que el juego no puede cargar; expórtalos como PNG para él.", "{} спрайт-лист(ов) в формате SVG, который игра не может загрузить; экспортируйте их в PNG.", "{} 个图集是 SVG,游戏无法加载;请将其导出为 PNG。", "{}개의 스프라이트 시트가 SVG라서 게임에서 불러올 수 없습니다. PNG로 내보내세요.") \ X(FORMAT_LAYER_ANIMATION, "#{0} {1} (Animation: {2})", "#{0} {1} (Animación: {2})", "#{0} {1} (Анимация: {2})", "#{0} {1} (动画: {2})", "#{0} {1} (애니메이션: {2})") \ + X(FORMAT_LAYER_ANIMATION_NAME, "Animation: {}", "Animación: {}", "Анимация: {}", "动画: {}", "애니메이션: {}") \ + X(FORMAT_LAYER_LIBRARY, "Library: {}", "Biblioteca: {}", "Библиотека: {}", "库: {}", "라이브러리: {}") \ X(FORMAT_LIBRARY_ANIMATIONS, "Animations ({0})", "Animaciones ({0})", "Анимации ({0})", "动画 ({0})", "애니메이션 ({0})") \ X(FORMAT_ORIGIN, "Origin: {0}", "Origen: {0}", "Точка отсчета: {0}", "原点: {0}", "원점: {0}") \ X(FORMAT_SPRITESHEET_ID, "Spritesheet ID: {0}", "ID de Spritesheet: {0}", "", "图集 ID: {0}", "스프라이트 시트 ID: {0}") \