Skip to content

Commit

Permalink
Updated ImGui to ver 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Cooltomten committed Jan 6, 2024
1 parent e25e21d commit 10949f9
Show file tree
Hide file tree
Showing 70 changed files with 61,162 additions and 49,772 deletions.
7 changes: 4 additions & 3 deletions Volt/Sandbox/src/Sandbox/ImGuiRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ void Sandbox::DrawMenuBar()
const ImRect menuBarRect = { ImGui::GetCursorPos(), {ImGui::GetContentRegionAvail().x, ImGui::GetFrameHeightWithSpacing()} };

ImGui::BeginGroup();
ImGui::GetCurrentWindow()->DC.IsSameLine = false; // have to explicitly set this to false, otherwise the menu bar will be offset on y after the first menu since SameLine isnt supported by Selectable
if (UI::BeginMenuBar(menuBarRect))
{
if (ImGui::BeginMenu("File"))
Expand Down Expand Up @@ -575,7 +576,7 @@ void Sandbox::DrawMenuBar()

ImGui::EndMenu();
}

if (ImGui::BeginMenu("Edit"))
{
if (ImGui::MenuItem("Undo", "Ctrl + Z"))
Expand Down Expand Up @@ -729,7 +730,7 @@ void Sandbox::DrawMenuBar()
std::filesystem::path defaultPath = Volt::ProjectManager::GetAudioBanksDirectory();
std::vector<std::string> eventNames = Amp::WwiseAudioManager::GetAllEventNames(defaultPath);

Volt::EnumGenerator generator{ "WWiseEvents"};
Volt::EnumGenerator generator{ "WWiseEvents" };
for (auto& event : eventNames)
{
if (event.empty()) continue;
Expand Down Expand Up @@ -792,7 +793,7 @@ void Sandbox::SaveSceneAsModal()
}

const auto relPath = Volt::AssetManager::Get().GetRelativePath(destPath.string() + "\\" + mySaveSceneData.name + ".vtscene");

//myRuntimeScene->CopyTo(myRuntimeScene);
myRuntimeScene->handle = {};

Expand Down
3 changes: 2 additions & 1 deletion Volt/Sandbox/src/Sandbox/NodeGraph/IONodeGraphEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
#include <GraphKey/Nodes/CustomEventNode.h>
#include <GraphKey/TypeTraits.h>

#include <imgui_internal.h>
#define IMGUI_DEFINE_MATH_OPERATORS
#include <imgui.h>
#include <builders.h>
#include <typeindex>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <imgui_internal.h>
#define IMGUI_DEFINE_MATH_OPERATORS
#include <imgui.h>
#include "Sandbox/Utility/EditorResources.h"
#include "Volt/Rendering/Texture/Texture2D.h"
enum class IconType : ImU32
Expand Down Expand Up @@ -59,19 +60,19 @@ inline static void DrawIconKey(ImDrawList* drawList, const ImVec2& a, const ImVe
const auto tip_bottom = ImVec2(canvas_x + canvas_w * 0.5f, bottom);

drawList->PathLineTo(ImVec2(left, top) + ImVec2(0, rounding));
drawList->PathBezierCurveTo(
drawList->PathBezierCubicCurveTo(
ImVec2(left, top),
ImVec2(left, top),
ImVec2(left, top) + ImVec2(rounding, 0));
drawList->PathLineTo(tip_top);
drawList->PathLineTo(tip_top + (tip_right - tip_top) * tip_round);
drawList->PathBezierCurveTo(
drawList->PathBezierCubicCurveTo(
tip_right,
tip_right,
tip_bottom + (tip_right - tip_bottom) * tip_round);
drawList->PathLineTo(tip_bottom);
drawList->PathLineTo(ImVec2(left, bottom) + ImVec2(rounding, 0));
drawList->PathBezierCurveTo(
drawList->PathBezierCubicCurveTo(
ImVec2(left, bottom),
ImVec2(left, bottom),
ImVec2(left, bottom) - ImVec2(0, rounding));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "BehaviorEditor.h"
#include "BehaviorPanel.h"
#include <Volt/Asset/Importers/BehaviorTreeImporter.h>
#include <imgui_internal.h>
#include <builders.h>
#include <typeindex>
#include <Volt/Utility/UIUtility.h>
Expand Down
1 change: 0 additions & 1 deletion Volt/Sandbox/src/Sandbox/Window/ThemesPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ void ThemesPanel::SetMinecraftTheme()
style.Colors[ImGuiCol_ResizeGripActive] = ImVec4(0.4f, 0.67f, 1.000f, 1.000f);

style.Colors[ImGuiCol_Tab] = ImVec4(0.137f, 0.137f, 0.137f, 1.000f);
style.Colors[ImGuiCol_TabTop] = ImVec4(0.4f, 0.67f, 1.000f, 1.000f);
style.Colors[ImGuiCol_TabHovered] = ImVec4(0.352f, 0.352f, 0.352f, 1.000f);
style.Colors[ImGuiCol_TabActive] = ImVec4(0.258f, 0.258f, 0.258f, 1.000f);
style.Colors[ImGuiCol_TabUnfocused] = ImVec4(0.137f, 0.137f, 0.137f, 1.000f);
Expand Down
2 changes: 1 addition & 1 deletion Volt/Sandbox/src/Sandbox/Window/Timeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ void Timeline::DrawClipsOnTrack(int trackIndex)

drawlist->AddRectFilledMultiColor(blendMinPos, blendMaxPos, IM_COL32(100, 100, 100, 90), IM_COL32(100, 100, 100, 90), IM_COL32(50, 50, 50, 90), IM_COL32(50, 50, 50, 90));

drawlist->AddBezierCurve(blendMinPos, ImVec2(blendXMidPos, blendMaxPos.y), ImVec2(blendXMidPos, blendMinPos.y), blendMaxPos, IM_COL32(255, 255, 255, 90), 1);
drawlist->AddBezierCubic(blendMinPos, ImVec2(blendXMidPos, blendMaxPos.y), ImVec2(blendXMidPos, blendMinPos.y), blendMaxPos, IM_COL32(255, 255, 255, 90), 1);
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions Volt/Sandbox/src/sbpch.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@

#include <glm/glm.hpp>
#include <Volt/Log/Log.h>

#define IMGUI_DEFINE_MATH_OPERATORS
1 change: 0 additions & 1 deletion Volt/Volt/src/Volt/ImGui/ImGuiImplementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ namespace Volt
style.Colors[ImGuiCol_ResizeGripActive] = ImVec4(0.4f, 0.67f, 1.000f, 1.000f);

style.Colors[ImGuiCol_Tab] = ImVec4(0.137f, 0.137f, 0.137f, 1.000f);
style.Colors[ImGuiCol_TabTop] = ImVec4(0.4f, 0.67f, 1.000f, 1.000f);
style.Colors[ImGuiCol_TabHovered] = ImVec4(0.352f, 0.352f, 0.352f, 1.000f);
style.Colors[ImGuiCol_TabActive] = ImVec4(0.258f, 0.258f, 0.258f, 1.000f);
style.Colors[ImGuiCol_TabUnfocused] = ImVec4(0.137f, 0.137f, 0.137f, 1.000f);
Expand Down
4 changes: 2 additions & 2 deletions Volt/Volt/src/Volt/ImGui/ImGuiImplementation.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "Volt/Core/Base.h"

#define IMGUI_DEFINE_MATH_OPERATORS
#include <imgui.h>

struct GLFWwindow;
Expand All @@ -26,4 +26,4 @@ namespace Volt
ImFont* myFont = nullptr;
GLFWwindow* myWindowPtr = nullptr;
};
}
}
10 changes: 7 additions & 3 deletions Volt/Volt/src/Volt/Utility/ImGuiExtension.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ namespace ImGui
PushID((void*)(intptr_t)user_texture_id);
const ImGuiID id = window->GetID("#image");
PopID();

const ImVec2 padding = (frame_padding >= 0) ? ImVec2((float)frame_padding, (float)frame_padding) : g.Style.FramePadding;
return ImageButtonEx(id, texId, size, uv0, uv1, padding, bg_col, tint_col);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
const bool returnValue = ImageButtonEx(id, texId, size, uv0, uv1, bg_col, tint_col);
ImGui::PopStyleVar();

return returnValue;
}

inline static bool TreeNodeBehaviorWidth(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end, float width)
Expand Down Expand Up @@ -107,7 +111,7 @@ namespace ImGui

ImGuiButtonFlags button_flags = ImGuiTreeNodeFlags_None;
if (flags & ImGuiTreeNodeFlags_AllowItemOverlap)
button_flags |= ImGuiButtonFlags_AllowItemOverlap;
button_flags |= ImGuiButtonFlags_AllowOverlap;
if (!is_leaf)
button_flags |= ImGuiButtonFlags_PressedOnDragDropHold;

Expand Down
18 changes: 13 additions & 5 deletions Volt/Volt/src/Volt/Utility/UIUtility.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "vtpch.h"
#define IMGUI_DEFINE_MATH_OPERATORS
#include "UIUtility.h"

#include "Volt/Rendering/Texture/Texture2D.h"
Expand Down Expand Up @@ -434,8 +435,12 @@ bool UI::ImageButton(const std::string& id, ImTextureID textureId, const ImVec2&
const ImGuiID imId = window->GetID(id.c_str());

// Default to using texture ID as ID. User can still push string/integer prefixes.
const ImVec2 padding = (frame_padding >= 0) ? ImVec2((float)frame_padding, (float)frame_padding) : g.Style.FramePadding;
return ImGui::ImageButtonEx(imId, textureId, size, uv0, uv1, padding, bg_col, tint_col);
const ImVec2 padding = (frame_padding >= 0) ? ImVec2((float)frame_padding, (float)frame_padding) : g.Style.FramePadding;
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, padding);
const bool returnVal = ImGui::ImageButtonEx(imId, textureId, size, uv0, uv1, bg_col, tint_col);
ImGui::PopStyleVar();

return returnVal;
}

