Fix issue with frame deselection on spritesheet editor (???) + work on themes
This commit is contained in:
@@ -12,6 +12,23 @@ using namespace glm;
|
||||
|
||||
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)
|
||||
{
|
||||
if (data->EventFlag == ImGuiInputTextFlags_CallbackResize)
|
||||
@@ -90,8 +107,7 @@ namespace anm2ed::imgui
|
||||
{
|
||||
if (ImGui::Selectable(label.c_str(), isSelected, flags)) isActivated = true;
|
||||
|
||||
if (isBeginEditing ||
|
||||
(ImGui::IsWindowFocused() && ImGui::IsKeyPressed(ImGuiKey_F2) && isSelected) ||
|
||||
if (isBeginEditing || (ImGui::IsWindowFocused() && ImGui::IsKeyPressed(ImGuiKey_F2) && isSelected) ||
|
||||
(ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)))
|
||||
{
|
||||
editID = id;
|
||||
@@ -298,7 +314,7 @@ namespace anm2ed::imgui
|
||||
{
|
||||
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
|
||||
: ImGuiInputFlags_RouteFocused;
|
||||
|
||||
@@ -154,6 +154,7 @@ namespace anm2ed::imgui
|
||||
{"Super", ImGuiMod_Super},
|
||||
};
|
||||
|
||||
void theme_set(types::theme::Type theme);
|
||||
std::string chord_to_string(ImGuiKeyChord);
|
||||
ImGuiKeyChord string_to_chord(const std::string&);
|
||||
float row_widget_width_get(int, float = ImGui::GetContentRegionAvail().x);
|
||||
|
||||
@@ -367,6 +367,15 @@ namespace anm2ed::imgui
|
||||
|
||||
ImGui::Checkbox("Vsync", &editSettings.isVsync);
|
||||
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();
|
||||
|
||||
@@ -492,6 +501,7 @@ namespace anm2ed::imgui
|
||||
if (ImGui::Button("Save", widgetSize))
|
||||
{
|
||||
settings = editSettings;
|
||||
imgui::theme_set((theme::Type)editSettings.theme);
|
||||
manager.chords_set(settings);
|
||||
configurePopup.close();
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ namespace anm2ed::imgui
|
||||
auto cursor = areaType == tool::ANIMATION_PREVIEW || areaType == tool::ALL ? tool::INFO[useTool].cursor
|
||||
: ImGuiMouseCursor_NotAllowed;
|
||||
ImGui::SetMouseCursor(cursor);
|
||||
ImGui::SetKeyboardFocusHere(-1);
|
||||
ImGui::SetKeyboardFocusHere();
|
||||
|
||||
switch (useTool)
|
||||
{
|
||||
|
||||
@@ -258,7 +258,7 @@ namespace anm2ed::imgui
|
||||
auto cursor = areaType == tool::SPRITESHEET_EDITOR || areaType == tool::ALL ? tool::INFO[useTool].cursor
|
||||
: ImGuiMouseCursor_NotAllowed;
|
||||
ImGui::SetMouseCursor(cursor);
|
||||
ImGui::SetKeyboardFocusHere(-1);
|
||||
ImGui::SetKeyboardFocusHere();
|
||||
|
||||
switch (useTool)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,6 @@ using namespace glm;
|
||||
namespace anm2ed::imgui
|
||||
{
|
||||
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_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);
|
||||
@@ -249,7 +248,9 @@ namespace anm2ed::imgui
|
||||
ImGui::Image(resources.icons[icon].id, icon_size_get());
|
||||
ImGui::SameLine();
|
||||
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::PopStyleColor();
|
||||
if (isReferenced) ImGui::PopFont();
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4());
|
||||
@@ -483,7 +484,7 @@ namespace anm2ed::imgui
|
||||
{
|
||||
drawList->AddRectFilled(cursorScreenPos,
|
||||
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++)
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace anm2ed::imgui
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user