9#include "../../third_party/imgui/imgui.h"
10#include "../../system/system_utils.h"
22 : m_showAddDialog(
false)
23 , m_showEditPopup(
false)
24 , m_newEntryTypeIndex(0)
46 ImGui::Text(
"No active graph.");
51 ImGui::Text(
"Blackboard Variables");
54 if (ImGui::Button(
"Add Variable"))
83static const char*
s_typeNames[] = {
"Int",
"Float",
"Bool",
"String",
"Vector3" };
92 ImGui::TextDisabled(
"(no variables)");
97 ImGui::Columns(3,
"bb_cols");
98 ImGui::SetColumnWidth(0, 140.0f);
99 ImGui::SetColumnWidth(1, 70.0f);
100 ImGui::Text(
"Name"); ImGui::NextColumn();
101 ImGui::Text(
"Type"); ImGui::NextColumn();
102 ImGui::Text(
"Value"); ImGui::NextColumn();
110 const std::string& name =
it->first;
113 ImGui::PushID(name.c_str());
116 ImGui::Text(
"%s", name.c_str());
133 case NodeGraph::BlackboardType::Int:
136 case NodeGraph::BlackboardType::Float:
139 case NodeGraph::BlackboardType::Bool:
142 case NodeGraph::BlackboardType::String:
145 case NodeGraph::BlackboardType::Vector3:
155 if (ImGui::IsItemHovered() && ImGui::IsMouseClicked(1))
157 ImGui::OpenPopup(
"EntryCtx");
159 if (ImGui::BeginPopup(
"EntryCtx"))
161 if (ImGui::MenuItem(
"Edit"))
165 if (ImGui::MenuItem(
"Delete"))
193 if (
ev->type == NodeGraph::BlackboardType::String)
196 "%s",
ev->stringValue.c_str());
209 ImGui::OpenPopup(
"Add Variable");
221 ImGui::Text(
"Initial value:");
225 case NodeGraph::BlackboardType::Int:
228 case NodeGraph::BlackboardType::Float:
231 case NodeGraph::BlackboardType::Bool:
234 case NodeGraph::BlackboardType::String:
237 case NodeGraph::BlackboardType::Vector3:
240 if (ImGui::InputFloat3(
"##vec3",
v))
254 if (ImGui::Button(
"Create"))
270 if (ImGui::Button(
"Cancel"))
285 ImGui::OpenPopup(
"Edit Variable");
293 ImGui::Text(
"Value:");
297 case NodeGraph::BlackboardType::Int:
300 case NodeGraph::BlackboardType::Float:
303 case NodeGraph::BlackboardType::Bool:
306 case NodeGraph::BlackboardType::String:
309 case NodeGraph::BlackboardType::Vector3:
312 if (ImGui::InputFloat3(
"##vec3",
v))
326 if (ImGui::Button(
"Apply"))
346 if (ImGui::Button(
"Cancel"))
ImGui panel for editing blackboard variables (Phase 2.1)
ComponentTypeID GetComponentTypeID_Static()
char m_editStringBuf[1024]
void Render(NodeGraph::BlackboardSystem *blackboard, bool *pOpen=nullptr)
Render the panel.
NodeGraph::BlackboardValue m_editBuffer
void RenderAddDialog(NodeGraph::BlackboardSystem *blackboard)
void RenderEditPopup(NodeGraph::BlackboardSystem *blackboard)
void RenderEntryList(NodeGraph::BlackboardSystem *blackboard)
std::string m_editTargetName
Manages named blackboard variables for a graph.
static const int s_typeCount
static const char * s_typeNames[]
< Provides AssetID and INVALID_ASSET_ID
Stores a typed value for a blackboard entry.