bool UI::ImageButtonState(const std::string& id, bool state, ImTextureID textureId, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1)
Expand Down Expand Up @@ -818,8 +823,7 @@ void UI::OpenPopup(const std::string& name, ImGuiPopupFlags flags)

bool UI::BeginModal(const std::string& name, ImGuiWindowFlags flags)
{
const uint32_t nameHash = static_cast<uint32_t>(std::hash<std::string>()(name));
return ImGui::BeginPopupModal(name.c_str(), nameHash, nullptr, flags);
return ImGui::BeginPopupModal(name.c_str(), nullptr, flags);
}

void UI::EndModal()
Expand Down Expand Up @@ -908,7 +912,11 @@ bool UI::ImageButton(const std::string& id, ImTextureID textureId, const ImVec2&

// Default to using texture ID as ID. User can still push string/integer prefixes.
const ImVec2 padding = (frame_padding >= 0) ? ImVec2((float)frame_padding, (float)frame_padding) : g.Style.FramePadding;
return ImGui::ImageButtonEx(imId, textureId, size, uv0, uv1, padding, bg_col, tint_col);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, padding);
const bool returnVal = ImGui::ImageButtonEx(imId, textureId, size, uv0, uv1, bg_col, tint_col);
ImGui::PopStyleVar();

return returnVal;
}

