Change All Frame Properties: Depth
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
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);
|
STEP_FAST);
|
||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
ImGui::PopID();
|
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);
|
rows_draw(colorRows, true);
|
||||||
|
|
||||||
ImGui::BeginDisabled(!isLayerPropertyAvailable);
|
ImGui::BeginDisabled(!isLayerPropertyAvailable);
|
||||||
@@ -238,6 +247,7 @@ namespace anm2ed::imgui::wizard
|
|||||||
FRAME_CHANGE_SCALARS
|
FRAME_CHANGE_SCALARS
|
||||||
#undef X
|
#undef X
|
||||||
if (settings.changeIsDuration) frameChange.duration = settings.changeDuration;
|
if (settings.changeIsDuration) frameChange.duration = settings.changeDuration;
|
||||||
|
if (settings.changeIsDepth) frameChange.depth = settings.changeDepth;
|
||||||
if (settings.changeIsRegion) frameChange.regionId = regionId;
|
if (settings.changeIsRegion) frameChange.regionId = regionId;
|
||||||
if (settings.changeIsShader) frameChange.shaderId = shaderId;
|
if (settings.changeIsShader) frameChange.shaderId = shaderId;
|
||||||
if (settings.changeIsVisibleSet) frameChange.isVisible = settings.changeIsVisible;
|
if (settings.changeIsVisibleSet) frameChange.isVisible = settings.changeIsVisible;
|
||||||
@@ -309,8 +319,8 @@ namespace anm2ed::imgui::wizard
|
|||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isAnyProperty = settings.changeIsDuration || settings.changeIsRegion || settings.changeIsShader ||
|
bool isAnyProperty = settings.changeIsDuration || settings.changeIsDepth || settings.changeIsRegion ||
|
||||||
settings.changeIsVisibleSet || settings.changeIsInterpolationSet ||
|
settings.changeIsShader || settings.changeIsVisibleSet || settings.changeIsInterpolationSet ||
|
||||||
settings.changeIsFlipXSet ||
|
settings.changeIsFlipXSet ||
|
||||||
settings.changeIsFlipYSet
|
settings.changeIsFlipYSet
|
||||||
#define X(name, member, isLayerOnly, isColor, isEnabled, value) || settings.isEnabled
|
#define X(name, member, isLayerOnly, isColor, isEnabled, value) || settings.isEnabled
|
||||||
|
|||||||
@@ -185,6 +185,7 @@ namespace anm2ed
|
|||||||
FRAME_CHANGE_SCALARS
|
FRAME_CHANGE_SCALARS
|
||||||
#undef X
|
#undef X
|
||||||
std::optional<int> duration{};
|
std::optional<int> duration{};
|
||||||
|
std::optional<int> depth{};
|
||||||
std::optional<int> shaderId{};
|
std::optional<int> shaderId{};
|
||||||
std::optional<bool> isVisible{};
|
std::optional<bool> isVisible{};
|
||||||
std::optional<Interpolation> interpolation{};
|
std::optional<Interpolation> interpolation{};
|
||||||
|
|||||||
@@ -196,6 +196,11 @@ namespace anm2ed::model
|
|||||||
if (change.duration) frame.duration = std::max(FRAME_DURATION_MIN, frame.duration);
|
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.regionId) frame.regionId = *change.regionId;
|
||||||
if (itemType == ItemType::LAYER && change.shaderId) frame.shaderId = *change.shaderId;
|
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) \
|
#define X(name, member, isLayerOnly, isColor, isEnabled, value) \
|
||||||
if (!isLayerOnly || itemType == ItemType::LAYER) apply(frame.member, change.name);
|
if (!isLayerOnly || itemType == ItemType::LAYER) apply(frame.member, change.name);
|
||||||
FRAME_CHANGE_SCALARS
|
FRAME_CHANGE_SCALARS
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ namespace anm2ed
|
|||||||
X(CHANGE_IS_SHEAR_Y, changeIsShearY, STRING_UNDEFINED, BOOL, false) \
|
X(CHANGE_IS_SHEAR_Y, changeIsShearY, STRING_UNDEFINED, BOOL, false) \
|
||||||
X(CHANGE_IS_ROTATION, changeIsRotation, 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_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_R, changeIsTintR, STRING_UNDEFINED, BOOL, false) \
|
||||||
X(CHANGE_IS_TINT_G, changeIsTintG, STRING_UNDEFINED, BOOL, false) \
|
X(CHANGE_IS_TINT_G, changeIsTintG, STRING_UNDEFINED, BOOL, false) \
|
||||||
X(CHANGE_IS_TINT_B, changeIsTintB, 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_SHEAR, changeShear, STRING_UNDEFINED, VEC2, {}) \
|
||||||
X(CHANGE_ROTATION, changeRotation, STRING_UNDEFINED, FLOAT, 0.0f) \
|
X(CHANGE_ROTATION, changeRotation, STRING_UNDEFINED, FLOAT, 0.0f) \
|
||||||
X(CHANGE_DURATION, changeDuration, STRING_UNDEFINED, INT, 0) \
|
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_TINT, changeTint, STRING_UNDEFINED, VEC4, {}) \
|
||||||
X(CHANGE_COLOR_OFFSET, changeColorOffset, STRING_UNDEFINED, VEC3, {}) \
|
X(CHANGE_COLOR_OFFSET, changeColorOffset, STRING_UNDEFINED, VEC3, {}) \
|
||||||
X(CHANGE_REGION_ID, changeRegionId, STRING_UNDEFINED, INT, -1) \
|
X(CHANGE_REGION_ID, changeRegionId, STRING_UNDEFINED, INT, -1) \
|
||||||
|
|||||||
@@ -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, NULL_, 0})->frames.size() == nullCount + 1);
|
||||||
CHECK(model.track_get({0, LAYER, 0})->frames[0].duration == 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);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user