diff --git a/crude_json.cpp b/crude_json.cpp index 078427a2..1021b1b8 100644 --- a/crude_json.cpp +++ b/crude_json.cpp @@ -1,3 +1,11 @@ +//Disable a bunch of warnings for now +#ifndef _MSC_VER +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + // Crude implementation of JSON value object and parser. // // VERSION 0.1 @@ -888,3 +896,8 @@ bool value::save(const string& path, const int indent, const char indent_char) c # endif } // namespace crude_json + +//Disable a bunch of warnings for now +#ifndef _MSC_VER +#pragma GCC diagnostic pop +#endif diff --git a/crude_json.h b/crude_json.h index f1eff29e..48e7dffd 100644 --- a/crude_json.h +++ b/crude_json.h @@ -1,4 +1,10 @@ -// Crude implementation of JSON value object and parser. +//Disable a bunch of warnings for now +#ifndef _MSC_VER +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#endif + +// Crude implementation of JSON value object and parser. // // VERSION 0.1 // @@ -247,4 +253,9 @@ template <> inline number* value::get_ptr() { if (m_Type = } // namespace crude_json -# endif // __CRUDE_JSON_H__ \ No newline at end of file +# endif // __CRUDE_JSON_H__ + +//Disable a bunch of warnings for now +#ifndef _MSC_VER +#pragma GCC diagnostic pop +#endif diff --git a/imgui_bezier_math.inl b/imgui_bezier_math.inl index 3020bdb4..9f497f64 100644 --- a/imgui_bezier_math.inl +++ b/imgui_bezier_math.inl @@ -1,3 +1,11 @@ +//Disable a bunch of warnings for now +#ifndef _MSC_VER +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + //------------------------------------------------------------------------------ // VERSION 0.1 // @@ -395,17 +403,19 @@ inline ImCubicBezierIntersectResult ImCubicBezierLineIntersect(const ImVec2& p0, return count; }; - // https://github.com/kaishiqi/Geometric-Bezier/blob/master/GeometricBezier/src/kaishiqi/geometric/intersection/Intersection.as - // - // Start with Bezier using Bernstein polynomials for weighting functions: - // (1-t^3)P0 + 3t(1-t)^2P1 + 3t^2(1-t)P2 + t^3P3 - // - // Expand and collect terms to form linear combinations of original Bezier - // controls. This ends up with a vector cubic in t: - // (-P0+3P1-3P2+P3)t^3 + (3P0-6P1+3P2)t^2 + (-3P0+3P1)t + P0 - // /\ /\ /\ /\ - // || || || || - // c3 c2 c1 c0 + /* + https://github.com/kaishiqi/Geometric-Bezier/blob/master/GeometricBezier/src/kaishiqi/geometric/intersection/Intersection.as + + Start with Bezier using Bernstein polynomials for weighting functions: + (1-t^3)P0 + 3t(1-t)^2P1 + 3t^2(1-t)P2 + t^3P3 + + Expand and collect terms to form linear combinations of original Bezier + controls. This ends up with a vector cubic in t: + (-P0+3P1-3P2+P3)t^3 + (3P0-6P1+3P2)t^2 + (-3P0+3P1)t + P0 + /\ /\ /\ /\ + || || || || + c3 c2 c1 c0 + */ // Calculate the coefficients auto c3 = -p0 + 3 * p1 - 3 * p2 + p3; @@ -673,3 +683,7 @@ inline void ImCubicBezierFixedStep(F& callback, const ImCubicBezierPoints& curve //------------------------------------------------------------------------------ # endif // __IMGUI_BEZIER_MATH_INL__ + +#ifndef _MSC_VER +#pragma GCC diagnostic pop +#endif diff --git a/imgui_canvas.cpp b/imgui_canvas.cpp index 2010ee39..6a1504e0 100644 --- a/imgui_canvas.cpp +++ b/imgui_canvas.cpp @@ -122,7 +122,7 @@ bool ImGuiEx::Canvas::Begin(ImGuiID id, const ImVec2& size) // #debug: Canvas content. //m_DrawList->AddRectFilled(m_StartPos, m_StartPos + m_CurrentSize, IM_COL32(0, 0, 0, 64)); - //m_DrawList->AddRect(m_WidgetRect.Min, m_WidgetRect.Max, IM_COL32(255, 0, 255, 64)); + m_DrawList->AddRect(m_WidgetRect.Min, m_WidgetRect.Max, IM_COL32(255, 0, 255, 64)); ImGui::SetCursorScreenPos(ImVec2(0.0f, 0.0f)); @@ -561,6 +561,20 @@ void ImGuiEx::Canvas::LeaveLocalSpace() m_DrawList->CmdBuffer.erase(m_DrawList->CmdBuffer.Data + m_DrawListCommadBufferSize); else if (m_DrawList->CmdBuffer.size() >= m_DrawListCommadBufferSize && m_DrawList->CmdBuffer[m_DrawListCommadBufferSize - 1].UserCallback == ImDrawCallback_ImCanvas) m_DrawList->CmdBuffer.erase(m_DrawList->CmdBuffer.Data + m_DrawListCommadBufferSize - 1); + + //DEBUG: Search the *entire* draw list for the sentinel command + for(int i=0; iCmdBuffer.size(); i++) + { + if(m_DrawList->CmdBuffer[i].UserCallback == ImDrawCallback_ImCanvas) + { + /*fprintf(stderr, "found and removed sentinel at offset %d, expected %d or %d\n", + i, + m_DrawListCommadBufferSize, + m_DrawListCommadBufferSize-1);*/ + + m_DrawList->CmdBuffer.erase(m_DrawList->CmdBuffer.Data + i); + } + } } auto& fringeScale = ImFringeScaleRef(m_DrawList); diff --git a/imgui_extra_math.inl b/imgui_extra_math.inl index 8e2347f7..da960eb6 100644 --- a/imgui_extra_math.inl +++ b/imgui_extra_math.inl @@ -43,7 +43,6 @@ inline ImVec2 operator-(const ImVec2& lhs) } # endif - //------------------------------------------------------------------------------ inline float ImLength(float v) { diff --git a/imgui_node_editor.cpp b/imgui_node_editor.cpp index 1d2bb060..4c545126 100644 --- a/imgui_node_editor.cpp +++ b/imgui_node_editor.cpp @@ -1,3 +1,10 @@ +//Disable a bunch of warnings for now +#ifndef _MSC_VER +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + //------------------------------------------------------------------------------ // VERSION 0.9.1 // @@ -166,7 +173,6 @@ void ed::Log(const char* fmt, ...) # endif } - //------------------------------------------------------------------------------ static bool IsGroup(const ed::Node* node) { @@ -4391,15 +4397,15 @@ ed::EditorAction::AcceptResult ed::ShortcutAction::Accept(const Control& control Action candidateAction = None; auto& io = ImGui::GetIO(); - if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_X))) + if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGuiKey_X)) candidateAction = Cut; - if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_C))) + if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGuiKey_C)) candidateAction = Copy; - if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_V))) + if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGuiKey_V)) candidateAction = Paste; if (io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(GetKeyIndexForD())) candidateAction = Duplicate; - if (!io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Space))) + if (!io.KeyCtrl && !io.KeyShift && !io.KeyAlt && ImGui::IsKeyPressed(ImGuiKey_Space)) candidateAction = CreateNode; if (candidateAction != None) @@ -4953,7 +4959,7 @@ ed::EditorAction::AcceptResult ed::DeleteItemsAction::Accept(const Control& cont return False; auto& io = ImGui::GetIO(); - if (Editor->CanAcceptUserInput() && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Delete)) && Editor->AreShortcutsEnabled()) + if (Editor->CanAcceptUserInput() && ImGui::IsKeyPressed(ImGuiKey_Delete) && Editor->AreShortcutsEnabled()) { auto& selection = Editor->GetSelectedObjects(); if (!selection.empty()) @@ -5853,3 +5859,7 @@ void ed::Config::EndSave() if (EndSaveSession) EndSaveSession(UserPointer); } + +#ifndef _MSC_VER +#pragma GCC diagnostic pop +#endif diff --git a/imgui_node_editor.h b/imgui_node_editor.h index c79f41ad..ae2dfd5e 100644 --- a/imgui_node_editor.h +++ b/imgui_node_editor.h @@ -15,6 +15,7 @@ //------------------------------------------------------------------------------ +#define IMGUI_DEFINE_MATH_OPERATORS # include # include // std::uintXX_t # include // std::move diff --git a/imgui_node_editor_api.cpp b/imgui_node_editor_api.cpp index c8c7c3ff..74330855 100644 --- a/imgui_node_editor_api.cpp +++ b/imgui_node_editor_api.cpp @@ -1,3 +1,10 @@ +//Disable a bunch of warnings for now +#ifndef _MSC_VER +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + //------------------------------------------------------------------------------ // VERSION 0.9.1 // @@ -760,3 +767,8 @@ int ax::NodeEditor::GetOrderedNodeIds(NodeId* nodes, int size) { return s_Editor->GetNodeIds(nodes, size); } + +//Disable a bunch of warnings for now +#ifndef _MSC_VER +#pragma GCC diagnostic pop +#endif diff --git a/imgui_node_editor_internal.h b/imgui_node_editor_internal.h index 0d018cf5..b2804700 100644 --- a/imgui_node_editor_internal.h +++ b/imgui_node_editor_internal.h @@ -1,3 +1,10 @@ +//Disable a bunch of warnings for now +#ifndef _MSC_VER +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + //------------------------------------------------------------------------------ // VERSION 0.9.1 // @@ -1558,3 +1565,8 @@ struct EditorContext //------------------------------------------------------------------------------ # endif // __IMGUI_NODE_EDITOR_INTERNAL_H__ + +//Disable a bunch of warnings for now +#ifndef _MSC_VER +#pragma GCC diagnostic pop +#endif