fixing that old ugly error icon + red

This commit is contained in:
2025-11-19 15:55:26 -05:00
parent e655cdf6d3
commit fbcf79da80
6 changed files with 29 additions and 22 deletions

View File

@@ -264,7 +264,7 @@ namespace anm2ed::imgui
auto& count = settings.generateCount;
auto& delay = settings.generateDelay;
auto& zoom = settings.generateZoom;
auto& zoomStep = settings.viewZoomStep;
auto& zoomStep = settings.inputZoomStep;
auto childSize = ImVec2(row_widget_width_get(2), size_without_footer_get().y);
@@ -396,15 +396,14 @@ namespace anm2ed::imgui
ImGui::SetItemTooltip("If changed, will autosave documents using this interval.");
ImGui::EndDisabled();
ImGui::SeparatorText("Options");
ImGui::Checkbox("Overwrite Warning", &editSettings.fileIsWarnOverwrite);
ImGui::SetItemTooltip("A warning will be shown when saving a file.");
ImGui::SeparatorText("Snapshots");
input_int_range("Stack Size", editSettings.fileSnapshotStackSize, 0, 1000);
ImGui::SetItemTooltip("Set the maximum snapshot stack size of a document\n(i.e., how many undo/redos are "
ImGui::SetItemTooltip("Set the maximum snapshot stack size of a document (i.e., how many undo/redos are "
"preserved at a time).");
ImGui::SeparatorText("Options");
ImGui::Checkbox("Overwrite Warning", &editSettings.fileIsWarnOverwrite);
ImGui::SetItemTooltip("A warning will be shown when saving/overwriting a file.");
}
ImGui::EndChild();
@@ -427,8 +426,14 @@ namespace anm2ed::imgui
ImGui::SeparatorText("Zoom");
input_float_range("Step", editSettings.viewZoomStep, 10.0f, 250.0f, 10.0f, 10.0f, "%.0f%%");
input_float_range("Step", editSettings.inputZoomStep, 10.0f, 250.0f, 10.0f, 10.0f, "%.0f%%");
ImGui::SetItemTooltip("When zooming in/out with mouse or shortcut, this value will be used.");
ImGui::SeparatorText("Tool");
ImGui::Checkbox("Move Tool: Snap to Mouse", &editSettings.inputIsMoveToolSnapToMouse);
ImGui::SetItemTooltip("In Animation Preview, the Move tool will snap the frame's position right to the "
"cursor, instead of being moved at a distance.");
}
ImGui::EndChild();

View File

@@ -195,7 +195,7 @@ namespace anm2ed::imgui
auto& gridColor = settings.previewGridColor;
auto& gridSize = settings.previewGridSize;
auto& gridOffset = settings.previewGridOffset;
auto& zoomStep = settings.viewZoomStep;
auto& zoomStep = settings.inputZoomStep;
auto& isGrid = settings.previewIsGrid;
auto& overlayTransparency = settings.previewOverlayTransparency;
auto& overlayIndex = document.overlayIndex;
@@ -661,14 +661,11 @@ namespace anm2ed::imgui
document.snapshot("Frame Position");
if (isMouseClicked)
{
moveOffset = mousePos - frame->position;
moveOffset = settings.inputIsMoveToolSnapToMouse ? vec2() : mousePos - frame->position;
isMoveDragging = true;
}
}
if (isMouseDown && isMoveDragging)
{
frame->position = ivec2(mousePos - moveOffset);
}
if (isMouseDown && isMoveDragging) frame->position = ivec2(mousePos - moveOffset);
if (isLeftPressed) frame->position.x -= step;
if (isRightPressed) frame->position.x += step;
if (isUpPressed) frame->position.y -= step;

View File

@@ -41,7 +41,7 @@ namespace anm2ed::imgui
auto& toolColor = settings.toolColor;
auto& isGrid = settings.editorIsGrid;
auto& isGridSnap = settings.editorIsGridSnap;
auto& zoomStep = settings.viewZoomStep;
auto& zoomStep = settings.inputZoomStep;
auto& isBorder = settings.editorIsBorder;
auto& isTransparent = settings.editorIsTransparent;
auto spritesheet = document.spritesheet_get();

View File

@@ -95,7 +95,11 @@ namespace anm2ed::imgui
auto isSelected = selection.contains(id);
auto isReferenced = id == reference;
auto cursorPos = ImGui::GetCursorPos();
auto& texture = spritesheet.texture.is_valid() ? spritesheet.texture : resources.icons[icon::NONE];
bool isTextureValid = spritesheet.texture.is_valid();
auto& texture = isTextureValid ? spritesheet.texture : resources.icons[icon::NONE];
auto textureRef = ImTextureRef(texture.id);
auto tintColor =
!isTextureValid ? ImVec4(1.0f, 0.25f, 0.25f, 1.0f) : ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
const std::string pathString =
spritesheet.path.empty() ? std::string{anm2::NO_PATH} : spritesheet.path.string();
const char* pathCStr = pathString.c_str();
@@ -134,14 +138,14 @@ namespace anm2ed::imgui
auto noScrollFlags = ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse;
if (ImGui::BeginChild("##Spritesheet Tooltip Image Child", to_imvec2(textureSize), childFlags,
noScrollFlags))
ImGui::Image(texture.id, to_imvec2(textureSize));
ImGui::ImageWithBg(textureRef, to_imvec2(textureSize), ImVec2(), ImVec2(1, 1), ImVec4(), tintColor);
ImGui::EndChild();
ImGui::PopStyleVar();
ImGui::SameLine();
auto infoChildFlags = ImGuiChildFlags_AutoResizeX | ImGuiChildFlags_AutoResizeY;
if (ImGui::BeginChild("##Spritesheet Info Tooltip Child", ImVec2(0, 0), infoChildFlags, noScrollFlags))
if (ImGui::BeginChild("##Spritesheet Info Tooltip Child", ImVec2(), infoChildFlags, noScrollFlags))
{
ImGui::PushFont(resources.fonts[font::BOLD].get(), font::SIZE);
ImGui::TextUnformatted(pathCStr);
@@ -149,7 +153,7 @@ namespace anm2ed::imgui
ImGui::Text("ID: %d", id);
if (!spritesheet.texture.is_valid())
if (!isTextureValid)
ImGui::Text("This spritesheet isn't valid!\nLoad an existing, valid texture.");
else
ImGui::Text("Size: %d x %d", texture.size.x, texture.size.y);
@@ -169,7 +173,7 @@ namespace anm2ed::imgui
imageSize.y = imageSize.x / aspectRatio;
ImGui::SetCursorPos(cursorPos);
ImGui::Image(texture.id, imageSize);
ImGui::ImageWithBg(textureRef, imageSize, ImVec2(), ImVec2(1, 1), ImVec4(), tintColor);
ImGui::SetCursorPos(
ImVec2(spritesheetChildSize.y + style.ItemSpacing.x,