Fix issue with frame deselection on spritesheet editor (???) + work on themes
This commit is contained in:
@@ -28,15 +28,15 @@ namespace anm2ed::anm2
|
|||||||
for (auto child = layerAnimationsElement->FirstChildElement("LayerAnimation"); child;
|
for (auto child = layerAnimationsElement->FirstChildElement("LayerAnimation"); child;
|
||||||
child = child->NextSiblingElement("LayerAnimation"))
|
child = child->NextSiblingElement("LayerAnimation"))
|
||||||
{
|
{
|
||||||
layerAnimations[id] = Item(child, LAYER, &id);
|
layerAnimations.emplace(id, Item(child, LAYER, &id));
|
||||||
layerOrder.push_back(id);
|
layerOrder.emplace_back(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto nullAnimationsElement = element->FirstChildElement("NullAnimations"))
|
if (auto nullAnimationsElement = element->FirstChildElement("NullAnimations"))
|
||||||
for (auto child = nullAnimationsElement->FirstChildElement("NullAnimation"); child;
|
for (auto child = nullAnimationsElement->FirstChildElement("NullAnimation"); child;
|
||||||
child = child->NextSiblingElement("NullAnimation"))
|
child = child->NextSiblingElement("NullAnimation"))
|
||||||
nullAnimations[id] = Item(child, NULL_, &id);
|
nullAnimations.emplace(id, Item(child, NULL_, &id));
|
||||||
|
|
||||||
if (auto triggersElement = element->FirstChildElement("Triggers")) triggers = Item(triggersElement, TRIGGER);
|
if (auto triggersElement = element->FirstChildElement("Triggers")) triggers = Item(triggersElement, TRIGGER);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,27 +7,26 @@ namespace anm2ed::anm2
|
|||||||
Content::Content(XMLElement* element)
|
Content::Content(XMLElement* element)
|
||||||
{
|
{
|
||||||
int id{};
|
int id{};
|
||||||
|
|
||||||
if (auto spritesheetsElement = element->FirstChildElement("Spritesheets"))
|
if (auto spritesheetsElement = element->FirstChildElement("Spritesheets"))
|
||||||
for (auto child = spritesheetsElement->FirstChildElement("Spritesheet"); child;
|
for (auto child = spritesheetsElement->FirstChildElement("Spritesheet"); child;
|
||||||
child = child->NextSiblingElement("Spritesheet"))
|
child = child->NextSiblingElement("Spritesheet"))
|
||||||
spritesheets[id] = Spritesheet(child, id);
|
spritesheets.emplace(id, Spritesheet(child, id));
|
||||||
|
|
||||||
if (auto layersElement = element->FirstChildElement("Layers"))
|
if (auto layersElement = element->FirstChildElement("Layers"))
|
||||||
for (auto child = layersElement->FirstChildElement("Layer"); child; child = child->NextSiblingElement("Layer"))
|
for (auto child = layersElement->FirstChildElement("Layer"); child; child = child->NextSiblingElement("Layer"))
|
||||||
layers[id] = Layer(child, id);
|
layers.emplace(id, Layer(child, id));
|
||||||
|
|
||||||
if (auto nullsElement = element->FirstChildElement("Nulls"))
|
if (auto nullsElement = element->FirstChildElement("Nulls"))
|
||||||
for (auto child = nullsElement->FirstChildElement("Null"); child; child = child->NextSiblingElement("Null"))
|
for (auto child = nullsElement->FirstChildElement("Null"); child; child = child->NextSiblingElement("Null"))
|
||||||
nulls[id] = Null(child, id);
|
nulls.emplace(id, Null(child, id));
|
||||||
|
|
||||||
if (auto eventsElement = element->FirstChildElement("Events"))
|
if (auto eventsElement = element->FirstChildElement("Events"))
|
||||||
for (auto child = eventsElement->FirstChildElement("Event"); child; child = child->NextSiblingElement("Event"))
|
for (auto child = eventsElement->FirstChildElement("Event"); child; child = child->NextSiblingElement("Event"))
|
||||||
events[id] = Event(child, id);
|
events.emplace(id, Event(child, id));
|
||||||
|
|
||||||
if (auto eventsElement = element->FirstChildElement("Sounds"))
|
if (auto soundsElement = element->FirstChildElement("Sounds"))
|
||||||
for (auto child = eventsElement->FirstChildElement("Sound"); child; child = child->NextSiblingElement("Sound"))
|
for (auto child = soundsElement->FirstChildElement("Sound"); child; child = child->NextSiblingElement("Sound"))
|
||||||
sounds[id] = Sound(child, id);
|
sounds.emplace(id, Sound(child, id));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Content::serialize(XMLDocument& document, XMLElement* parent)
|
void Content::serialize(XMLDocument& document, XMLElement* parent)
|
||||||
|
|||||||
@@ -12,6 +12,23 @@ using namespace glm;
|
|||||||
|
|
||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
|
void theme_set(theme::Type theme)
|
||||||
|
{
|
||||||
|
switch (theme)
|
||||||
|
{
|
||||||
|
case theme::LIGHT:
|
||||||
|
ImGui::StyleColorsLight();
|
||||||
|
break;
|
||||||
|
case theme::DARK:
|
||||||
|
default:
|
||||||
|
ImGui::StyleColorsDark();
|
||||||
|
break;
|
||||||
|
case theme::CLASSIC:
|
||||||
|
ImGui::StyleColorsClassic();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int input_text_callback(ImGuiInputTextCallbackData* data)
|
int input_text_callback(ImGuiInputTextCallbackData* data)
|
||||||
{
|
{
|
||||||
if (data->EventFlag == ImGuiInputTextFlags_CallbackResize)
|
if (data->EventFlag == ImGuiInputTextFlags_CallbackResize)
|
||||||
@@ -90,8 +107,7 @@ namespace anm2ed::imgui
|
|||||||
{
|
{
|
||||||
if (ImGui::Selectable(label.c_str(), isSelected, flags)) isActivated = true;
|
if (ImGui::Selectable(label.c_str(), isSelected, flags)) isActivated = true;
|
||||||
|
|
||||||
if (isBeginEditing ||
|
if (isBeginEditing || (ImGui::IsWindowFocused() && ImGui::IsKeyPressed(ImGuiKey_F2) && isSelected) ||
|
||||||
(ImGui::IsWindowFocused() && ImGui::IsKeyPressed(ImGuiKey_F2) && isSelected) ||
|
|
||||||
(ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)))
|
(ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)))
|
||||||
{
|
{
|
||||||
editID = id;
|
editID = id;
|
||||||
@@ -298,7 +314,7 @@ namespace anm2ed::imgui
|
|||||||
{
|
{
|
||||||
if (ImGui::GetTopMostPopupModal() != nullptr) return false;
|
if (ImGui::GetTopMostPopupModal() != nullptr) return false;
|
||||||
|
|
||||||
if (isRepeat && (type == shortcut::GLOBAL || type == shortcut::FOCUSED)) return chord_repeating(chord);
|
if (isRepeat) return chord_repeating(chord);
|
||||||
|
|
||||||
int flags = type == shortcut::GLOBAL || type == shortcut::GLOBAL_SET ? ImGuiInputFlags_RouteGlobal
|
int flags = type == shortcut::GLOBAL || type == shortcut::GLOBAL_SET ? ImGuiInputFlags_RouteGlobal
|
||||||
: ImGuiInputFlags_RouteFocused;
|
: ImGuiInputFlags_RouteFocused;
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ namespace anm2ed::imgui
|
|||||||
{"Super", ImGuiMod_Super},
|
{"Super", ImGuiMod_Super},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void theme_set(types::theme::Type theme);
|
||||||
std::string chord_to_string(ImGuiKeyChord);
|
std::string chord_to_string(ImGuiKeyChord);
|
||||||
ImGuiKeyChord string_to_chord(const std::string&);
|
ImGuiKeyChord string_to_chord(const std::string&);
|
||||||
float row_widget_width_get(int, float = ImGui::GetContentRegionAvail().x);
|
float row_widget_width_get(int, float = ImGui::GetContentRegionAvail().x);
|
||||||
|
|||||||
@@ -367,6 +367,15 @@ namespace anm2ed::imgui
|
|||||||
|
|
||||||
ImGui::Checkbox("Vsync", &editSettings.isVsync);
|
ImGui::Checkbox("Vsync", &editSettings.isVsync);
|
||||||
ImGui::SetItemTooltip("Toggle vertical sync; synchronizes program update rate with monitor refresh rate.");
|
ImGui::SetItemTooltip("Toggle vertical sync; synchronizes program update rate with monitor refresh rate.");
|
||||||
|
|
||||||
|
ImGui::SeparatorText("Theme");
|
||||||
|
|
||||||
|
for (int i = 0; i < theme::COUNT; i++)
|
||||||
|
{
|
||||||
|
if (i == theme::LIGHT) continue; // TODO; light mode is jank rn so i am soft disabling it
|
||||||
|
ImGui::RadioButton(theme::STRINGS[i], &editSettings.theme, i);
|
||||||
|
ImGui::SameLine();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
|
|
||||||
@@ -492,6 +501,7 @@ namespace anm2ed::imgui
|
|||||||
if (ImGui::Button("Save", widgetSize))
|
if (ImGui::Button("Save", widgetSize))
|
||||||
{
|
{
|
||||||
settings = editSettings;
|
settings = editSettings;
|
||||||
|
imgui::theme_set((theme::Type)editSettings.theme);
|
||||||
manager.chords_set(settings);
|
manager.chords_set(settings);
|
||||||
configurePopup.close();
|
configurePopup.close();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -563,7 +563,7 @@ namespace anm2ed::imgui
|
|||||||
auto cursor = areaType == tool::ANIMATION_PREVIEW || areaType == tool::ALL ? tool::INFO[useTool].cursor
|
auto cursor = areaType == tool::ANIMATION_PREVIEW || areaType == tool::ALL ? tool::INFO[useTool].cursor
|
||||||
: ImGuiMouseCursor_NotAllowed;
|
: ImGuiMouseCursor_NotAllowed;
|
||||||
ImGui::SetMouseCursor(cursor);
|
ImGui::SetMouseCursor(cursor);
|
||||||
ImGui::SetKeyboardFocusHere(-1);
|
ImGui::SetKeyboardFocusHere();
|
||||||
|
|
||||||
switch (useTool)
|
switch (useTool)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ namespace anm2ed::imgui
|
|||||||
auto cursor = areaType == tool::SPRITESHEET_EDITOR || areaType == tool::ALL ? tool::INFO[useTool].cursor
|
auto cursor = areaType == tool::SPRITESHEET_EDITOR || areaType == tool::ALL ? tool::INFO[useTool].cursor
|
||||||
: ImGuiMouseCursor_NotAllowed;
|
: ImGuiMouseCursor_NotAllowed;
|
||||||
ImGui::SetMouseCursor(cursor);
|
ImGui::SetMouseCursor(cursor);
|
||||||
ImGui::SetKeyboardFocusHere(-1);
|
ImGui::SetKeyboardFocusHere();
|
||||||
|
|
||||||
switch (useTool)
|
switch (useTool)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ using namespace glm;
|
|||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
constexpr auto COLOR_HIDDEN_MULTIPLIER = vec4(0.5f, 0.5f, 0.5f, 1.000f);
|
constexpr auto COLOR_HIDDEN_MULTIPLIER = vec4(0.5f, 0.5f, 0.5f, 1.000f);
|
||||||
constexpr auto FRAME_TIMELINE_COLOR = ImVec4(0.106f, 0.184f, 0.278f, 1.000f);
|
|
||||||
constexpr auto FRAME_BORDER_COLOR = ImVec4(1.0f, 1.0f, 1.0f, 0.15f);
|
constexpr auto FRAME_BORDER_COLOR = ImVec4(1.0f, 1.0f, 1.0f, 0.15f);
|
||||||
constexpr auto FRAME_BORDER_COLOR_REFERENCED = ImVec4(1.0f, 1.0f, 1.0f, 0.50f);
|
constexpr auto FRAME_BORDER_COLOR_REFERENCED = ImVec4(1.0f, 1.0f, 1.0f, 0.50f);
|
||||||
constexpr auto FRAME_MULTIPLE_OVERLAY_COLOR = ImVec4(1.0f, 1.0f, 1.0f, 0.05f);
|
constexpr auto FRAME_MULTIPLE_OVERLAY_COLOR = ImVec4(1.0f, 1.0f, 1.0f, 0.05f);
|
||||||
@@ -249,7 +248,9 @@ namespace anm2ed::imgui
|
|||||||
ImGui::Image(resources.icons[icon].id, icon_size_get());
|
ImGui::Image(resources.icons[icon].id, icon_size_get());
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (isReferenced) ImGui::PushFont(resources.fonts[font::BOLD].get(), font::SIZE);
|
if (isReferenced) ImGui::PushFont(resources.fonts[font::BOLD].get(), font::SIZE);
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text, to_imvec4(color::WHITE));
|
||||||
ImGui::TextUnformatted(label.c_str());
|
ImGui::TextUnformatted(label.c_str());
|
||||||
|
ImGui::PopStyleColor();
|
||||||
if (isReferenced) ImGui::PopFont();
|
if (isReferenced) ImGui::PopFont();
|
||||||
|
|
||||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4());
|
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4());
|
||||||
@@ -483,7 +484,7 @@ namespace anm2ed::imgui
|
|||||||
{
|
{
|
||||||
drawList->AddRectFilled(cursorScreenPos,
|
drawList->AddRectFilled(cursorScreenPos,
|
||||||
ImVec2(cursorScreenPos.x + framesSize.x, cursorScreenPos.y + framesSize.y),
|
ImVec2(cursorScreenPos.x + framesSize.x, cursorScreenPos.y + framesSize.y),
|
||||||
ImGui::GetColorU32(FRAME_TIMELINE_COLOR));
|
ImGui::GetColorU32(ImGui::GetStyleColorVec4(ImGuiCol_Header)));
|
||||||
|
|
||||||
for (int i = frameMin; i < frameMax; i++)
|
for (int i = frameMin; i < frameMax; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace anm2ed::imgui
|
|||||||
|
|
||||||
if (isSelected) ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetStyleColorVec4(ImGuiCol_ButtonActive));
|
if (isSelected) ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetStyleColorVec4(ImGuiCol_ButtonActive));
|
||||||
|
|
||||||
if (shortcut(manager.chords[info.shortcut], shortcut::GLOBAL_SET)) tool_use((tool::Type)i);
|
if (shortcut(manager.chords[info.shortcut], shortcut::GLOBAL_SET, true)) tool_use((tool::Type)i);
|
||||||
|
|
||||||
if (i == tool::COLOR)
|
if (i == tool::COLOR)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
#include "filesystem_.h"
|
#include "filesystem_.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
|
#include "imgui_.h"
|
||||||
|
|
||||||
#include "socket.h"
|
#include "socket.h"
|
||||||
|
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
@@ -180,7 +182,12 @@ namespace anm2ed
|
|||||||
|
|
||||||
logger.info("Initialized Dear ImGui");
|
logger.info("Initialized Dear ImGui");
|
||||||
|
|
||||||
|
imgui::theme_set((theme::Type)settings.theme);
|
||||||
|
|
||||||
|
if (settings.theme == theme::DARK)
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
|
else if (settings.theme == theme::LIGHT)
|
||||||
|
ImGui::StyleColorsClassic();
|
||||||
|
|
||||||
ImGui_ImplSDL3_InitForOpenGL(window, glContext);
|
ImGui_ImplSDL3_InitForOpenGL(window, glContext);
|
||||||
ImGui_ImplOpenGL3_Init("#version 330");
|
ImGui_ImplOpenGL3_Init("#version 330");
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ namespace anm2ed
|
|||||||
X(WINDOW_SIZE, windowSize, "Window Size", IVEC2_WH, {1600, 900}) \
|
X(WINDOW_SIZE, windowSize, "Window Size", IVEC2_WH, {1600, 900}) \
|
||||||
X(IS_VSYNC, isVsync, "Vsync", BOOL, true) \
|
X(IS_VSYNC, isVsync, "Vsync", BOOL, true) \
|
||||||
X(UI_SCALE, uiScale, "UI Scale", FLOAT, 1.0f) \
|
X(UI_SCALE, uiScale, "UI Scale", FLOAT, 1.0f) \
|
||||||
|
X(THEME, theme, "Theme", INT, types::theme::DARK) \
|
||||||
\
|
\
|
||||||
X(FILE_IS_AUTOSAVE, fileIsAutosave, "Autosave", BOOL, true) \
|
X(FILE_IS_AUTOSAVE, fileIsAutosave, "Autosave", BOOL, true) \
|
||||||
X(FILE_AUTOSAVE_TIME, fileAutosaveTime, "Autosave Time", INT, 1) \
|
X(FILE_AUTOSAVE_TIME, fileAutosaveTime, "Autosave Time", INT, 1) \
|
||||||
|
|||||||
24
src/types.h
24
src/types.h
@@ -13,6 +13,30 @@ namespace anm2ed::types::draw_order
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace anm2ed::types::theme
|
||||||
|
{
|
||||||
|
#define THEMES \
|
||||||
|
X(LIGHT, "Light") \
|
||||||
|
X(DARK, "Dark") \
|
||||||
|
X(CLASSIC, "ImGui Classic")
|
||||||
|
|
||||||
|
enum Type
|
||||||
|
{
|
||||||
|
#define X(symbol, string) symbol,
|
||||||
|
THEMES
|
||||||
|
#undef X
|
||||||
|
COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr const char* STRINGS[] = {
|
||||||
|
#define X(symbol, string) string,
|
||||||
|
THEMES
|
||||||
|
#undef X
|
||||||
|
};
|
||||||
|
|
||||||
|
#undef THEMES
|
||||||
|
}
|
||||||
|
|
||||||
namespace anm2ed::types::shortcut
|
namespace anm2ed::types::shortcut
|
||||||
{
|
{
|
||||||
enum Type
|
enum Type
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ A reimplementation of [i]The Binding of Isaac: Rebirth[/i]'s proprietary animati
|
|||||||
[h2]Features[/h2]
|
[h2]Features[/h2]
|
||||||
[list]
|
[list]
|
||||||
[*] Extended version of the original proprietary Nicalis animation editor
|
[*] Extended version of the original proprietary Nicalis animation editor
|
||||||
[*] Smooth [Dear ImGui](https://github.com/ocornut/imgui) interface; docking, dragging and dropping, etc. You might be familiar with it from [Repentogon](https://repentogon.com/).
|
[*] Smooth [url=https://github.com/ocornut/imgui]Dear ImGui[/url] interface; docking, dragging and dropping, etc. You might be familiar with it from [url=https://repentogon.com/]Repentogon[/url].
|
||||||
[*] Greatly polished in many areas, to assist with all your animating needs
|
[*] Greatly polished in many areas, to assist with all your animating needs
|
||||||
[*]New features:
|
[*]New features:
|
||||||
[list]
|
[list]
|
||||||
@@ -40,6 +40,6 @@ Alternatively, if you have subscribed to the mod, you can find the latest releas
|
|||||||
[h3]Happy animating![/h3]
|
[h3]Happy animating![/h3]
|
||||||
[img]https://files.catbox.moe/4auc1c.gif[/img]
|
[img]https://files.catbox.moe/4auc1c.gif[/img]
|
||||||
</description>
|
</description>
|
||||||
<version>2.2</version>
|
<version>2.3</version>
|
||||||
<visibility>Public</visibility>
|
<visibility>Public</visibility>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
|||||||
Reference in New Issue
Block a user