Animation layers in the timeline: child tracks, stepping in, breadcrumb
An animation layer's row shows a folder; opening it lists its child's tracks underneath, greyed and read only, with each keyframe drawn where the parent reaches it. Double-clicking the row (or a child row) steps into the child: its animation in this tab, or its library's tab (opened if need be), at the time the parent plays it. A breadcrumb above the timeline leads back out, and the preview draws the parent around the child, dimmed and frozen where it was stepped in from. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8807096170
commit
0e705e43fa
15 files changed
+402
-20
No files matched your search
+16
-1
@@ -41,6 +41,19 @@ namespace anm2ed
|
|||||||
std::filesystem::file_time_type writeTime{};
|
std::filesystem::file_time_type writeTime{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// A step into an animation layer's child: the parent's tab, animation, time and layer track it was taken from,
|
||||||
|
// and the animation it led to (in this tab, or a library's).
|
||||||
|
struct ChildStep
|
||||||
|
{
|
||||||
|
std::uint64_t tabId{};
|
||||||
|
int animationIndex{-1};
|
||||||
|
float frameTime{};
|
||||||
|
Reference layer{};
|
||||||
|
std::string animationName{};
|
||||||
|
std::string layerName{};
|
||||||
|
int childAnimationIndex{-1};
|
||||||
|
};
|
||||||
|
|
||||||
struct DocumentData
|
struct DocumentData
|
||||||
{
|
{
|
||||||
std::filesystem::path path{};
|
std::filesystem::path path{};
|
||||||
@@ -65,7 +78,9 @@ namespace anm2ed
|
|||||||
bool isValid{true};
|
bool isValid{true};
|
||||||
bool isOpen{true};
|
bool isOpen{true};
|
||||||
bool isForceDirty{false};
|
bool isForceDirty{false};
|
||||||
bool isVectorKept{}; // asked this session to keep SVG spritesheets in a Rebirth document
|
bool isVectorKept{};
|
||||||
|
std::vector<ChildStep>
|
||||||
|
childSteps{}; // the steps that led to the animation being edited (the breadcrumb) // asked this session to keep SVG spritesheets in a Rebirth document
|
||||||
std::unordered_map<int, uint64_t> spritesheetHashes{};
|
std::unordered_map<int, uint64_t> spritesheetHashes{};
|
||||||
std::unordered_map<int, uint64_t> spritesheetSaveHashes{};
|
std::unordered_map<int, uint64_t> spritesheetSaveHashes{};
|
||||||
std::unordered_map<int, uint64_t> spritesheetAutosaveHashes{};
|
std::unordered_map<int, uint64_t> spritesheetAutosaveHashes{};
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ namespace anm2ed::imgui
|
|||||||
constexpr auto NULL_RECT_COLOR = vec4(0.0f, 0.0f, 1.0f, 0.90f);
|
constexpr auto NULL_RECT_COLOR = vec4(0.0f, 0.0f, 1.0f, 0.90f);
|
||||||
constexpr auto SELECTED_LAYER_BORDER_COLOR = vec4(1.0f, 0.1059f, 0.5882f, 1.0f);
|
constexpr auto SELECTED_LAYER_BORDER_COLOR = vec4(1.0f, 0.1059f, 0.5882f, 1.0f);
|
||||||
constexpr auto TARGET_SIZE = vec2(32, 32);
|
constexpr auto TARGET_SIZE = vec2(32, 32);
|
||||||
|
constexpr auto PARENT_DIM_ALPHA = 0.65f; // how much a stepped-into child's parent fades
|
||||||
constexpr auto POINT_SIZE = vec2(4, 4);
|
constexpr auto POINT_SIZE = vec2(4, 4);
|
||||||
constexpr auto TRIGGER_TEXT_COLOR_DARK = ImVec4(1.0f, 1.0f, 1.0f, 0.5f);
|
constexpr auto TRIGGER_TEXT_COLOR_DARK = ImVec4(1.0f, 1.0f, 1.0f, 0.5f);
|
||||||
constexpr auto TRIGGER_TEXT_COLOR_LIGHT = ImVec4(0.0f, 0.0f, 0.0f, 0.5f);
|
constexpr auto TRIGGER_TEXT_COLOR_LIGHT = ImVec4(0.0f, 0.0f, 0.0f, 0.5f);
|
||||||
@@ -657,23 +658,28 @@ namespace anm2ed::imgui
|
|||||||
};
|
};
|
||||||
auto isOnlySelected = settings.onionskinIsOnlySelected;
|
auto isOnlySelected = settings.onionskinIsOnlySelected;
|
||||||
|
|
||||||
// Draws an animation's draw list; onion-skin samples are tinted and faded, `alphaOffset` fades the overlay.
|
// Draws an animation's draw list; onion-skin samples are tinted and faded, `alphaOffset` fades the overlay. A
|
||||||
auto render = [&](Document& sampleDocument, const model::Animation& sampleAnimation, float alphaOffset)
|
// parent around a stepped-into child is drawn in the child's space (`scene`), its layers only, without the
|
||||||
|
// animation layer playing the child (`skipLayerId`).
|
||||||
|
auto render = [&](Document& sampleDocument, const model::Animation& sampleAnimation, float alphaOffset,
|
||||||
|
const model::DrawOptions& options, const mat4& scene = mat4(1.0f), int skipLayerId = -1)
|
||||||
{
|
{
|
||||||
auto isActiveDocument = &sampleDocument == &document;
|
auto isActiveDocument = &sampleDocument == &document && skipLayerId == -1;
|
||||||
|
auto isParent = skipLayerId != -1;
|
||||||
auto& sampleModel = sampleDocument.model;
|
auto& sampleModel = sampleDocument.model;
|
||||||
auto targetIcon = resources.icon_id_get(isAltIcons && !isIsolated ? icon::TARGET_ALT : icon::TARGET);
|
auto targetIcon = resources.icon_id_get(isAltIcons && !isIsolated ? icon::TARGET_ALT : icon::TARGET);
|
||||||
auto sampleOptions = drawOptions;
|
auto sampleOptions = options;
|
||||||
sampleOptions.library_get = sampleDocument.library_resolver_get();
|
sampleOptions.library_get = sampleDocument.library_resolver_get();
|
||||||
for (const auto& draw : model::animation_draws_get(sampleModel, sampleAnimation, sampleOptions))
|
for (const auto& draw : model::animation_draws_get(sampleModel, sampleAnimation, sampleOptions))
|
||||||
{
|
{
|
||||||
|
if (isParent && (draw.type != model::DrawType::LAYER || draw.id == skipLayerId)) continue;
|
||||||
auto isOnion = draw.sample != -1;
|
auto isOnion = draw.sample != -1;
|
||||||
if (isOnion && isOnlySelected && !(isActiveDocument && is_draw_selected(draw))) continue;
|
if (isOnion && isOnlySelected && !(isActiveDocument && is_draw_selected(draw))) continue;
|
||||||
auto sampleColor = isOnion ? sampleColors[draw.sample] : vec3();
|
auto sampleColor = isOnion ? sampleColors[draw.sample] : vec3();
|
||||||
auto sampleAlpha = isOnion ? sampleAlphas[draw.sample] : 0.0f;
|
auto sampleAlpha = isOnion ? sampleAlphas[draw.sample] : 0.0f;
|
||||||
auto onionColor = vec4(sampleColor, 1.0f - sampleAlpha);
|
auto onionColor = vec4(sampleColor, 1.0f - sampleAlpha);
|
||||||
auto& frame = draw.frame;
|
auto& frame = draw.frame;
|
||||||
auto transform = baseTransform * draw.parent;
|
auto transform = baseTransform * scene * draw.parent;
|
||||||
auto marker_model_get = [&](vec2 markerSize)
|
auto marker_model_get = [&](vec2 markerSize)
|
||||||
{
|
{
|
||||||
return math::quad_model_get(markerSize, frame.position, markerSize * 0.5f,
|
return math::quad_model_get(markerSize, frame.position, markerSize * 0.5f,
|
||||||
@@ -708,7 +714,8 @@ namespace anm2ed::imgui
|
|||||||
tint.a = std::max(0.0f, tint.a - (alphaOffset + sampleAlpha));
|
tint.a = std::max(0.0f, tint.a - (alphaOffset + sampleAlpha));
|
||||||
auto customShader = sampleDocument.shader_get(frame.shaderId);
|
auto customShader = sampleDocument.shader_get(frame.shaderId);
|
||||||
layer_render(customShader ? *customShader : shaderTexture, resource::texture::id_get(*layerTexture),
|
layer_render(customShader ? *customShader : shaderTexture, resource::texture::id_get(*layerTexture),
|
||||||
textureSize, baseTransform, draw, tint, frame.colorOffset + vec4(sampleColor, 0.0f));
|
textureSize, baseTransform * scene, draw, tint, frame.colorOffset + vec4(sampleColor, 0.0f));
|
||||||
|
if (isParent) continue;
|
||||||
|
|
||||||
auto color = isOnion ? onionColor
|
auto color = isOnion ? onionColor
|
||||||
: isActiveDocument && is_layer_selected(draw.id) ? SELECTED_LAYER_BORDER_COLOR
|
: isActiveDocument && is_layer_selected(draw.id) ? SELECTED_LAYER_BORDER_COLOR
|
||||||
@@ -740,11 +747,30 @@ namespace anm2ed::imgui
|
|||||||
{
|
{
|
||||||
if (auto overlayDocument = isIsolated ? nullptr : overlay_animation_document_get(manager, document))
|
if (auto overlayDocument = isIsolated ? nullptr : overlay_animation_document_get(manager, document))
|
||||||
if (auto overlayAnimation = overlayDocument->model.animation_get(overlayIndex))
|
if (auto overlayAnimation = overlayDocument->model.animation_get(overlayIndex))
|
||||||
render(*overlayDocument, *overlayAnimation, 1.0f - math::percent_to_unit(overlayTransparency));
|
render(*overlayDocument, *overlayAnimation, 1.0f - math::percent_to_unit(overlayTransparency),
|
||||||
|
drawOptions);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Editing a stepped-into child: its parent, dimmed and frozen where it was stepped in, around it.
|
||||||
|
if (auto& steps = document.childSteps;
|
||||||
|
!isIsolated && !steps.empty() && steps.back().childAnimationIndex == reference.animationIndex)
|
||||||
|
{
|
||||||
|
auto& step = steps.back();
|
||||||
|
auto parentIndex = manager.tab_index_get(step.tabId);
|
||||||
|
auto parentDocument = parentIndex == -1 ? nullptr : manager.get(parentIndex);
|
||||||
|
auto parentAnimation = parentDocument ? parentDocument->model.animation_get(step.animationIndex) : nullptr;
|
||||||
|
auto placement = parentAnimation
|
||||||
|
? model::layer_child_transform_get(parentDocument->model, *parentAnimation,
|
||||||
|
step.layer.itemID, step.frameTime, isRootTransform)
|
||||||
|
: std::nullopt;
|
||||||
|
if (placement && glm::determinant(*placement) != 0.0f)
|
||||||
|
render(*parentDocument, *parentAnimation, PARENT_DIM_ALPHA,
|
||||||
|
{.time = step.frameTime, .isRootTransform = isRootTransform}, glm::inverse(*placement),
|
||||||
|
step.layer.itemID);
|
||||||
|
}
|
||||||
|
|
||||||
if (overlayDrawOrder == overlay_draw_order::UNDER) overlay_render();
|
if (overlayDrawOrder == overlay_draw_order::UNDER) overlay_render();
|
||||||
render(document, *animation, 0.0f);
|
render(document, *animation, 0.0f, drawOptions);
|
||||||
if (overlayDrawOrder == overlay_draw_order::OVER) overlay_render();
|
if (overlayDrawOrder == overlay_draw_order::OVER) overlay_render();
|
||||||
|
|
||||||
if (settings.onionskinIsEnabled && settings.onionskinIsPivotPath && !isIsolated)
|
if (settings.onionskinIsEnabled && settings.onionskinIsPivotPath && !isIsolated)
|
||||||
|
|||||||
@@ -40,13 +40,8 @@ namespace anm2ed::imgui
|
|||||||
{
|
{
|
||||||
manager.command_push({.runManager = [path = document.library_path_get(id)](Manager& manager)
|
manager.command_push({.runManager = [path = document.library_path_get(id)](Manager& manager)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < (int)manager.documents.size(); ++i)
|
if (auto index = manager.path_index_get(path); index != -1)
|
||||||
{
|
return manager.tab_select(index);
|
||||||
std::error_code ec{};
|
|
||||||
if (!std::filesystem::equivalent(manager.documents[i].path, path, ec)) continue;
|
|
||||||
manager.pendingSelected = i;
|
|
||||||
return manager.set(i);
|
|
||||||
}
|
|
||||||
manager.open(path);
|
manager.open(path);
|
||||||
}});
|
}});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,159 @@
|
|||||||
|
#include "context.hpp"
|
||||||
|
|
||||||
|
// Animation layers in the timeline: their child's tracks under them (read only, timed as the parent plays them),
|
||||||
|
// stepping into the child, and the breadcrumb back out.
|
||||||
|
namespace anm2ed::imgui
|
||||||
|
{
|
||||||
|
constexpr auto BREADCRUMB_SEPARATOR = ">";
|
||||||
|
|
||||||
|
// The child animation's tracks (root, layers top-down, nulls, triggers) when an animation layer row is expanded.
|
||||||
|
std::vector<PeekRow> TimelineContext::peek_rows_get(const TimelineRow& row)
|
||||||
|
{
|
||||||
|
std::vector<PeekRow> rows{};
|
||||||
|
if (row.isGroup || row.type != LAYER) return rows;
|
||||||
|
auto track = item_get(LAYER, row.id, row.groupType, row.groupId);
|
||||||
|
auto layer = model::item_get(model.content.layers, row.id);
|
||||||
|
if (!track || !layer || !layer->is_animation() || !expandedLayerTracks.contains(track->uid)) return rows;
|
||||||
|
auto [source, child] = model::child_get(model, *layer, {}, document.library_resolver_get());
|
||||||
|
if (!child) return rows;
|
||||||
|
|
||||||
|
auto row_add = [&](const model::Track& childTrack)
|
||||||
|
{
|
||||||
|
if (settings.timelineIsShowUnused || !childTrack.frames.empty()) rows.push_back({source, child, &childTrack});
|
||||||
|
};
|
||||||
|
row_add(child->root);
|
||||||
|
std::vector<const model::Track*> layers{};
|
||||||
|
model::tracks_each(child->layers, [&](const model::Track& childTrack, auto*) { layers.push_back(&childTrack); });
|
||||||
|
for (auto it = layers.rbegin(); it != layers.rend(); ++it)
|
||||||
|
row_add(**it);
|
||||||
|
model::tracks_each(child->nulls, [&](const model::Track& childTrack, auto*) { row_add(childTrack); });
|
||||||
|
row_add(child->triggers);
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TimelineContext::child_step_in(const TimelineRow& row)
|
||||||
|
{
|
||||||
|
manager.command_push({.runManager = [index = manager.selected, layer = row_item_reference_get(row)](
|
||||||
|
Manager& manager) { manager.child_step_in(index, layer); }});
|
||||||
|
}
|
||||||
|
|
||||||
|
void TimelineContext::peek_item_child(const TimelineRow& row, const PeekRow& peek, int index)
|
||||||
|
{
|
||||||
|
auto type = (int)peek.track->type;
|
||||||
|
auto label = std::string(localize.get(TYPE_STRINGS[type]));
|
||||||
|
if (type == LAYER)
|
||||||
|
if (auto layer = model::item_get(peek.source->content.layers, peek.track->id)) label = layer_label_get(*layer);
|
||||||
|
if (type == NULL_)
|
||||||
|
if (auto null = model::item_get(peek.source->content.nulls, peek.track->id)) label = null->name;
|
||||||
|
|
||||||
|
ImGui::PushID(index);
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_ChildBg, to_imvec4(color_get(COLOR_ITEM_BASE, type) * COLOR_HIDDEN_MULTIPLIER));
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing);
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, style.WindowPadding);
|
||||||
|
if (ImGui::BeginChild("##Peek Item Child", ImVec2(ImGui::GetContentRegionAvail().x, rowFrameChildHeight),
|
||||||
|
ImGuiChildFlags_Borders, ImGuiWindowFlags_NoScrollWithMouse))
|
||||||
|
{
|
||||||
|
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + (float)(row.depth + 1) * ImGui::GetTextLineHeightWithSpacing());
|
||||||
|
ImGui::BeginDisabled();
|
||||||
|
ImGui::Image(resources.icon_id_get(TYPE_ICONS[type]), icon_size_get());
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::TextUnformatted(label.c_str());
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
if (ImGui::IsWindowHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) child_step_in(row);
|
||||||
|
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CHILD_TRACK));
|
||||||
|
}
|
||||||
|
ImGui::EndChild();
|
||||||
|
ImGui::PopStyleVar(2);
|
||||||
|
ImGui::PopStyleColor();
|
||||||
|
ImGui::PopID();
|
||||||
|
}
|
||||||
|
|
||||||
|
// The child track's keyframes where the parent reaches them: a run of parent frames showing the same keyframe is one
|
||||||
|
// cell (a trigger, one cell on the frame it fires).
|
||||||
|
void TimelineContext::peek_frame_child(const TimelineRow& row, const PeekRow& peek, int& index, float width)
|
||||||
|
{
|
||||||
|
ImGui::PushID(index++);
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2());
|
||||||
|
if (ImGui::BeginChild("##Peek Frames Child", ImVec2(width, rowFrameChildHeight), ImGuiChildFlags_Borders) &&
|
||||||
|
animation)
|
||||||
|
{
|
||||||
|
auto drawList = ImGui::GetWindowDrawList();
|
||||||
|
auto origin = ImGui::GetCursorScreenPos();
|
||||||
|
auto frameSize = ImVec2(ImGui::GetTextLineHeight(), ImGui::GetContentRegionAvail().y);
|
||||||
|
auto track = item_get(LAYER, row.id, row.groupType, row.groupId);
|
||||||
|
auto layer = model::item_get(model.content.layers, row.id);
|
||||||
|
auto type = (int)peek.track->type;
|
||||||
|
auto isTrigger = type == TRIGGER;
|
||||||
|
auto color = ImGui::GetColorU32(to_imvec4(color_get(COLOR_FRAME_BASE, type) * COLOR_HIDDEN_MULTIPLIER));
|
||||||
|
auto libraryGet = document.library_resolver_get();
|
||||||
|
|
||||||
|
auto key_get = [&](int time)
|
||||||
|
{
|
||||||
|
auto frame = model::frame_generate(*track, (float)time);
|
||||||
|
if (!frame.isVisible || model::child_get(model, *layer, frame, libraryGet).second != peek.child) return -1;
|
||||||
|
auto childTime = model::child_time_get(*track, (float)time, peek.child->frameNum, layer->id);
|
||||||
|
return isTrigger ? model::frame_index_from_at_frame_get(*peek.track, (int)childTime)
|
||||||
|
: model::frame_index_from_time_get(*peek.track, childTime);
|
||||||
|
};
|
||||||
|
auto cell_draw = [&](int start, int end, int key)
|
||||||
|
{
|
||||||
|
auto min = ImVec2(origin.x + frameSize.x * (float)start, origin.y);
|
||||||
|
auto max = ImVec2(origin.x + frameSize.x * (float)end, origin.y + frameSize.y);
|
||||||
|
drawList->AddRectFilled(min, max, color, FRAME_ROUNDING);
|
||||||
|
drawList->AddRect(min, max, ImGui::GetColorU32(frameBorderColor), FRAME_ROUNDING);
|
||||||
|
auto icon = isTrigger ? icon::TRIGGER : INTERPOLATION_ICONS[(int)peek.track->frames[key].interpolation];
|
||||||
|
auto iconSize = icon_size_get();
|
||||||
|
auto iconMin = ImVec2(min.x, origin.y + (frameSize.y - iconSize.y) / 2);
|
||||||
|
drawList->AddImage((ImTextureID)(intptr_t)resources.icon_id_get(icon), iconMin,
|
||||||
|
ImVec2(iconMin.x + iconSize.x, iconMin.y + iconSize.y), ImVec2(0, 0), ImVec2(1, 1),
|
||||||
|
ImGui::GetColorU32(iconTintDefault));
|
||||||
|
};
|
||||||
|
|
||||||
|
int runStart{};
|
||||||
|
int runKey{-1};
|
||||||
|
for (int time = 0; time <= animation->frameNum; ++time)
|
||||||
|
{
|
||||||
|
auto key = time < animation->frameNum && track && layer ? key_get(time) : -1;
|
||||||
|
if (key == runKey) continue;
|
||||||
|
if (runKey != -1 && !isTrigger) cell_draw(runStart, time, runKey);
|
||||||
|
if (key != -1 && isTrigger) cell_draw(time, time + 1, key);
|
||||||
|
runStart = time;
|
||||||
|
runKey = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::IsWindowHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) child_step_in(row);
|
||||||
|
}
|
||||||
|
ImGui::EndChild();
|
||||||
|
ImGui::PopStyleVar();
|
||||||
|
ImGui::PopID();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where the animation being edited was stepped into from: each step leads back.
|
||||||
|
void TimelineContext::breadcrumb_draw()
|
||||||
|
{
|
||||||
|
auto& steps = document.childSteps;
|
||||||
|
if (!steps.empty() && steps.back().childAnimationIndex != reference.animationIndex) steps.clear();
|
||||||
|
if (steps.empty()) return;
|
||||||
|
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, style.WindowPadding);
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing);
|
||||||
|
ImGui::SetCursorPos(ImVec2(style.WindowPadding.x, ImGui::GetCursorPosY() + style.ItemSpacing.y));
|
||||||
|
auto crumb_draw = [&](const std::string& label, int stepIndex)
|
||||||
|
{
|
||||||
|
ImGui::PushID(stepIndex);
|
||||||
|
if (ImGui::SmallButton(label.c_str()))
|
||||||
|
manager.command_push({.runManager = [index = manager.selected, stepIndex](Manager& manager)
|
||||||
|
{ manager.child_step_out(index, stepIndex); }});
|
||||||
|
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_STEP_OUT));
|
||||||
|
ImGui::PopID();
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::TextUnformatted(BREADCRUMB_SEPARATOR);
|
||||||
|
ImGui::SameLine();
|
||||||
|
};
|
||||||
|
crumb_draw(steps.front().animationName, 0);
|
||||||
|
for (int i = 0; i + 1 < (int)steps.size(); ++i)
|
||||||
|
crumb_draw(steps[i].layerName, i + 1);
|
||||||
|
ImGui::TextUnformatted(steps.back().layerName.c_str());
|
||||||
|
ImGui::PopStyleVar(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -137,6 +137,14 @@ namespace anm2ed::imgui
|
|||||||
resource::icon::EASE_IN, resource::icon::EASE_OUT,
|
resource::icon::EASE_IN, resource::icon::EASE_OUT,
|
||||||
resource::icon::EASE_IN_OUT};
|
resource::icon::EASE_IN_OUT};
|
||||||
|
|
||||||
|
// A read-only row under an expanded animation layer: one track of the child animation it plays.
|
||||||
|
struct PeekRow
|
||||||
|
{
|
||||||
|
const model::Model* source{};
|
||||||
|
const model::Animation* child{};
|
||||||
|
const model::Track* track{};
|
||||||
|
};
|
||||||
|
|
||||||
Reference row_item_reference_get(const TimelineRow&);
|
Reference row_item_reference_get(const TimelineRow&);
|
||||||
Reference row_selection_reference_get(const TimelineRow&);
|
Reference row_selection_reference_get(const TimelineRow&);
|
||||||
|
|
||||||
@@ -254,6 +262,11 @@ namespace anm2ed::imgui
|
|||||||
void group_properties_open(const TimelineRow& row, const model::TrackGroup& group);
|
void group_properties_open(const TimelineRow& row, const model::TrackGroup& group);
|
||||||
void group_properties_update();
|
void group_properties_update();
|
||||||
void item_context_menu();
|
void item_context_menu();
|
||||||
|
std::vector<PeekRow> peek_rows_get(const TimelineRow&);
|
||||||
|
void peek_item_child(const TimelineRow&, const PeekRow&, int);
|
||||||
|
void peek_frame_child(const TimelineRow&, const PeekRow&, int&, float);
|
||||||
|
void child_step_in(const TimelineRow&);
|
||||||
|
void breadcrumb_draw();
|
||||||
|
|
||||||
TimelineContext(TimelineState&&, Manager&, Settings&, Resources&, Clipboard&);
|
TimelineContext(TimelineState&&, Manager&, Settings&, Resources&, Clipboard&);
|
||||||
void update();
|
void update();
|
||||||
|
|||||||
@@ -732,7 +732,15 @@ namespace anm2ed::imgui
|
|||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 2.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 2.0f);
|
||||||
|
|
||||||
for (const auto& row : timeline_item_rows_get())
|
for (const auto& row : timeline_item_rows_get())
|
||||||
|
{
|
||||||
frames_child_row(row);
|
frames_child_row(row);
|
||||||
|
for (const auto& peek : peek_rows_get(row))
|
||||||
|
{
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
ImGui::TableSetColumnIndex(0);
|
||||||
|
peek_frame_child(row, peek, index, childWidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ namespace anm2ed::imgui
|
|||||||
{
|
{
|
||||||
isWindowHovered = ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows |
|
isWindowHovered = ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows |
|
||||||
ImGuiHoveredFlags_AllowWhenBlockedByActiveItem);
|
ImGuiHoveredFlags_AllowWhenBlockedByActiveItem);
|
||||||
|
breadcrumb_draw();
|
||||||
frames_child();
|
frames_child();
|
||||||
items_child();
|
items_child();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ namespace anm2ed::imgui
|
|||||||
std::optional<Reference> frameSelectionAnchor{};
|
std::optional<Reference> frameSelectionAnchor{};
|
||||||
int animationLengthEditIndex{-1};
|
int animationLengthEditIndex{-1};
|
||||||
std::vector<TimelineRow> rowDragReferences{};
|
std::vector<TimelineRow> rowDragReferences{};
|
||||||
|
std::set<std::uint64_t> expandedLayerTracks{}; // animation layer tracks (by uid) showing their child's tracks
|
||||||
glm::vec2 scroll{};
|
glm::vec2 scroll{};
|
||||||
ImGuiStyle style{};
|
ImGuiStyle style{};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -269,10 +269,12 @@ namespace anm2ed::imgui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto animationLayer = type == LAYER ? model::item_get(model.content.layers, id) : nullptr;
|
||||||
|
if (animationLayer && !animationLayer->is_animation()) animationLayer = nullptr;
|
||||||
if (isItemButtonHovered)
|
if (isItemButtonHovered)
|
||||||
{
|
{
|
||||||
if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left))
|
if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left))
|
||||||
item_base_properties_open(type, id);
|
animationLayer ? child_step_in(row) : item_base_properties_open(type, id);
|
||||||
else if (ImGui::IsMouseReleased(ImGuiMouseButton_Left) &&
|
else if (ImGui::IsMouseReleased(ImGuiMouseButton_Left) &&
|
||||||
!ImGui::IsMouseDragPastThreshold(ImGuiMouseButton_Left))
|
!ImGui::IsMouseDragPastThreshold(ImGuiMouseButton_Left))
|
||||||
row_selection_set(row);
|
row_selection_set(row);
|
||||||
@@ -370,7 +372,23 @@ namespace anm2ed::imgui
|
|||||||
contentCursorPos.x += (float)row.depth * ImGui::GetTextLineHeightWithSpacing();
|
contentCursorPos.x += (float)row.depth * ImGui::GetTextLineHeightWithSpacing();
|
||||||
ImGui::SetCursorPos(contentCursorPos);
|
ImGui::SetCursorPos(contentCursorPos);
|
||||||
|
|
||||||
|
// An animation layer's icon is a folder that shows (or hides) its child's tracks.
|
||||||
|
auto isExpanded = item && expandedLayerTracks.contains(item->uid);
|
||||||
|
if (animationLayer) icon = isExpanded ? icon::FOLDER_OPEN : icon::FOLDER;
|
||||||
ImGui::Image(resources.icon_id_get(icon), icon_size_get());
|
ImGui::Image(resources.icon_id_get(icon), icon_size_get());
|
||||||
|
auto mousePos = ImGui::GetIO().MousePos;
|
||||||
|
auto iconMin = ImGui::GetItemRectMin();
|
||||||
|
auto iconMax = ImGui::GetItemRectMax();
|
||||||
|
auto isIconHovered =
|
||||||
|
mousePos.x >= iconMin.x && mousePos.x < iconMax.x && mousePos.y >= iconMin.y && mousePos.y < iconMax.y;
|
||||||
|
if (animationLayer && isItemButtonHovered && isIconHovered && ImGui::IsMouseReleased(ImGuiMouseButton_Left) &&
|
||||||
|
!ImGui::IsMouseDragPastThreshold(ImGuiMouseButton_Left))
|
||||||
|
{
|
||||||
|
if (isExpanded)
|
||||||
|
expandedLayerTracks.erase(item->uid);
|
||||||
|
else
|
||||||
|
expandedLayerTracks.insert(item->uid);
|
||||||
|
}
|
||||||
overlay_icon(resources.icon_id_get(icon), iconTintCurrent, false);
|
overlay_icon(resources.icon_id_get(icon), iconTintCurrent, false);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (isReferenced) ImGui::PushFont(resources.fonts[font::ITALICS].get(), font::SIZE);
|
if (isReferenced) ImGui::PushFont(resources.fonts[font::ITALICS].get(), font::SIZE);
|
||||||
@@ -546,7 +564,15 @@ namespace anm2ed::imgui
|
|||||||
item_child_row({.type = NONE}, index++);
|
item_child_row({.type = NONE}, index++);
|
||||||
if (animation)
|
if (animation)
|
||||||
for (const auto& row : timeline_item_rows_get())
|
for (const auto& row : timeline_item_rows_get())
|
||||||
|
{
|
||||||
item_child_row(row, index++);
|
item_child_row(row, index++);
|
||||||
|
for (const auto& peek : peek_rows_get(row))
|
||||||
|
{
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
ImGui::TableSetColumnIndex(0);
|
||||||
|
peek_item_child(row, peek, index++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isHorizontalScroll && ImGui::GetCurrentWindow()->ScrollbarY)
|
if (isHorizontalScroll && ImGui::GetCurrentWindow()->ScrollbarY)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#include "file.hpp"
|
#include "file.hpp"
|
||||||
#include "log.hpp"
|
#include "log.hpp"
|
||||||
|
#include "model/draw.hpp"
|
||||||
|
#include "model/frames.hpp"
|
||||||
#include "path.hpp"
|
#include "path.hpp"
|
||||||
#include "sdl.hpp"
|
#include "sdl.hpp"
|
||||||
#include "strings.hpp"
|
#include "strings.hpp"
|
||||||
@@ -258,6 +260,96 @@ namespace anm2ed
|
|||||||
if (auto document = get()) document->change();
|
if (auto document = get()) document->change();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Manager::tab_index_get(std::uint64_t tabId) const
|
||||||
|
{
|
||||||
|
for (int i = 0; i < (int)documents.size(); ++i)
|
||||||
|
if (documents[i].tabId == tabId) return i;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The open document saved at `path`, or -1.
|
||||||
|
int Manager::path_index_get(const std::filesystem::path& path) const
|
||||||
|
{
|
||||||
|
for (int i = 0; i < (int)documents.size(); ++i)
|
||||||
|
{
|
||||||
|
std::error_code ec{};
|
||||||
|
if (std::filesystem::equivalent(documents[i].path, path, ec)) return i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Switches to a document's tab.
|
||||||
|
void Manager::tab_select(int index)
|
||||||
|
{
|
||||||
|
pendingSelected = index;
|
||||||
|
set(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edits the child of an animation layer track: its animation in this tab, or in its library's tab (opened if need
|
||||||
|
// be), at the time the parent plays it now. The step is remembered, so the breadcrumb can lead back.
|
||||||
|
void Manager::child_step_in(int index, Reference layerTrack)
|
||||||
|
{
|
||||||
|
auto parent = get(index);
|
||||||
|
auto animation = parent ? parent->model.animation_get(layerTrack.animationIndex) : nullptr;
|
||||||
|
auto track = parent ? parent->model.track_get(layerTrack) : nullptr;
|
||||||
|
auto layer = parent ? model::item_get(parent->model.content.layers, layerTrack.itemID) : nullptr;
|
||||||
|
if (!animation || !track || !layer || !layer->is_animation()) return;
|
||||||
|
auto time = parent->frameTime > -1 && !parent->playback.isPlaying ? parent->frameTime : parent->playback.time;
|
||||||
|
auto [childModel, childAnimation] =
|
||||||
|
model::child_get(parent->model, *layer, model::frame_generate(*track, time), parent->library_resolver_get());
|
||||||
|
if (!childAnimation) return;
|
||||||
|
|
||||||
|
auto steps = parent->childSteps;
|
||||||
|
steps.push_back({.tabId = parent->tabId,
|
||||||
|
.animationIndex = layerTrack.animationIndex,
|
||||||
|
.frameTime = time,
|
||||||
|
.layer = layerTrack,
|
||||||
|
.animationName = animation->name,
|
||||||
|
.layerName = layer->name});
|
||||||
|
auto childTime = model::child_time_get(*track, time, childAnimation->frameNum, layer->id);
|
||||||
|
auto childName = childAnimation->name;
|
||||||
|
parent->playback.isPlaying = false;
|
||||||
|
auto targetIndex = index;
|
||||||
|
if (childModel != &parent->model)
|
||||||
|
{
|
||||||
|
auto path = parent->library_path_get(layer->libraryId);
|
||||||
|
targetIndex = path_index_get(path);
|
||||||
|
if (targetIndex == -1)
|
||||||
|
{
|
||||||
|
if (!open(path)) return;
|
||||||
|
targetIndex = (int)documents.size() - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto& target = documents[targetIndex];
|
||||||
|
for (auto [childIndex, candidate] : target.model.animations_get())
|
||||||
|
if (candidate->name == childName) steps.back().childAnimationIndex = childIndex;
|
||||||
|
target.childSteps = steps;
|
||||||
|
target.reference_set({steps.back().childAnimationIndex});
|
||||||
|
target.frame_references_clear();
|
||||||
|
target.frameTime = target.playback.time = childTime;
|
||||||
|
tab_select(targetIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Goes back to where step `stepIndex` of a document's breadcrumb was taken, keeping the steps before it.
|
||||||
|
void Manager::child_step_out(int index, int stepIndex)
|
||||||
|
{
|
||||||
|
auto document = get(index);
|
||||||
|
if (!document || stepIndex < 0 || stepIndex >= (int)document->childSteps.size()) return;
|
||||||
|
auto steps = document->childSteps;
|
||||||
|
auto step = steps[stepIndex];
|
||||||
|
auto targetIndex = tab_index_get(step.tabId);
|
||||||
|
if (targetIndex == -1) return;
|
||||||
|
if (targetIndex != index) document->childSteps.clear();
|
||||||
|
|
||||||
|
auto& target = documents[targetIndex];
|
||||||
|
target.childSteps.assign(steps.begin(), steps.begin() + stepIndex);
|
||||||
|
target.reference_set(step.layer);
|
||||||
|
target.frame_references_clear();
|
||||||
|
target.frameTime = target.playback.time = step.frameTime;
|
||||||
|
tab_select(targetIndex);
|
||||||
|
}
|
||||||
|
|
||||||
void Manager::item_properties_open(ElementType type, int id)
|
void Manager::item_properties_open(ElementType type, int id)
|
||||||
{
|
{
|
||||||
auto document = get();
|
auto document = get();
|
||||||
|
|||||||
@@ -102,6 +102,11 @@ namespace anm2ed
|
|||||||
void set(int);
|
void set(int);
|
||||||
void close(int);
|
void close(int);
|
||||||
void item_properties_open(ElementType, int = -1);
|
void item_properties_open(ElementType, int = -1);
|
||||||
|
int tab_index_get(std::uint64_t) const;
|
||||||
|
int path_index_get(const std::filesystem::path&) const;
|
||||||
|
void tab_select(int);
|
||||||
|
void child_step_in(int, Reference);
|
||||||
|
void child_step_out(int, int);
|
||||||
|
|
||||||
void recent_files_load();
|
void recent_files_load();
|
||||||
void recent_files_write();
|
void recent_files_write();
|
||||||
|
|||||||
+28
-3
@@ -20,6 +20,13 @@ namespace anm2ed::model
|
|||||||
frame.rotation, math::percent_to_unit(frame.skew));
|
frame.rotation, math::percent_to_unit(frame.skew));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Where an animation layer's frame puts its child: the frame's transform, with its pivot as the child's origin.
|
||||||
|
glm::mat4 frame_child_model_get(const Frame& frame)
|
||||||
|
{
|
||||||
|
return math::quad_model_get(glm::vec2(1.0f), frame.position, frame.pivot, math::percent_to_unit(frame.scale),
|
||||||
|
frame.rotation, math::percent_to_unit(frame.skew));
|
||||||
|
}
|
||||||
|
|
||||||
// How many canvas pixels one spritesheet pixel of a layer draw covers (along its longer axis).
|
// How many canvas pixels one spritesheet pixel of a layer draw covers (along its longer axis).
|
||||||
float draw_scale_get(const Draw& draw)
|
float draw_scale_get(const Draw& draw)
|
||||||
{
|
{
|
||||||
@@ -140,6 +147,26 @@ namespace anm2ed::model
|
|||||||
return fires;
|
return fires;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Where an animation layer track (`layerId`) puts its child at a time, in the animation's space.
|
||||||
|
std::optional<glm::mat4> layer_child_transform_get(const Model& model, const Animation& animation, int layerId,
|
||||||
|
float time, bool isRootTransform)
|
||||||
|
{
|
||||||
|
std::optional<glm::mat4> transform{};
|
||||||
|
tracks_each(animation.layers,
|
||||||
|
[&](const Track& track, const TrackGroup* group)
|
||||||
|
{
|
||||||
|
if (track.id != layerId || transform) return;
|
||||||
|
glm::mat4 parent(1.0f);
|
||||||
|
if (isRootTransform)
|
||||||
|
{
|
||||||
|
parent *= frame_parent_model_get(frame_generate(animation.root, time));
|
||||||
|
if (group) parent *= frame_parent_model_get(frame_generate(group->root, time));
|
||||||
|
}
|
||||||
|
transform = parent * frame_child_model_get(frame_generate(track, time));
|
||||||
|
});
|
||||||
|
return transform;
|
||||||
|
}
|
||||||
|
|
||||||
// `playing` holds the animations being drawn into one another, so an animation never draws itself.
|
// `playing` holds the animations being drawn into one another, so an animation never draws itself.
|
||||||
std::vector<Draw> animation_draws_get(const Model& model, const Animation& animation, const DrawOptions& options,
|
std::vector<Draw> animation_draws_get(const Model& model, const Animation& animation, const DrawOptions& options,
|
||||||
std::vector<const Animation*>& playing)
|
std::vector<const Animation*>& playing)
|
||||||
@@ -164,9 +191,7 @@ namespace anm2ed::model
|
|||||||
auto [childModel, childAnimation] = child_get(model, layer, frame, options.library_get);
|
auto [childModel, childAnimation] = child_get(model, layer, frame, options.library_get);
|
||||||
if (!childAnimation || std::ranges::contains(playing, childAnimation)) return;
|
if (!childAnimation || std::ranges::contains(playing, childAnimation)) return;
|
||||||
playing.push_back(childAnimation);
|
playing.push_back(childAnimation);
|
||||||
auto transform = parent * math::quad_model_get(glm::vec2(1.0f), frame.position, frame.pivot,
|
auto transform = parent * frame_child_model_get(frame);
|
||||||
math::percent_to_unit(frame.scale), frame.rotation,
|
|
||||||
math::percent_to_unit(frame.skew));
|
|
||||||
DrawOptions childOptions{.time = child_time_get(track, time, childAnimation->frameNum, layer.id),
|
DrawOptions childOptions{.time = child_time_get(track, time, childAnimation->frameNum, layer.id),
|
||||||
.isRootTransform = true,
|
.isRootTransform = true,
|
||||||
.library_get = options.library_get};
|
.library_get = options.library_get};
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <optional>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "model.hpp"
|
#include "model.hpp"
|
||||||
@@ -61,6 +62,10 @@ namespace anm2ed::model
|
|||||||
};
|
};
|
||||||
|
|
||||||
glm::mat4 draw_quad_model_get(const Draw&);
|
glm::mat4 draw_quad_model_get(const Draw&);
|
||||||
|
glm::mat4 frame_child_model_get(const Frame&);
|
||||||
|
std::pair<const Model*, const Animation*> child_get(const Model&, const Layer&, const Frame&, const LibraryGet&);
|
||||||
|
float child_time_get(const Track&, float, int, int);
|
||||||
|
std::optional<glm::mat4> layer_child_transform_get(const Model&, const Animation&, int, float, bool);
|
||||||
float draw_scale_get(const Draw&);
|
float draw_scale_get(const Draw&);
|
||||||
std::vector<Draw> animation_draws_get(const Model&, const Animation&, const DrawOptions&);
|
std::vector<Draw> animation_draws_get(const Model&, const Animation&, const DrawOptions&);
|
||||||
std::vector<TriggerFire> animation_triggers_get(const Model&, const Animation&, int, const LibraryGet& = {});
|
std::vector<TriggerFire> animation_triggers_get(const Model&, const Animation&, int, const LibraryGet& = {});
|
||||||
|
|||||||
@@ -579,6 +579,7 @@ namespace anm2ed
|
|||||||
X(TOOLTIP_CHILD_RESTART, "Restart the child at this keyframe; otherwise it keeps playing from the keyframe before.", "Reinicia el hijo en este keyframe; si no, sigue desde el keyframe anterior.", "Перезапустить дочернюю анимацию на этом ключевом кадре; иначе она продолжается с предыдущего.", "在此关键帧重新开始子动画;否则从上一个关键帧继续播放。", "이 키프레임에서 자식을 다시 시작합니다. 그렇지 않으면 이전 키프레임부터 계속 재생됩니다.") \
|
X(TOOLTIP_CHILD_RESTART, "Restart the child at this keyframe; otherwise it keeps playing from the keyframe before.", "Reinicia el hijo en este keyframe; si no, sigue desde el keyframe anterior.", "Перезапустить дочернюю анимацию на этом ключевом кадре; иначе она продолжается с предыдущего.", "在此关键帧重新开始子动画;否则从上一个关键帧继续播放。", "이 키프레임에서 자식을 다시 시작합니다. 그렇지 않으면 이전 키프레임부터 계속 재생됩니다.") \
|
||||||
X(TOOLTIP_CHILD_START, "The child's frame when it starts (or the frame held).", "El frame del hijo al empezar (o el frame mantenido).", "Кадр дочерней анимации при старте (или удерживаемый кадр).", "子动画开始时的帧(或保持的帧)。", "자식이 시작할 때의 프레임(또는 고정된 프레임).") \
|
X(TOOLTIP_CHILD_START, "The child's frame when it starts (or the frame held).", "El frame del hijo al empezar (o el frame mantenido).", "Кадр дочерней анимации при старте (или удерживаемый кадр).", "子动画开始时的帧(或保持的帧)。", "자식이 시작할 때의 프레임(또는 고정된 프레임).") \
|
||||||
X(TOOLTIP_CHILD_START_RANDOM, "Start the child on a random frame.", "Empieza el hijo en un frame aleatorio.", "Начинать дочернюю анимацию со случайного кадра.", "从随机帧开始子动画。", "자식을 무작위 프레임에서 시작합니다.") \
|
X(TOOLTIP_CHILD_START_RANDOM, "Start the child on a random frame.", "Empieza el hijo en un frame aleatorio.", "Начинать дочернюю анимацию со случайного кадра.", "从随机帧开始子动画。", "자식을 무작위 프레임에서 시작합니다.") \
|
||||||
|
X(TOOLTIP_CHILD_TRACK, "A track of the animation this layer plays, timed as it plays here. Double-click to edit it.", "Una pista de la animación que reproduce esta capa, con el tiempo con que se reproduce aquí. Haz doble clic para editarla.", "Дорожка анимации, которую проигрывает этот слой, по времени её проигрывания здесь. Дважды щёлкните, чтобы редактировать.", "此图层播放的动画中的一条轨道,按此处的播放时间显示。双击以编辑。", "이 레이어가 재생하는 애니메이션의 트랙으로, 여기서 재생되는 시간에 맞춰 표시됩니다. 두 번 클릭해 편집하세요.") \
|
||||||
X(TOOLTIP_DEPTH, "Draw this layer this many layers above (or, negative, below) its place in the timeline, for this frame.\n(Editor only; the game always uses the timeline's order.)", "Dibuja esta capa tantas capas por encima (o, en negativo, por debajo) de su lugar en la línea de tiempo, durante este Frame.\n(Solo en el editor; el juego siempre usa el orden de la línea de tiempo.)", "Рисовать этот слой на столько слоёв выше (или, если отрицательно, ниже) его места на таймлайне в этом кадре.\n(Только в редакторе; игра всегда использует порядок таймлайна.)", "在此帧中,将此图层绘制在其时间轴位置之上(负数则之下)若干层。\n(仅限编辑器;游戏始终使用时间轴顺序。)", "이 프레임 동안 이 레이어를 타임라인 위치보다 지정한 수만큼 위(음수면 아래)에 그립니다.\n(편집기 전용이며, 게임은 항상 타임라인 순서를 사용합니다.)") \
|
X(TOOLTIP_DEPTH, "Draw this layer this many layers above (or, negative, below) its place in the timeline, for this frame.\n(Editor only; the game always uses the timeline's order.)", "Dibuja esta capa tantas capas por encima (o, en negativo, por debajo) de su lugar en la línea de tiempo, durante este Frame.\n(Solo en el editor; el juego siempre usa el orden de la línea de tiempo.)", "Рисовать этот слой на столько слоёв выше (или, если отрицательно, ниже) его места на таймлайне в этом кадре.\n(Только в редакторе; игра всегда использует порядок таймлайна.)", "在此帧中,将此图层绘制在其时间轴位置之上(负数则之下)若干层。\n(仅限编辑器;游戏始终使用时间轴顺序。)", "이 프레임 동안 이 레이어를 타임라인 위치보다 지정한 수만큼 위(음수면 아래)에 그립니다.\n(편집기 전용이며, 게임은 항상 타임라인 순서를 사용합니다.)") \
|
||||||
X(TOOLTIP_DETACHABLE_WINDOWS, "Windows can be dragged outside the main window into their own windows.\n(Not available on Wayland.)", "Las ventanas pueden arrastrarse fuera de la ventana principal a sus propias ventanas.\n(No disponible en Wayland.)", "Окна можно вытаскивать за пределы главного окна в отдельные окна.\n(Недоступно в Wayland.)", "可以将窗口拖出主窗口,成为独立的窗口。\n(Wayland 下不可用。)", "창을 메인 창 밖으로 끌어내 별도의 창으로 만들 수 있습니다.\n(Wayland에서는 사용할 수 없습니다.)") \
|
X(TOOLTIP_DETACHABLE_WINDOWS, "Windows can be dragged outside the main window into their own windows.\n(Not available on Wayland.)", "Las ventanas pueden arrastrarse fuera de la ventana principal a sus propias ventanas.\n(No disponible en Wayland.)", "Окна можно вытаскивать за пределы главного окна в отдельные окна.\n(Недоступно в Wayland.)", "可以将窗口拖出主窗口,成为独立的窗口。\n(Wayland 下不可用。)", "창을 메인 창 밖으로 끌어내 별도의 창으로 만들 수 있습니다.\n(Wayland에서는 사용할 수 없습니다.)") \
|
||||||
X(TOOLTIP_DOCUMENT_EXTENDED_FORMAT, "Save this document in the extended Anm2Ed format alone, instead of as a Rebirth document with the editor's copy inside.\nThe extended format is NOT compatible with The Binding of Isaac: Rebirth!", "Guarda este documento solo en el formato extendido de Anm2Ed, en vez de como documento de Rebirth con la copia del editor dentro.\n¡El formato extendido NO es compatible con The Binding of Isaac: Rebirth!", "Сохранять этот документ только в расширенном формате Anm2Ed, а не как документ Rebirth с копией редактора внутри.\nРасширенный формат НЕ совместим с The Binding of Isaac: Rebirth!", "仅以 Anm2Ed 扩展格式保存此文档,而不是保存为内含编辑器副本的 Rebirth 文档。\n扩展格式与 The Binding of Isaac: Rebirth 不兼容!", "이 문서를 편집기 사본이 들어 있는 Rebirth 문서 대신 Anm2Ed 확장 형식으로만 저장합니다.\n확장 형식은 The Binding of Isaac: Rebirth와 호환되지 않습니다!") \
|
X(TOOLTIP_DOCUMENT_EXTENDED_FORMAT, "Save this document in the extended Anm2Ed format alone, instead of as a Rebirth document with the editor's copy inside.\nThe extended format is NOT compatible with The Binding of Isaac: Rebirth!", "Guarda este documento solo en el formato extendido de Anm2Ed, en vez de como documento de Rebirth con la copia del editor dentro.\n¡El formato extendido NO es compatible con The Binding of Isaac: Rebirth!", "Сохранять этот документ только в расширенном формате Anm2Ed, а не как документ Rebirth с копией редактора внутри.\nРасширенный формат НЕ совместим с The Binding of Isaac: Rebirth!", "仅以 Anm2Ed 扩展格式保存此文档,而不是保存为内含编辑器副本的 Rebirth 文档。\n扩展格式与 The Binding of Isaac: Rebirth 不兼容!", "이 문서를 편집기 사본이 들어 있는 Rebirth 문서 대신 Anm2Ed 확장 형식으로만 저장합니다.\n확장 형식은 The Binding of Isaac: Rebirth와 호환되지 않습니다!") \
|
||||||
@@ -787,6 +788,7 @@ namespace anm2ed
|
|||||||
X(TOOLTIP_RELOAD_LIBRARIES, "Reloads the selected libraries.", "Recarga las bibliotecas seleccionadas.", "Перезагружает выбранные библиотеки.", "重新加载所选库.", "선택한 라이브러리를 다시 불러옵니다.") \
|
X(TOOLTIP_RELOAD_LIBRARIES, "Reloads the selected libraries.", "Recarga las bibliotecas seleccionadas.", "Перезагружает выбранные библиотеки.", "重新加载所选库.", "선택한 라이브러리를 다시 불러옵니다.") \
|
||||||
X(TOOLTIP_REMOVE_TRIGGER_EVENT, "Remove the last trigger event.", "Remover el último evento del trigger.", "Удалить последнее событие триггера.", "移除最后一个触发事件。", "마지막 트리거 이벤트를 제거합니다.") \
|
X(TOOLTIP_REMOVE_TRIGGER_EVENT, "Remove the last trigger event.", "Remover el último evento del trigger.", "Удалить последнее событие триггера.", "移除最后一个触发事件。", "마지막 트리거 이벤트를 제거합니다.") \
|
||||||
X(TOOLTIP_REMOVE_UNUSED_LIBRARIES, "Remove libraries no layer plays from.", "Elimina las bibliotecas que ninguna capa usa.", "Удалить библиотеки, которые не использует ни один слой.", "删除没有图层使用的库。", "어떤 레이어도 사용하지 않는 라이브러리를 제거합니다.") \
|
X(TOOLTIP_REMOVE_UNUSED_LIBRARIES, "Remove libraries no layer plays from.", "Elimina las bibliotecas que ninguna capa usa.", "Удалить библиотеки, которые не использует ни один слой.", "删除没有图层使用的库。", "어떤 레이어도 사용하지 않는 라이브러리를 제거합니다.") \
|
||||||
|
X(TOOLTIP_STEP_OUT, "Go back to editing this animation.", "Volver a editar esta animación.", "Вернуться к редактированию этой анимации.", "返回编辑此动画。", "이 애니메이션 편집으로 돌아갑니다.") \
|
||||||
X(TOOLTIP_USE_ANIMATION_BOUNDS, "Render using the animation's bounds instead of the preview viewport.", "Render using the animation's bounds instead of the preview viewport.", "Render using the animation's bounds instead of the preview viewport.", "Render using the animation's bounds instead of the preview viewport.", "Render using the animation's bounds instead of the preview viewport.") \
|
X(TOOLTIP_USE_ANIMATION_BOUNDS, "Render using the animation's bounds instead of the preview viewport.", "Render using the animation's bounds instead of the preview viewport.", "Render using the animation's bounds instead of the preview viewport.", "Render using the animation's bounds instead of the preview viewport.", "Render using the animation's bounds instead of the preview viewport.") \
|
||||||
X(TOOLTIP_USE_ISOLATED_ANIMATION, "Render only animation layers with a transparent background and preview helpers hidden.", "Render only animation layers with a transparent background and preview helpers hidden.", "Render only animation layers with a transparent background and preview helpers hidden.", "Render only animation layers with a transparent background and preview helpers hidden.", "Render only animation layers with a transparent background and preview helpers hidden.") \
|
X(TOOLTIP_USE_ISOLATED_ANIMATION, "Render only animation layers with a transparent background and preview helpers hidden.", "Render only animation layers with a transparent background and preview helpers hidden.", "Render only animation layers with a transparent background and preview helpers hidden.", "Render only animation layers with a transparent background and preview helpers hidden.", "Render only animation layers with a transparent background and preview helpers hidden.") \
|
||||||
X(TOOLTIP_RENDER_FPS, "Set the exported animation frame rate.", "Set the exported animation frame rate.", "Set the exported animation frame rate.", "Set the exported animation frame rate.", "Set the exported animation frame rate.") \
|
X(TOOLTIP_RENDER_FPS, "Set the exported animation frame rate.", "Set the exported animation frame rate.", "Set the exported animation frame rate.", "Set the exported animation frame rate.", "Set the exported animation frame rate.") \
|
||||||
|
|||||||
@@ -189,3 +189,12 @@ TEST_CASE("flattening animation layers bakes their children into plain layers th
|
|||||||
CHECK(game.find("spin/red") != std::string::npos);
|
CHECK(game.find("spin/red") != std::string::npos);
|
||||||
CHECK(std::ranges::count_if(model_load(text).content.layers, &model::Layer::is_animation) == 3);
|
CHECK(std::ranges::count_if(model_load(text).content.layers, &model::Layer::is_animation) == 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("an animation layer's child sits where the layer's frame puts it")
|
||||||
|
{
|
||||||
|
auto anm2 = model_load(file_load(TEST_DIR / "render" / "nested.anm2"));
|
||||||
|
auto placement = model::layer_child_transform_get(anm2, *anm2.animation_get(0), 0, 0.0f, true);
|
||||||
|
REQUIRE(placement);
|
||||||
|
CHECK(glm::vec2(*placement * glm::vec4(16.0f, 0.0f, 0.0f, 1.0f)) == glm::vec2(48.0f, 0.0f));
|
||||||
|
CHECK_FALSE(model::layer_child_transform_get(anm2, *anm2.animation_get(0), 99, 0.0f, true));
|
||||||
|
}
|
||||||
Reference in new issue
Block a user