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,

View File

@@ -10,7 +10,7 @@ namespace anm2ed::resource::icon
constexpr auto SIZE_HUGE = glm::ivec2(512, 512);
constexpr auto NONE_DATA = R"(
<svg viewBox="0 0 24 24" fill="#FFF" xmlns="http://www.w3.org/2000/svg"><path d="M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM11 15V17H13V15H11ZM11 7V13H13V7H11Z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#FFF"><path d="M10.5859 12L2.79297 4.20706L4.20718 2.79285L12.0001 10.5857L19.793 2.79285L21.2072 4.20706L13.4143 12L21.2072 19.7928L19.793 21.2071L12.0001 13.4142L4.20718 21.2071L2.79297 19.7928L10.5859 12Z"></path></svg>
)";
constexpr auto FILE_DATA = R"(

View File

@@ -54,7 +54,8 @@ namespace anm2ed
X(KEYBOARD_REPEAT_DELAY, keyboardRepeatDelay, "Repeat Delay", FLOAT, 0.300f) \
X(KEYBOARD_REPEAT_RATE, keyboardRepeatRate, "Repeat Rate", FLOAT, 0.050f) \
\
X(VIEW_ZOOM_STEP, viewZoomStep, "Zoom Step", FLOAT, 50.0f) \
X(INPUT_ZOOM_STEP, inputZoomStep, "Zoom Step", FLOAT, 50.0f) \
X(INPUT_IS_MOVE_TOOL_SNAP_TO_MOUSE, inputIsMoveToolSnapToMouse, "Move Tool: Snap to Mouse", BOOL, false) \
\
X(PLAYBACK_IS_LOOP, playbackIsLoop, "Loop", BOOL, true) \
X(PLAYBACK_IS_CLAMP, playbackIsClamp, "Clamp", BOOL, true) \