Merge branch 'staging'
This commit is contained in:
@@ -488,10 +488,10 @@ namespace anm2ed::imgui
|
||||
|
||||
auto center_view = [&]() { pan = vec2(); };
|
||||
|
||||
auto fit_view = [&]()
|
||||
{
|
||||
if (animation) set_to_rect(zoom, pan, animation->rect(isRootTransform));
|
||||
};
|
||||
auto fit_view = [&]()
|
||||
{
|
||||
if (animation) set_to_rect(zoom, pan, anm2.animation_rect(*animation, isRootTransform));
|
||||
};
|
||||
|
||||
auto zoom_adjust = [&](float delta)
|
||||
{
|
||||
@@ -627,7 +627,7 @@ namespace anm2ed::imgui
|
||||
savedZoom = zoom;
|
||||
savedPan = pan;
|
||||
|
||||
if (auto rect = document.animation_get()->rect(isRootTransform); rect != vec4(-1.0f))
|
||||
if (auto rect = anm2.animation_rect(*document.animation_get(), isRootTransform); rect != vec4(-1.0f))
|
||||
{
|
||||
size_set(vec2(rect.z, rect.w) * settings.renderScale);
|
||||
set_to_rect(zoom, pan, rect);
|
||||
@@ -779,9 +779,11 @@ namespace anm2ed::imgui
|
||||
|
||||
for (auto& id : animation->layerOrder)
|
||||
{
|
||||
if (!animation->layerAnimations.contains(id)) continue;
|
||||
auto& layerAnimation = animation->layerAnimations[id];
|
||||
if (!layerAnimation.isVisible) continue;
|
||||
|
||||
if (!anm2.content.layers.contains(id)) continue;
|
||||
auto& layer = anm2.content.layers.at(id);
|
||||
|
||||
auto spritesheet = anm2.spritesheet_get(layer.spritesheetID);
|
||||
@@ -797,21 +799,11 @@ namespace anm2ed::imgui
|
||||
auto texSize = vec2(texture.size);
|
||||
if (texSize.x <= 0.0f || texSize.y <= 0.0f) return;
|
||||
|
||||
frame = anm2.frame_effective(id, frame);
|
||||
auto crop = frame.crop;
|
||||
auto size = frame.size;
|
||||
auto pivot = frame.pivot;
|
||||
|
||||
if (frame.regionID != -1)
|
||||
{
|
||||
auto regionIt = spritesheet->regions.find(frame.regionID);
|
||||
if (regionIt != spritesheet->regions.end())
|
||||
{
|
||||
crop = regionIt->second.crop;
|
||||
size = regionIt->second.size;
|
||||
pivot = regionIt->second.pivot;
|
||||
}
|
||||
}
|
||||
|
||||
auto layerModel =
|
||||
math::quad_model_get(size, frame.position, pivot, math::percent_to_unit(frame.scale), frame.rotation);
|
||||
auto layerTransform = sampleTransform * layerModel;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "events.hpp"
|
||||
|
||||
#include <format>
|
||||
#include <ranges>
|
||||
|
||||
#include "log.hpp"
|
||||
|
||||
@@ -42,6 +42,9 @@ namespace anm2ed::imgui
|
||||
{
|
||||
auto frame = document.frame_get();
|
||||
auto useFrame = frame ? *frame : anm2::Frame();
|
||||
auto displayFrame = frame && type == anm2::LAYER && document.reference.itemID != -1
|
||||
? document.anm2.frame_effective(document.reference.itemID, *frame)
|
||||
: useFrame;
|
||||
|
||||
ImGui::BeginDisabled(!frame);
|
||||
{
|
||||
@@ -112,18 +115,20 @@ namespace anm2ed::imgui
|
||||
bool isRegionSet = frame && frame->regionID != -1;
|
||||
ImGui::BeginDisabled(type == anm2::ROOT || type == anm2::NULL_ || isRegionSet);
|
||||
{
|
||||
auto cropDisplay = frame ? displayFrame.crop : vec2();
|
||||
auto cropEdit =
|
||||
drag_float2_persistent(localize.get(BASIC_CROP), frame ? &frame->crop : &dummy_value<vec2>(),
|
||||
DRAG_SPEED, 0.0f, 0.0f, frame ? vec2_format_get(frame->crop) : "");
|
||||
drag_float2_persistent(localize.get(BASIC_CROP), frame ? &cropDisplay : &dummy_value<vec2>(),
|
||||
DRAG_SPEED, 0.0f, 0.0f, frame ? vec2_format_get(displayFrame.crop) : "");
|
||||
if (cropEdit == edit::START)
|
||||
document.snapshot(localize.get(EDIT_FRAME_CROP));
|
||||
else if (cropEdit == edit::END)
|
||||
document.change(Document::FRAMES);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_CROP));
|
||||
|
||||
auto sizeDisplay = frame ? displayFrame.size : vec2();
|
||||
auto sizeEdit =
|
||||
drag_float2_persistent(localize.get(BASIC_SIZE), frame ? &frame->size : &dummy_value<vec2>(),
|
||||
DRAG_SPEED, 0.0f, 0.0f, frame ? vec2_format_get(frame->size) : "");
|
||||
drag_float2_persistent(localize.get(BASIC_SIZE), frame ? &sizeDisplay : &dummy_value<vec2>(),
|
||||
DRAG_SPEED, 0.0f, 0.0f, frame ? vec2_format_get(displayFrame.size) : "");
|
||||
if (sizeEdit == edit::START)
|
||||
document.snapshot(localize.get(EDIT_FRAME_SIZE));
|
||||
else if (sizeEdit == edit::END)
|
||||
@@ -143,9 +148,10 @@ namespace anm2ed::imgui
|
||||
|
||||
ImGui::BeginDisabled(type == anm2::ROOT || type == anm2::NULL_ || isRegionSet);
|
||||
{
|
||||
auto pivotDisplay = frame ? displayFrame.pivot : vec2();
|
||||
auto pivotEdit =
|
||||
drag_float2_persistent(localize.get(BASIC_PIVOT), frame ? &frame->pivot : &dummy_value<vec2>(),
|
||||
DRAG_SPEED, 0.0f, 0.0f, frame ? vec2_format_get(frame->pivot) : "");
|
||||
drag_float2_persistent(localize.get(BASIC_PIVOT), frame ? &pivotDisplay : &dummy_value<vec2>(),
|
||||
DRAG_SPEED, 0.0f, 0.0f, frame ? vec2_format_get(displayFrame.pivot) : "");
|
||||
if (pivotEdit == edit::START)
|
||||
document.snapshot(localize.get(EDIT_FRAME_PIVOT));
|
||||
else if (pivotEdit == edit::END)
|
||||
@@ -201,7 +207,11 @@ namespace anm2ed::imgui
|
||||
regionIds, regionLabels) &&
|
||||
frame)
|
||||
DOCUMENT_EDIT(document, localize.get(EDIT_SET_REGION_PROPERTIES), Document::FRAMES,
|
||||
frame->regionID = useFrame.regionID);
|
||||
frame->regionID = useFrame.regionID;
|
||||
auto effectiveFrame = document.anm2.frame_effective(document.reference.itemID, *frame);
|
||||
frame->crop = effectiveFrame.crop;
|
||||
frame->size = effectiveFrame.size;
|
||||
frame->pivot = effectiveFrame.pivot);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_REGION));
|
||||
ImGui::EndDisabled();
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "layers.hpp"
|
||||
|
||||
#include <format>
|
||||
#include <ranges>
|
||||
|
||||
#include "log.hpp"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "nulls.hpp"
|
||||
|
||||
#include <format>
|
||||
#include <ranges>
|
||||
|
||||
#include "log.hpp"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "sounds.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <format>
|
||||
#include <ranges>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -185,6 +185,7 @@ namespace anm2ed::imgui
|
||||
auto baseID = *mergeSelection.begin();
|
||||
if (anm2.spritesheets_merge(mergeSelection, (anm2::SpritesheetMergeOrigin)settings.mergeSpritesheetsOrigin,
|
||||
settings.mergeSpritesheetsIsMakeRegions,
|
||||
settings.mergeSpritesheetsIsMakePrimaryRegion,
|
||||
(origin::Type)settings.mergeSpritesheetsRegionOrigin))
|
||||
{
|
||||
selection = {baseID};
|
||||
@@ -594,7 +595,7 @@ namespace anm2ed::imgui
|
||||
mergePopup.close();
|
||||
};
|
||||
|
||||
auto optionsSize = child_size_get(5);
|
||||
auto optionsSize = child_size_get(6);
|
||||
if (ImGui::BeginChild("##Merge Spritesheets Options", optionsSize, ImGuiChildFlags_Borders))
|
||||
{
|
||||
ImGui::SeparatorText(localize.get(LABEL_REGION_PROPERTIES_ORIGIN));
|
||||
@@ -610,9 +611,13 @@ namespace anm2ed::imgui
|
||||
ImGui::Checkbox(localize.get(LABEL_MERGE_MAKE_SPRITESHEET_REGIONS), &settings.mergeSpritesheetsIsMakeRegions);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_MERGE_MAKE_SPRITESHEET_REGIONS));
|
||||
|
||||
ImGui::BeginDisabled(!settings.mergeSpritesheetsIsMakeRegions);
|
||||
ImGui::Checkbox(localize.get(LABEL_MERGE_MAKE_PRIMARY_SPRITESHEET_REGION),
|
||||
&settings.mergeSpritesheetsIsMakePrimaryRegion);
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_MERGE_MAKE_PRIMARY_SPRITESHEET_REGION));
|
||||
|
||||
const char* regionOriginOptions[] = {localize.get(LABEL_REGION_ORIGIN_TOP_LEFT),
|
||||
localize.get(LABEL_REGION_ORIGIN_CENTER)};
|
||||
ImGui::BeginDisabled(!settings.mergeSpritesheetsIsMakeRegions);
|
||||
ImGui::Combo(localize.get(LABEL_REGION_PROPERTIES_ORIGIN), &settings.mergeSpritesheetsRegionOrigin,
|
||||
regionOriginOptions, IM_ARRAYSIZE(regionOriginOptions));
|
||||
ImGui::EndDisabled();
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <format>
|
||||
|
||||
#include <imgui_internal.h>
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "welcome.hpp"
|
||||
|
||||
#include <format>
|
||||
#include <ranges>
|
||||
|
||||
#include "path_.hpp"
|
||||
|
||||
Reference in New Issue
Block a user