void UI::PropertyInfoString(const std::string& key, const std::string& info)
Expand Down
1 change: 1 addition & 0 deletions Volt/Volt/vendor/imgui-node-editor/builders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# include <imgui_internal.h>



//------------------------------------------------------------------------------
namespace ed = ax::NodeEditor;
namespace util = ax::NodeEditor::Utilities;
Expand Down
2 changes: 1 addition & 1 deletion Volt/Volt/vendor/imgui-node-editor/imgui_extra_math.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@


//------------------------------------------------------------------------------
# include <imgui.h>
# ifndef IMGUI_DEFINE_MATH_OPERATORS
# define IMGUI_DEFINE_MATH_OPERATORS
# endif
# include <imgui.h>
# include <imgui_internal.h>


Expand Down
24 changes: 12 additions & 12 deletions Volt/Volt/vendor/imgui-node-editor/imgui_extra_math.inl
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@


//------------------------------------------------------------------------------
inline bool operator==(const ImVec2& lhs, const ImVec2& rhs)
{
return lhs.x == rhs.x && lhs.y == rhs.y;
}
//inline bool operator==(const ImVec2& lhs, const ImVec2& rhs)
//{
// return lhs.x == rhs.x && lhs.y == rhs.y;
//}

inline bool operator!=(const ImVec2& lhs, const ImVec2& rhs)
{
return lhs.x != rhs.x || lhs.y != rhs.y;
}
//inline bool operator!=(const ImVec2& lhs, const ImVec2& rhs)
//{
// return lhs.x != rhs.x || lhs.y != rhs.y;
//}

