1#include "Tabs/PropertiesTab.h"
11 : PropertiesTabBase(parent), m_node(
nullptr), m_mainFrame(mainFrame) {
27 wxBoxSizer *sizer =
new wxBoxSizer(wxVERTICAL);
29 contentPanel->SetSizer(sizer);
38 wxString::Format(
"Selected node: %s (ID: %zu)", node->
GetName(), node->
GetId()).ToStdString());
53 m_propertyGrid->Append(
new wxPropertyCategory(
"Basic Properties"));
55 auto nameProp =
new wxStringProperty(
"Name",
"name",
m_node->GetName());
59 auto idProp =
new wxUIntProperty(
"ID",
"id",
static_cast<unsigned int>(
m_node->GetId()));
60 idProp->SetClientData(
reinterpret_cast<void *
>(
PROP_NODE_ID));
61 idProp->ChangeFlag(wxPGPropertyFlags::ReadOnly,
true);
66 typeProp->ChangeFlag(wxPGPropertyFlags::ReadOnly,
true);
78 m_propertyGrid->Append(
new wxPropertyCategory(
"Visual Properties"));
80 auto childrenVisibleProp =
new wxBoolProperty(
"Children Visible",
"children_visible",
m_node->AreChildrenVisible());
88 if (value.front() ==
'{' && value.back() ==
'}')
90 if (value.size() >= 4 && value[0] ==
'$' && value[1] ==
'{' && value.back() ==
'}')
99 const auto &attributes =
m_node->GetAllAttributes();
100 bool headerAdded =
false;
103 for (
const auto &pair : attributes) {
112 auto portProp =
new wxStringProperty(pair.first, wxString::Format(
"attr_%s", pair.first), pair.second);
113 portProp->SetClientData(
reinterpret_cast<void *
>(propId++));
122 const auto &attributes =
m_node->GetAllAttributes();
123 bool headerAdded =
false;
126 for (
const auto &pair : attributes) {
135 auto attrProp =
new wxStringProperty(pair.first, wxString::Format(
"attr_%s", pair.first), pair.second);
136 attrProp->SetClientData(
reinterpret_cast<void *
>(propId++));
152 return "BehaviorTree";
164 wxPGProperty *prop =
event.GetProperty();
168 int propId =
reinterpret_cast<intptr_t
>(prop->GetClientData());
169 wxVariant value = prop->GetValue();
172 wxString::Format(
"Property changed: %s = %s", prop->GetName(), value.GetString()).ToStdString());
176 m_node->SetName(value.GetString().ToStdString());
180 m_node->SetChildrenVisible(value.GetBool());
185 wxString attrName = prop->GetName();
186 m_node->SetAttribute(attrName.ToStdString(), value.GetString().ToStdString());
193 wxPGProperty *prop =
event.GetProperty();
BehaviorTreeProjectDialog::OnProjectNameChanged BehaviorTreeProjectDialog::OnRemoveFiles wxEND_EVENT_TABLE() BehaviorTreeProjectDialog
wxBEGIN_EVENT_TABLE(PropertiesTab, EmberUI::PropertiesTabBase) EVT_PG_CHANGING(wxID_ANY
#define LOG_INFO(category, message)
Represents a node in a behavior tree structure.
Type
Node types for behavior tree classification.
const String & GetName() const
static wxColour GetAccentColor()
Get the accent color as a wxColour for UI elements.
Shared base class for property editors (wxPanel, ITab).
void SetupPropertyGrid(wxPanel *parent)
Creates and configures the property grid in the given parent.
EmberCore::ITreeNode * m_selectedNode
wxPropertyGrid * m_propertyGrid
void ClearSelection()
Clears the current selection.
Main application window for EmberForge.
void OnClosed() override
Called when the tab is closed.
void SetSelectedNode(EmberCore::Node *node)
void CreateContentLayout(wxPanel *contentPanel) override
Pure virtual: subclasses create their content layout in contentPanel.
void OnPropertyChanged(wxPropertyGridEvent &event)
void AddVisualProperties()
wxString GetNodeTypeDisplayName(EmberCore::Node::Type type) const
static bool IsPortValue(const std::string &value)
void PopulateProperties() override
Pure virtual: subclasses populate the property grid from m_selectedNode.
void OnPropertyChanging(wxPropertyGridEvent &event)
void AddNodeCustomAttributes()
void AddNodePortAttributes()
@ PROP_NODE_CHILDREN_VISIBLE
@ PROP_CUSTOM_ATTRIBUTES_START
void OnNodeCleared() override
Called when selection is cleared; subclasses may override.