Skip to content

Commit

Permalink
[#167820336] Fixed default settings for bindings and window placement (
Browse files Browse the repository at this point in the history
…#44)

* disabled characters view layout for now as it's not finished.
* specified better bindings in the default workspace.
* changed blank project template to add models and materials folders by
  default.

Other changes:

* moved Dear ImGUI library to a conan package (preparing for ImVue
  integration).
* added imgui-node-editor as a dependency (compiling well, but not
  displayed when trying to use).
  • Loading branch information
Unix4ever authored Aug 9, 2019
1 parent 98a6baa commit 28eec2d
Show file tree
Hide file tree
Showing 35 changed files with 247 additions and 31,968 deletions.
5 changes: 3 additions & 2 deletions PlugIns/ImGUI/Common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
set(LIB_NAME "ImGUIPlugin")

include_directories(
${gsage_SOURCE_DIR}/Vendor/imgui
${gsage_SOURCE_DIR}/Vendor/easylogging/include
${gsage_SOURCE_DIR}/Vendor/cpp-channel/include
${gsage_SOURCE_DIR}/Vendor/sole
Expand All @@ -10,8 +9,10 @@ include_directories(

set(LIBS
GsageCore
imgui
cpp-channel
imgui
imgui_node_editor
imgui_canvas
)

file(GLOB sources src/*.cpp)
Expand Down
18 changes: 7 additions & 11 deletions PlugIns/ImGUI/Common/src/ImGuiDockspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ namespace Gsage {
float leftCurveRadius = first ? mStyle.windowRounding : 0.0f;
DockPtr next = dockTab->getNextTab();
float rightCurveRadius = next && next->anyTabOpen() ? 0.0f : mStyle.windowRounding;
ImVec2 tabButtonSize = ImVec2(size.x - 30, size.y);
ImVec2 tabButtonSize = ImVec2(std::max(1.0f, size.x - 30), std::max(1.0f, size.y));

if (ImGui::InvisibleButton(dockTab->getLabel(), tabButtonSize))
{
Expand All @@ -1172,7 +1172,6 @@ namespace Gsage {

bool hovered = ImGui::IsItemHovered();

drawList->PathClear();
drawList->PathLineTo(pos + ImVec2(0, size.y));
drawList->PathLineTo(pos + ImVec2(0, leftCurveRadius));
if(leftCurveRadius > 0) {
Expand Down Expand Up @@ -1203,7 +1202,6 @@ namespace Gsage {
}

ImU32 black = ImGui::ColorConvertFloat4ToU32(ImVec4(0.0f, 0.0f, 0.0f, 0.5f));
drawList->PathClear();
drawList->PathLineTo(pos + ImVec2(0, size.y));
drawList->PathLineTo(pos + size);
drawList->PathStroke(black, false, 1.0f);
Expand All @@ -1217,7 +1215,8 @@ namespace Gsage {
ImGui::SetCursorScreenPos(pos + ImVec2(tabButtonSize.x, 0));
std::stringstream ss;
ss << dockTab->getLabel() << ".close";
if(ImGui::InvisibleButton(ss.str().c_str(), ImVec2(size.x - tabButtonSize.x, size.y))) {

if(ImGui::InvisibleButton(ss.str().c_str(), ImVec2(std::max(1.0f, size.x - tabButtonSize.x), std::max(1.0f, size.y)))) {
dockTab->setOpened(false);
dockTab->mDirty = true;
}
Expand All @@ -1230,7 +1229,6 @@ namespace Gsage {
ImVec2 crossSize = ImVec2(5.0f * io.DisplayFramebufferScale.x, 5.0f * io.DisplayFramebufferScale.y);

if (ImGui::IsItemHovered()) {
drawList->PathClear();
drawList->AddLine(
center + ImVec2(-crossSize.x, -crossSize.y), center + ImVec2(crossSize.x, crossSize.y), black, 5);
drawList->AddLine(
Expand All @@ -1239,7 +1237,6 @@ namespace Gsage {

crossSize = ImVec2(4.0f * io.DisplayFramebufferScale.x, 4.0f * io.DisplayFramebufferScale.y);

drawList->PathClear();
drawList->AddLine(
center + ImVec2(-crossSize.x, -crossSize.y), center + ImVec2(crossSize.x, crossSize.y), color, 2);
drawList->AddLine(
Expand Down Expand Up @@ -1290,7 +1287,6 @@ namespace Gsage {
ImVec2 size = dock->getSize() - margin;
float curveRadius = mStyle.windowRounding;

drawList->PathClear();
drawList->PathLineTo(pos + ImVec2(0, topCurveRadius));
if(topCurveRadius > 0) {
drawList->PathBezierCurveTo(pos + ImVec2(0, topCurveRadius),
Expand Down Expand Up @@ -1323,7 +1319,6 @@ namespace Gsage {
}
drawList->PathFillConvex(mStyle.windowBGColor);
ImU32 col = ImGui::ColorConvertFloat4ToU32(ImVec4(0.0f, 0.0f, 0.0f, 0.5f));
drawList->PathClear();
drawList->PathLineTo(pos + ImVec2(topCurveRadius, 0.5f));
drawList->PathLineTo(pos + ImVec2(size.x - topCurveRadius, 0.5f));
drawList->PathStroke(mStyle.tabHoveredColor, false, 0.5f);
Expand Down Expand Up @@ -1399,7 +1394,9 @@ namespace Gsage {

ImVec2 screenPos = ImGui::GetCursorScreenPos();
ImGui::SetCursorScreenPos(pos);
ImGui::InvisibleButton("split", size);
if(size.x > 0 && size.y > 0) {
ImGui::InvisibleButton("split", size);
}

if (ImGui::IsItemHovered() && !ImGui::IsMouseDragging()) {
dock->mResized = ImGui::IsMouseDown(0);
Expand Down Expand Up @@ -1480,7 +1477,7 @@ namespace Gsage {
bool ImGuiDockspaceRenderer::dockSlots(DockPtr destDock, const ImRect& rect, const std::vector<Dock::Location>& locations)
{
ImGuiContext* ctx = ImGui::GetCurrentContext();
ImDrawList* canvas = &ctx->OverlayDrawList;
ImDrawList* canvas = &ctx->ForegroundDrawList;

ImVec2 mousePos = ImGui::GetIO().MousePos;

Expand Down Expand Up @@ -1518,7 +1515,6 @@ namespace Gsage {
ImVec2 br = ImVec2(tr.x, dockedRect.Max.y - thickness / 2);
ImVec2 bl = ImVec2(tl.x, br.y);

canvas->PathClear();
canvas->PathLineTo(tl);
canvas->PathLineTo(tr);
canvas->PathLineTo(br);
Expand Down
40 changes: 40 additions & 0 deletions PlugIns/ImGUI/Common/src/ImguiLuaInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ THE SOFTWARE.
#include <stdio.h>
#include <imgui.h>
#include <imgui_extensions.h>
#include <imgui_node_editor.h>
#include <deque>

#include "systems/RenderSystem.h"
Expand Down Expand Up @@ -667,5 +668,44 @@ namespace Gsage {
ImGuiIO io = ImGui::GetIO();
return std::make_tuple(io.DisplayFramebufferScale.x, io.DisplayFramebufferScale.y);
};

imgui["CreateEditor"] = [](const char* configFile) -> void* {
ax::NodeEditor::Config config;
config.SettingsFile = configFile;
return ax::NodeEditor::CreateEditor(&config);
};

imgui["DestroyEditor"] = [](void* ctx) {
ax::NodeEditor::DestroyEditor((ax::NodeEditor::EditorContext*)ctx);
};

imgui["NodeEditorBegin"] = [](void* ctx, const char* id, float x, float y) {
ax::NodeEditor::SetCurrentEditor((ax::NodeEditor::EditorContext*)ctx);
ax::NodeEditor::Begin(id, ImVec2(x, y));
};

imgui["BeginNode"] = [](int uniqueId) {
ax::NodeEditor::BeginNode(uniqueId);
};
imgui["EndNode"] = [](){
ax::NodeEditor::EndNode();
};

imgui["BeginPin"] = [](int uniqueId, ax::NodeEditor::PinKind kind){
ax::NodeEditor::BeginPin(uniqueId, kind);
};
imgui["EndPin"] = []() {
ax::NodeEditor::EndPin();
};

imgui["NodeEditorPinKind"] = lua.create_table_with(
"Input", ax::NodeEditor::PinKind::Input,
"Output", ax::NodeEditor::PinKind::Output
);

imgui["NodeEditorEnd"] = []() {
ax::NodeEditor::End();
ax::NodeEditor::SetCurrentEditor(nullptr);
};
}
}
1 change: 0 additions & 1 deletion Vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
add_subdirectory(imgui)
add_subdirectory(jsoncpp)
add_subdirectory(sole)
add_subdirectory(easylogging)
Expand Down
9 changes: 0 additions & 9 deletions Vendor/imgui/CMakeLists.txt

This file was deleted.

21 changes: 0 additions & 21 deletions Vendor/imgui/LICENSE

This file was deleted.

21 changes: 0 additions & 21 deletions Vendor/imgui/LICENSE.txt

This file was deleted.

Loading

0 comments on commit 28eec2d

Please sign in to comment.