inline ImVec2 operator*(const float lhs, const ImVec2& rhs)
{
return ImVec2(lhs * rhs.x, lhs * rhs.y);
}

inline ImVec2 operator-(const ImVec2& lhs)
{
return ImVec2(-lhs.x, -lhs.y);
}
//inline ImVec2 operator-(const ImVec2& lhs)
//{
// return ImVec2(-lhs.x, -lhs.y);
//}


//------------------------------------------------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions Volt/Volt/vendor/imgui-node-editor/imgui_node_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ namespace ax
struct KeyTester_ ## Key \
{ \
template <typename T> \
static int Get(typename std::enable_if<has_nested_ ## Key<ImGuiKey_>::value, T>::type*) \
static int Get(typename std::enable_if<has_nested_ ## Key<ImGuiKey>::value, T>::type*) \
{ \
return ImGui::GetKeyIndex(T::Key); \
} \
\
template <typename T> \
static int Get(typename std::enable_if<!has_nested_ ## Key<ImGuiKey_>::value, T>::type*) \
static int Get(typename std::enable_if<!has_nested_ ## Key<ImGuiKey>::value, T>::type*) \
{ \
return -1; \
} \
Expand All @@ -63,12 +63,12 @@ namespace ax

static inline int GetKeyIndexForF()
{
return KeyTester_ImGuiKey_F::Get<ImGuiKey_>(nullptr);
return KeyTester_ImGuiKey_F::Get<ImGuiKey>(nullptr);
}

static inline int GetKeyIndexForD()
{
return KeyTester_ImGuiKey_D::Get<ImGuiKey_>(nullptr);
return KeyTester_ImGuiKey_D::Get<ImGuiKey>(nullptr);
}

} // namespace Detail
Expand Down Expand Up @@ -464,7 +464,7 @@ static void ImDrawList_AddBezierWithArrows(ImDrawList* drawList, const ImCubicBe

if (fill)
{
drawList->AddBezierCurve(curve.P0, curve.P1, curve.P2, curve.P3, color, thickness);
drawList->AddBezierCubic(curve.P0, curve.P1, curve.P2, curve.P3, color, thickness);

if (startArrowSize > 0.0f)
{
Expand Down Expand Up @@ -2956,7 +2956,7 @@ ed::EditorAction::AcceptResult ed::NavigateAction::Accept(const Control& control

auto& io = ImGui::GetIO();

if (ImGui::IsWindowFocused() && ImGui::IsKeyPressed(GetKeyIndexForF()) && Editor->AreShortcutsEnabled())
if (ImGui::IsWindowFocused() && ImGui::IsKeyPressed(static_cast<ImGuiKey>(GetKeyIndexForF())) && Editor->AreShortcutsEnabled())
{
const auto allowZoomIn = io.KeyShift;

Expand Down Expand Up @@ -3967,7 +3967,7 @@ ed::EditorAction::AcceptResult ed::ShortcutAction::Accept(const Control& control
candidateAction = Copy;
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_V)))
candidateAction = Paste;
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(GetKeyIndexForD()))
if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(static_cast<ImGuiKey>(GetKeyIndexForD())))
candidateAction = Duplicate;
if (!io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Space)))
candidateAction = CreateNode;
Expand Down
3 changes: 2 additions & 1 deletion Volt/Volt/vendor/imgui-node-editor/imgui_node_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@


//------------------------------------------------------------------------------
# define IMGUI_DEFINE_MATH_OPERATORS
# include <imgui.h>
# include <cstdint> // std::uintXX_t
# include <utility> // std::move
Expand Down Expand Up @@ -204,7 +205,7 @@ struct Style
PivotAlignment = ImVec2(0.5f, 0.5f);
PivotSize = ImVec2(0.0f, 0.0f);
PivotScale = ImVec2(1, 1);
PinCorners = ImDrawCornerFlags_All;
PinCorners = ImDrawFlags_RoundCornersAll;
PinRadius = 0.0f;
PinArrowSize = 0.0f;
PinArrowWidth = 0.0f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@


//------------------------------------------------------------------------------
# include <imgui.h>
# define IMGUI_DEFINE_MATH_OPERATORS
# include <imgui.h>
# include <imgui_internal.h>
# include "imgui_extra_math.h"
# include "imgui_bezier_math.h"
Expand Down
Loading

0 comments on commit 10949f9

Please sign in to comment.