Change All Frame Properties: Depth

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-10-06 01:24:05 -04:00
1 parent f3fb7d5101
commit a440af3c95
5 files changed
+31 -2

No files matched your search

@@ -212,6 +212,15 @@ namespace anm2ed::imgui::wizard
STEP_FAST);
ImGui::EndDisabled();
ImGui::PopID();
ImGui::BeginDisabled(!isLayerPropertyAvailable);
ImGui::PushID("Depth");
property_toggle_begin(settings.changeIsDepth);
input_int_range(localize.get(BASIC_DEPTH), settings.changeDepth, -FRAME_DEPTH_MAX, FRAME_DEPTH_MAX, STEP,
STEP_FAST);
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_DEPTH));
ImGui::EndDisabled();
ImGui::PopID();
ImGui::EndDisabled();
rows_draw(colorRows, true);
ImGui::BeginDisabled(!isLayerPropertyAvailable);
@@ -238,6 +247,7 @@ namespace anm2ed::imgui::wizard
FRAME_CHANGE_SCALARS
#undef X
if (settings.changeIsDuration) frameChange.duration = settings.changeDuration;
if (settings.changeIsDepth) frameChange.depth = settings.changeDepth;
if (settings.changeIsRegion) frameChange.regionId = regionId;
if (settings.changeIsShader) frameChange.shaderId = shaderId;
if (settings.changeIsVisibleSet) frameChange.isVisible = settings.changeIsVisible;
@@ -309,8 +319,8 @@ namespace anm2ed::imgui::wizard
ImGui::Separator();
}
bool isAnyProperty = settings.changeIsDuration || settings.changeIsRegion || settings.changeIsShader ||
settings.changeIsVisibleSet || settings.changeIsInterpolationSet ||
bool isAnyProperty = settings.changeIsDuration || settings.changeIsDepth || settings.changeIsRegion ||
settings.changeIsShader || settings.changeIsVisibleSet || settings.changeIsInterpolationSet ||
settings.changeIsFlipXSet ||
settings.changeIsFlipYSet
#define X(name, member, isLayerOnly, isColor, isEnabled, value) || settings.isEnabled
+1
View File
@@ -185,6 +185,7 @@ namespace anm2ed
FRAME_CHANGE_SCALARS
#undef X
std::optional<int> duration{};
std::optional<int> depth{};
std::optional<int> shaderId{};
std::optional<bool> isVisible{};
std::optional<Interpolation> interpolation{};
+5
View File
@@ -196,6 +196,11 @@ namespace anm2ed::model
if (change.duration) frame.duration = std::max(FRAME_DURATION_MIN, frame.duration);
if (itemType == ItemType::LAYER && change.regionId) frame.regionId = *change.regionId;
if (itemType == ItemType::LAYER && change.shaderId) frame.shaderId = *change.shaderId;
if (itemType == ItemType::LAYER && change.depth)
{
apply(frame.depth, change.depth);
frame.depth = std::clamp(frame.depth, -FRAME_DEPTH_MAX, FRAME_DEPTH_MAX);
}
#define X(name, member, isLayerOnly, isColor, isEnabled, value) \
if (!isLayerOnly || itemType == ItemType::LAYER) apply(frame.member, change.name);
FRAME_CHANGE_SCALARS
+2
View File
@@ -91,6 +91,7 @@ namespace anm2ed
X(CHANGE_IS_SHEAR_Y, changeIsShearY, STRING_UNDEFINED, BOOL, false) \
X(CHANGE_IS_ROTATION, changeIsRotation, STRING_UNDEFINED, BOOL, false) \
X(CHANGE_IS_DURATION, changeIsDuration, STRING_UNDEFINED, BOOL, false) \
X(CHANGE_IS_DEPTH, changeIsDepth, STRING_UNDEFINED, BOOL, false) \
X(CHANGE_IS_TINT_R, changeIsTintR, STRING_UNDEFINED, BOOL, false) \
X(CHANGE_IS_TINT_G, changeIsTintG, STRING_UNDEFINED, BOOL, false) \
X(CHANGE_IS_TINT_B, changeIsTintB, STRING_UNDEFINED, BOOL, false) \
@@ -113,6 +114,7 @@ namespace anm2ed
X(CHANGE_SHEAR, changeShear, STRING_UNDEFINED, VEC2, {}) \
X(CHANGE_ROTATION, changeRotation, STRING_UNDEFINED, FLOAT, 0.0f) \
X(CHANGE_DURATION, changeDuration, STRING_UNDEFINED, INT, 0) \
X(CHANGE_DEPTH, changeDepth, STRING_UNDEFINED, INT, 0) \
X(CHANGE_TINT, changeTint, STRING_UNDEFINED, VEC4, {}) \
X(CHANGE_COLOR_OFFSET, changeColorOffset, STRING_UNDEFINED, VEC3, {}) \
X(CHANGE_REGION_ID, changeRegionId, STRING_UNDEFINED, INT, -1) \
+11
View File
@@ -367,3 +367,14 @@ TEST_CASE("frames_split splits every selected frame that spans the time")
CHECK(model.track_get({0, NULL_, 0})->frames.size() == nullCount + 1);
CHECK(model.track_get({0, LAYER, 0})->frames[0].duration == 1);
}
TEST_CASE("change all frame properties changes layer depth only")
{
auto model = fixture_load("02_items.anm2");
Reference layer{0, LAYER, 0, 0};
Reference null{0, NULL_, 0, 0};
edit::frames_change_apply(model, {.references = {layer, null}}, {.depth = 2}, ChangeType::ADD);
edit::frames_change_apply(model, {.references = {layer, null}}, {.depth = 1}, ChangeType::SUBTRACT);
CHECK(model.frame_get(layer)->depth == 1);
CHECK(model.frame_get(null)->depth == 0);
}