admin管理员组文章数量:1289637
I'm working on a project that uses nodes and plots. I chose to use ImGui alongside ImPlots and imgui-node-editor.
(Docking branch)
I want to be able to embed an ImPlot plot into an imgui-node-editor node
Assuming everything is set up correctly, which it is.
ax::NodeEditor::BeginNode(1);
if (ImPlot::BeginPlot("BlankPlot")) {
ImPlot::EndPlot();
}
ax::NodeEditor::EndNode();
(Example, not my actual implementation.) Draws outside of the bounds of the node
As for my specific implementation: (I'm including this because I'm not sure if this matters or not)
Editor.cpp (Excerpt from Draw loop)
// Loop through all nodes in Nodes::nodes
for (auto it = Nodes::nodes.begin(); it != Nodes::nodes.end(); ) {
// Get node
Nodes::BaseNode* node = it->get();
// Begin drawing Node
ax::NodeEditor::BeginNode(node->GetNodeID()); // Begins Node, sets ID from node's GetNodeID (See BaseNode.h and BaseNode.cpp)
node->Draw(); // Draws node (Defined for every class inheriting from BaseNode)
if (!node->IsOpen()) { // Checks if node should still be open (See BaseNode.h and BaseNode.cpp)
it = Nodes::nodes.erase(it); // If node should be closed, remove it from Nodes::nodes
} else {
++it; // Else, keep chugging along
}
ax::NodeEditor::EndNode();
}
ScopeNode.cpp
void Oscil::Nodes::ScopeNode::Draw() {
ImGui::Text("Node A");
ax::NodeEditor::BeginPin(Nodes::GetConnectionID(GetNodeID(), 1), ax::NodeEditor::PinKind::Input);
ImGui::Text("-> In");
ax::NodeEditor::EndPin();
if (ImPlot::BeginPlot("OscilloscopePlot")) {
//ImPlot::PlotLine("Line1", {1, 2, 3, 4, 5, 6, 6});
ImPlot::EndPlot();
}
}
本文标签: cHow do I properly draw an ImPlots plot into a imguinodeeditor nodeStack Overflow
版权声明:本文标题:c++ - How do I properly draw an ImPlots plot into a imgui-node-editor node? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741465076a2380265.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论