161 wxPanel *panel =
new wxPanel(notebook);
162 wxGridBagSizer *sizer =
new wxGridBagSizer(10, 10);
167 wxBoxSizer *labelSizer1 =
new wxBoxSizer(wxHORIZONTAL);
171 wxBitmap infoNormal(
GetResourcePath(
"buttons/info/Info_Normal_20.png"), wxBITMAP_TYPE_PNG);
172 wxBitmap infoHover(
GetResourcePath(
"buttons/info/Info_Hovered_20.png"), wxBITMAP_TYPE_PNG);
173 wxBitmap infoPressed(
GetResourcePath(
"buttons/info/Info_Pressed_20.png"), wxBITMAP_TYPE_PNG);
174 wxBitmap infoDisabled(
GetResourcePath(
"buttons/info/Info_Disabled_20.png"), wxBITMAP_TYPE_PNG);
176 wxBitmapButton *infoBtn1 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
177 wxBORDER_NONE | wxBU_EXACTFIT);
178 infoBtn1->SetBitmapHover(infoHover);
179 infoBtn1->SetBitmapPressed(infoPressed);
180 infoBtn1->SetBitmapDisabled(infoDisabled);
181 infoBtn1->SetToolTip(
"Click for detailed information");
182 infoBtn1->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
183 wxString helpText =
"ROOT ELEMENT NAME\n"
184 "===========================================================\n\n"
186 "The name of the top-level XML element that wraps all behavior trees.\n"
187 "This is the outermost container in your XML file.\n\n"
189 " - 'root' - BehaviorTree.CPP standard format\n"
190 " - 'BehaviorTrees' - Some Unity implementations\n"
191 " - 'TreeCollection' - Custom formats\n\n"
193 "This element MUST be present in your XML file as the outermost container.\n"
194 "All behavior tree definitions must be nested inside this root element.\n\n"
195 "EXAMPLE XML STRUCTURE:\n"
196 " <root main_tree_to_execute=\"MainTree\">\n"
197 " <BehaviorTree ID=\"MainTree\">\n"
199 " <Action ID=\"MoveForward\"/>\n"
203 "If your XML uses a different name (e.g., <Trees>), enter that name here.";
204 HelpDialog dlg(
this,
"Root Element Name - Help", helpText);
207 labelSizer1->Add(infoBtn1, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
208 labelSizer1->Add(
new wxStaticText(panel, wxID_ANY,
"Root Element Name:"), 0, wxALIGN_CENTER_VERTICAL);
209 sizer->Add(labelSizer1, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
212 m_rootElement->SetToolTip(
"Top-level XML element name (e.g., 'root')");
214 sizer->Add(
m_rootElement, wxGBPosition(row, 1), wxDefaultSpan, wxEXPAND);
218 wxBoxSizer *labelSizer2 =
new wxBoxSizer(wxHORIZONTAL);
220 wxBitmapButton *infoBtn2 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
221 wxBORDER_NONE | wxBU_EXACTFIT);
222 infoBtn2->SetBitmapHover(infoHover);
223 infoBtn2->SetBitmapPressed(infoPressed);
224 infoBtn2->SetBitmapDisabled(infoDisabled);
225 infoBtn2->SetToolTip(
"Click for detailed information");
226 infoBtn2->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
227 wxString helpText =
"MAIN TREE ATTRIBUTE\n"
228 "===========================================================\n\n"
230 "The attribute on the root element that specifies which behavior tree\n"
231 "should be executed first when your XML file contains multiple trees.\n\n"
233 " - 'main_tree_to_execute' - BehaviorTree.CPP standard\n"
234 " - 'entry_point' - Alternative naming convention\n"
235 " - 'start_tree' - Some custom implementations\n\n"
236 "WHY DO YOU NEED IT?\n"
237 "When your XML file contains multiple behavior tree definitions (main tree,\n"
238 "subtrees, utility trees), this attribute tells the system which one is the\n"
239 "primary entry point.\n\n"
241 " <root main_tree_to_execute=\"PlayerAI\">\n"
242 " <BehaviorTree ID=\"PlayerAI\">\n"
243 " <!-- This tree will be loaded first -->\n"
245 " <BehaviorTree ID=\"EnemyAI\">\n"
246 " <!-- This tree is available as a subtree -->\n"
249 "FALLBACK BEHAVIOR:\n"
250 "If this attribute is missing or empty, the parser will automatically\n"
251 "load the first behavior tree it finds in the file.";
252 HelpDialog dlg(
this,
"Main Tree Attribute - Help", helpText);
255 labelSizer2->Add(infoBtn2, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
256 labelSizer2->Add(
new wxStaticText(panel, wxID_ANY,
"Main Tree Attribute:"), 0, wxALIGN_CENTER_VERTICAL);
257 sizer->Add(labelSizer2, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
260 m_mainTreeAttr->SetToolTip(
"Attribute specifying entry point tree (e.g., 'main_tree_to_execute')");
262 sizer->Add(
m_mainTreeAttr, wxGBPosition(row, 1), wxDefaultSpan, wxEXPAND);
266 wxBoxSizer *caseSizer =
new wxBoxSizer(wxHORIZONTAL);
268 wxBitmapButton *infoBtn3 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
269 wxBORDER_NONE | wxBU_EXACTFIT);
270 infoBtn3->SetBitmapHover(infoHover);
271 infoBtn3->SetBitmapPressed(infoPressed);
272 infoBtn3->SetBitmapDisabled(infoDisabled);
273 infoBtn3->SetToolTip(
"Click for detailed information");
274 infoBtn3->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
275 wxString helpText =
"CASE SENSITIVE ELEMENT NAMES\n"
276 "===========================================================\n\n"
277 "Controls whether element and attribute names must match the exact\n"
278 "case specified in your configuration.\n\n"
279 "ENABLED (Recommended):\n"
280 " - <BehaviorTree> and <behaviortree> are treated as DIFFERENT\n"
281 " - More strict parsing - catches typos and inconsistencies\n"
282 " - Standard for most XML parsers and behavior tree formats\n"
283 " - Best for well-defined, consistent XML formats\n\n"
285 " - <BehaviorTree>, <behaviortree>, <BEHAVIORTREE> all treated as SAME\n"
286 " - More forgiving - useful for legacy/inconsistent XML files\n"
287 " - May hide formatting issues in your XML\n"
288 " - Use ONLY if your XML has inconsistent casing\n\n"
290 "If ENABLED and you configure 'BehaviorTree' as the tree element:\n"
291 " [YES] <BehaviorTree ID=\"Test\"> - ACCEPTED\n"
292 " [NO] <behaviortree ID=\"Test\"> - REJECTED (case mismatch)\n\n"
294 " [YES] <BehaviorTree ID=\"Test\"> - ACCEPTED\n"
295 " [YES] <behaviortree ID=\"Test\"> - ACCEPTED\n"
296 " [YES] <BEHAVIORTREE ID=\"Test\"> - ACCEPTED\n\n"
298 "Keep this ENABLED unless working with legacy files that have\n"
299 "inconsistent casing. Strict validation helps catch errors early!";
300 HelpDialog dlg(
this,
"Case Sensitive - Help", helpText);
303 caseSizer->Add(infoBtn3, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
304 m_caseSensitive =
new wxCheckBox(panel, wxID_ANY,
"Case Sensitive Element Names");
305 m_caseSensitive->SetToolTip(
"Element/attribute names must match exact case");
307 sizer->Add(caseSizer, wxGBPosition(row, 0), wxGBSpan(1, 2));
311 wxBoxSizer *unknownSizer =
new wxBoxSizer(wxHORIZONTAL);
313 wxBitmapButton *infoBtn4 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
314 wxBORDER_NONE | wxBU_EXACTFIT);
315 infoBtn4->SetBitmapHover(infoHover);
316 infoBtn4->SetBitmapPressed(infoPressed);
317 infoBtn4->SetBitmapDisabled(infoDisabled);
318 infoBtn4->SetToolTip(
"Click for detailed information");
319 infoBtn4->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
320 wxString helpText =
"ALLOW UNKNOWN ELEMENTS\n"
321 "===========================================================\n\n"
322 "Controls how the parser handles XML elements that are NOT defined\n"
323 "in your configuration.\n\n"
325 " - Unknown elements are SILENTLY IGNORED\n"
326 " - Parsing continues without warnings\n"
327 " - Useful for XML with documentation, metadata, or extensions\n"
328 " - More flexible for varying XML formats\n\n"
329 "DISABLED (Recommended):\n"
330 " - Unknown elements cause WARNING messages in the log\n"
331 " - Helps catch typos (e.g., 'Behaviortree' vs 'BehaviorTree')\n"
332 " - Stricter validation ensures XML matches expectations\n"
333 " - Better for catching configuration errors\n\n"
334 "EXAMPLE - XML with unknown elements:\n"
336 " <BehaviorTree ID=\"Test\">...</BehaviorTree>\n"
337 " <Documentation>Comment</Documentation> <- Unknown\n"
338 " <Metadata author=\"John\"/> <- Unknown\n"
340 "If ENABLED: Parser ignores <Documentation> and <Metadata>\n"
341 "If DISABLED: Parser logs warnings about unexpected elements\n\n"
343 "Keep DISABLED during development to catch errors.\n"
344 "Enable only if you need to parse XML with extra metadata.";
345 HelpDialog dlg(
this,
"Allow Unknown Elements - Help", helpText);
348 unknownSizer->Add(infoBtn4, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
352 sizer->Add(unknownSizer, wxGBPosition(row, 0), wxGBSpan(1, 2));
356 wxBoxSizer *labelSizer5 =
new wxBoxSizer(wxHORIZONTAL);
358 wxBitmapButton *infoBtn5 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
359 wxBORDER_NONE | wxBU_EXACTFIT);
360 infoBtn5->SetBitmapHover(infoHover);
361 infoBtn5->SetBitmapPressed(infoPressed);
362 infoBtn5->SetBitmapDisabled(infoDisabled);
363 infoBtn5->SetToolTip(
"Click for detailed information");
364 infoBtn5->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
365 wxString helpText =
"WHITESPACE HANDLING\n"
366 "===========================================================\n\n"
367 "Controls how whitespace (spaces, tabs, newlines) in attribute values\n"
368 "and text content is processed during parsing.\n\n"
371 " - Keeps ALL whitespace exactly as it appears\n"
372 " - ' Hello World ' stays as ' Hello World '\n"
373 " - Use if whitespace is meaningful in your data\n"
374 " - Rarely needed for behavior trees\n\n"
375 "TRIM (Recommended):\n"
376 " - Removes leading and trailing whitespace ONLY\n"
377 " - ' Hello World ' becomes 'Hello World'\n"
378 " - Internal spaces preserved: 'Hello World' stays 'Hello World'\n"
379 " - Best for most behavior tree formats\n"
380 " - Handles formatting inconsistencies gracefully\n\n"
382 " - Trims AND collapses multiple spaces to single space\n"
383 " - ' Hello World ' becomes 'Hello World'\n"
384 " - Useful for cleaning poorly formatted XML\n"
385 " - May affect intentional multi-spacing\n\n"
387 "Value: name=' Patrol Enemy '\n"
388 " - PRESERVE: ' Patrol Enemy '\n"
389 " - TRIM: 'Patrol Enemy'\n"
390 " - NORMALIZE: 'Patrol Enemy'\n\n"
391 "Value: name='Move To Target'\n"
392 " - PRESERVE: 'Move To Target'\n"
393 " - TRIM: 'Move To Target'\n"
394 " - NORMALIZE: 'Move To Target'\n\n"
396 "Use TRIM for clean, consistent parsing that handles\n"
397 "formatting variations without losing meaningful content.";
398 HelpDialog dlg(
this,
"Whitespace Handling - Help", helpText);
401 labelSizer5->Add(infoBtn5, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
402 labelSizer5->Add(
new wxStaticText(panel, wxID_ANY,
"Whitespace Handling:"), 0, wxALIGN_CENTER_VERTICAL);
403 sizer->Add(labelSizer5, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
405 wxArrayString whitespaceChoices;
406 whitespaceChoices.Add(
"Preserve");
407 whitespaceChoices.Add(
"Trim");
408 whitespaceChoices.Add(
"Normalize");
409 m_whitespaceHandling =
new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, whitespaceChoices);
416 wxBoxSizer *namingSizer =
new wxBoxSizer(wxHORIZONTAL);
418 wxBitmapButton *infoBtn6 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
419 wxBORDER_NONE | wxBU_EXACTFIT);
420 infoBtn6->SetBitmapHover(infoHover);
421 infoBtn6->SetBitmapPressed(infoPressed);
422 infoBtn6->SetBitmapDisabled(infoDisabled);
423 infoBtn6->SetToolTip(
"Click for detailed information");
424 infoBtn6->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
425 wxString helpText =
"NAMING CONVENTION\n"
426 "===========================================================\n\n"
427 "Controls how strictly element and attribute naming rules are enforced.\n"
428 "When you switch conventions, all fields are immediately re-validated\n"
429 "and invalid names are highlighted with a pulsing yellow background.\n\n"
430 "===========================================================\n\n"
432 " Allowed: Letters (a-z, A-Z) and underscores (_) ONLY\n"
433 " Not allowed: Numbers, hyphens, dots, or any special characters\n"
434 " Must start with: Letter or underscore\n"
436 " Use for: Maximum safety and consistency\n"
437 " Best for: Production environments, strict standards\n\n"
438 "===========================================================\n\n"
439 "BALANCED MODE (Recommended):\n"
440 " Allowed: Letters, underscores, digits (0-9), and hyphens (-)\n"
441 " Not allowed: Dots, spaces, or other special characters\n"
442 " Must start with: Letter or underscore (NOT a number)\n"
444 " Use for: Most projects - flexible yet safe\n"
445 " Best for: Standard behavior tree projects\n\n"
446 "===========================================================\n\n"
448 " Allowed: Most characters that don't break XML\n"
449 " Includes: Letters, digits, underscores, hyphens, dots, colons\n"
450 " Not allowed: <, >, &, quotes, spaces, brackets, and other\n"
451 " XML-breaking characters\n"
452 " Must start with: Letter, underscore, or colon\n"
454 " Use for: Legacy XML files, maximum compatibility\n"
455 " Best for: Working with existing/legacy systems\n\n"
456 "===========================================================\n\n"
458 "Name: 'MyAction' All modes accept\n"
459 "Name: 'My_Action' All modes accept\n"
460 "Name: 'My-Action' STRICT rejects | BALANCED/LOOSE accept\n"
461 "Name: 'MyAction123' STRICT rejects | BALANCED/LOOSE accept\n"
462 "Name: 'My.Action' STRICT/BALANCED reject | LOOSE accepts\n"
463 "Name: 'My:Action' STRICT/BALANCED reject | LOOSE accepts\n"
464 "Name: '123Action' STRICT/BALANCED reject | LOOSE rejects\n"
465 "Name: 'My Action' All modes reject (contains space)\n"
466 "Name: 'My<Action>' All modes reject (breaks XML)\n\n"
467 "===========================================================\n\n"
469 " - Switch between conventions to see which fields become invalid\n"
470 " - Invalid fields pulse with yellow highlighting\n"
471 " - Fix invalid names before saving your configuration\n\n"
473 "Start with BALANCED - it provides excellent validation while\n"
474 "supporting common naming patterns like 'Action-Name' and 'Node123'.\n"
475 "Use STRICT for maximum safety or LOOSE for legacy compatibility.";
476 HelpDialog dlg(
this,
"Naming Convention - Help", helpText);
479 namingSizer->Add(infoBtn6, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
480 namingSizer->Add(
new wxStaticText(panel, wxID_ANY,
"Naming Convention:"), 0, wxALIGN_CENTER_VERTICAL);
481 sizer->Add(namingSizer, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
484 wxBoxSizer *checkboxesSizer =
new wxBoxSizer(wxHORIZONTAL);
487 wxBoxSizer *strictSizer =
new wxBoxSizer(wxVERTICAL);
491 strictSizer->Add(
new wxStaticText(panel, wxID_ANY,
"Strict"), 0, wxALIGN_CENTER_HORIZONTAL | wxTOP, 2);
492 checkboxesSizer->Add(strictSizer, 0, wxRIGHT, 15);
495 wxBoxSizer *balancedSizer =
new wxBoxSizer(wxVERTICAL);
499 balancedSizer->Add(
new wxStaticText(panel, wxID_ANY,
"Balanced"), 0, wxALIGN_CENTER_HORIZONTAL | wxTOP, 2);
500 checkboxesSizer->Add(balancedSizer, 0, wxRIGHT, 15);
503 wxBoxSizer *looseSizer =
new wxBoxSizer(wxVERTICAL);
507 looseSizer->Add(
new wxStaticText(panel, wxID_ANY,
"Loose"), 0, wxALIGN_CENTER_HORIZONTAL | wxTOP, 2);
508 checkboxesSizer->Add(looseSizer, 0);
510 sizer->Add(checkboxesSizer, wxGBPosition(row, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
516 if (event.IsChecked()) {
523 if (event.IsChecked()) {
530 if (event.IsChecked()) {
537 sizer->AddGrowableCol(1);
538 panel->SetSizer(sizer);
543 wxPanel *panel =
new wxPanel(notebook);
544 wxGridBagSizer *sizer =
new wxGridBagSizer(5, 5);
547 wxBitmap infoNormal(
GetResourcePath(
"buttons/info/Info_Normal_20.png"), wxBITMAP_TYPE_PNG);
548 wxBitmap infoHover(
GetResourcePath(
"buttons/info/Info_Hovered_20.png"), wxBITMAP_TYPE_PNG);
549 wxBitmap infoPressed(
GetResourcePath(
"buttons/info/Info_Pressed_20.png"), wxBITMAP_TYPE_PNG);
550 wxBitmap infoDisabled(
GetResourcePath(
"buttons/info/Info_Disabled_20.png"), wxBITMAP_TYPE_PNG);
555 wxBoxSizer *labelSizer1 =
new wxBoxSizer(wxHORIZONTAL);
556 wxBitmapButton *infoBtn1 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
557 wxBORDER_NONE | wxBU_EXACTFIT);
558 infoBtn1->SetBitmapHover(infoHover);
559 infoBtn1->SetBitmapPressed(infoPressed);
560 infoBtn1->SetBitmapDisabled(infoDisabled);
561 infoBtn1->SetToolTip(
"Click for detailed information");
562 infoBtn1->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
563 wxString helpText =
"BEHAVIOR TREE ELEMENT\n"
564 "===========================================================\n\n"
566 "The XML element name that represents a behavior tree definition\n"
567 "in your XML file. This is the main container for each tree.\n\n"
569 " - 'BehaviorTree' - Standard BehaviorTree.CPP format\n"
570 " - 'Tree' - Simplified/custom format\n"
571 " - 'btree' - Alternative naming\n\n"
573 "The parser scans your XML looking for elements with this exact name.\n"
574 "Each matching element is treated as a separate behavior tree definition.\n\n"
577 " <BehaviorTree ID=\"MainTree\">\n"
579 " <Action name=\"DoSomething\"/>\n"
584 " - Name must match EXACTLY (case-sensitive if enabled)\n"
585 " - All your behavior trees must use this element name\n"
586 " - Typical values: 'BehaviorTree', 'Tree', or custom names";
587 HelpDialog dlg(
this,
"Behavior Tree Element - Help", helpText);
590 labelSizer1->Add(infoBtn1, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
591 labelSizer1->Add(
new wxStaticText(panel, wxID_ANY,
"Behavior Tree Element:"), 0, wxALIGN_CENTER_VERTICAL);
592 sizer->Add(labelSizer1, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
600 wxBoxSizer *labelSizer2 =
new wxBoxSizer(wxHORIZONTAL);
601 wxBitmapButton *infoBtn2 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
602 wxBORDER_NONE | wxBU_EXACTFIT);
603 infoBtn2->SetBitmapHover(infoHover);
604 infoBtn2->SetBitmapPressed(infoPressed);
605 infoBtn2->SetBitmapDisabled(infoDisabled);
606 infoBtn2->SetToolTip(
"Click for detailed information");
607 infoBtn2->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
608 wxString helpText =
"TREE ID ATTRIBUTE\n"
609 "===========================================================\n\n"
611 "The XML attribute name that contains the unique identifier for\n"
612 "each behavior tree in your file.\n\n"
614 " - 'ID' - Standard BehaviorTree.CPP format (most common)\n"
615 " - 'name' - Alternative naming convention\n"
616 " - 'id' - Lowercase variant\n"
617 " - 'tree_id' - Explicit naming\n\n"
618 "WHY DO YOU NEED IT?\n"
619 "The ID serves multiple critical purposes:\n"
620 " - Uniquely identifies each behavior tree\n"
621 " - Enables subtree references (one tree calling another)\n"
622 " - Supports multiple trees in a single XML file\n"
623 " - Used by the main tree attribute to specify entry point\n\n"
625 " <BehaviorTree ID=\"MainTree\">\n"
626 " <SubTree ID=\"PatrolBehavior\"/>\n"
628 " <BehaviorTree ID=\"PatrolBehavior\">\n"
629 " <!-- This tree can be called by MainTree -->\n"
630 " </BehaviorTree>\n\n"
632 " - Each tree MUST have a unique ID\n"
633 " - IDs are used for subtree references";
634 HelpDialog dlg(
this,
"Tree ID Attribute - Help", helpText);
637 labelSizer2->Add(infoBtn2, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
638 labelSizer2->Add(
new wxStaticText(panel, wxID_ANY,
"Tree ID Attribute:"), 0, wxALIGN_CENTER_VERTICAL);
639 sizer->Add(labelSizer2, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
641 m_treeIdAttr->SetToolTip(
"Attribute name for tree identifier (e.g., 'ID')");
643 sizer->Add(
m_treeIdAttr, wxGBPosition(row, 1), wxDefaultSpan, wxEXPAND);
647 wxBoxSizer *labelSizer3 =
new wxBoxSizer(wxHORIZONTAL);
648 wxBitmapButton *infoBtn3 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
649 wxBORDER_NONE | wxBU_EXACTFIT);
650 infoBtn3->SetBitmapHover(infoHover);
651 infoBtn3->SetBitmapPressed(infoPressed);
652 infoBtn3->SetBitmapDisabled(infoDisabled);
653 infoBtn3->SetToolTip(
"Click for detailed information");
654 infoBtn3->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
655 wxString helpText =
"ALLOW MULTIPLE TREES IN FILE\n"
656 "===========================================================\n\n"
657 "Controls whether your XML file can contain multiple behavior tree\n"
658 "definitions or just one.\n\n"
659 "ENABLED (Recommended):\n"
660 " - Multiple <BehaviorTree> elements can exist in one file\n"
661 " - Each tree MUST have a unique ID\n"
662 " - Perfect for organizing related trees together\n"
663 " - Enables subtree references within the same file\n"
664 " - Common in BehaviorTree.CPP and complex AI systems\n\n"
666 " - Only ONE <BehaviorTree> element allowed per file\n"
667 " - Simpler structure for basic projects\n"
668 " - Parser will REJECT files with multiple trees\n"
669 " - Forces one-tree-per-file organization\n\n"
670 "EXAMPLE (ENABLED):\n"
672 " <BehaviorTree ID=\"MainAI\">\n"
673 " <SubTree ID=\"Patrol\"/>\n"
675 " <BehaviorTree ID=\"Patrol\">\n"
676 " <!-- Subtree definition -->\n"
680 "Enable this for flexibility and better tree organization.";
681 HelpDialog dlg(
this,
"Allow Multiple Trees - Help", helpText);
684 labelSizer3->Add(infoBtn3, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
688 sizer->Add(labelSizer3, wxGBPosition(row, 0), wxGBSpan(1, 2));
692 wxBoxSizer *labelSizer4 =
new wxBoxSizer(wxHORIZONTAL);
693 wxBitmapButton *infoBtn4 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
694 wxBORDER_NONE | wxBU_EXACTFIT);
695 infoBtn4->SetBitmapHover(infoHover);
696 infoBtn4->SetBitmapPressed(infoPressed);
697 infoBtn4->SetBitmapDisabled(infoDisabled);
698 infoBtn4->SetToolTip(
"Click for detailed information");
699 infoBtn4->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
700 wxString helpText =
"SUBTREE ELEMENT\n"
701 "===========================================================\n\n"
703 "The XML element name that represents a subtree reference - a special\n"
704 "node that calls another behavior tree by its ID.\n\n"
706 " - 'SubTree' - Standard BehaviorTree.CPP format (recommended)\n"
707 " - 'CallTree' - Alternative naming\n"
708 " - 'TreeReference' - Explicit variant\n"
709 " - 'Include' - Some custom implementations\n\n"
711 "When the execution reaches a SubTree node, it:\n"
712 " 1. Pauses the current tree\n"
713 " 2. Executes the referenced tree completely\n"
714 " 3. Returns the referenced tree's result (SUCCESS/FAILURE)\n"
715 " 4. Continues with the current tree\n\n"
717 " <BehaviorTree ID=\"MainAI\">\n"
719 " <SubTree ID=\"PatrolBehavior\"/>\n"
720 " <Action name=\"Attack\"/>\n"
722 " </BehaviorTree>\n\n"
724 " - Reuse trees in multiple places\n"
725 " - Create modular, maintainable structures\n"
726 " - Break complex behaviors into components";
727 HelpDialog dlg(
this,
"SubTree Element - Help", helpText);
730 labelSizer4->Add(infoBtn4, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
731 labelSizer4->Add(
new wxStaticText(panel, wxID_ANY,
"SubTree Element:"), 0, wxALIGN_CENTER_VERTICAL);
732 sizer->Add(labelSizer4, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
734 m_subtreeElement->SetToolTip(
"Element name for subtree references (e.g., 'SubTree')");
736 sizer->Add(
m_subtreeElement, wxGBPosition(row, 1), wxDefaultSpan, wxEXPAND);
740 wxBoxSizer *labelSizer5 =
new wxBoxSizer(wxHORIZONTAL);
741 wxBitmapButton *infoBtn5 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
742 wxBORDER_NONE | wxBU_EXACTFIT);
743 infoBtn5->SetBitmapHover(infoHover);
744 infoBtn5->SetBitmapPressed(infoPressed);
745 infoBtn5->SetBitmapDisabled(infoDisabled);
746 infoBtn5->SetToolTip(
"Click for detailed information");
747 infoBtn5->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
748 wxString helpText =
"SUBTREE REFERENCE ATTRIBUTE\n"
749 "===========================================================\n\n"
751 "The XML attribute name on a SubTree node that contains the ID of\n"
752 "the behavior tree being referenced/called.\n\n"
754 " - 'ID' - Standard BehaviorTree.CPP format (most common)\n"
755 " - 'treeID' - Explicit variant\n"
756 " - 'ref' - Short form\n"
757 " - 'tree' - Simple naming\n\n"
759 "When the parser encounters a SubTree node:\n"
760 " 1. Reads this attribute to get the referenced tree ID\n"
761 " 2. Searches for a BehaviorTree with matching ID\n"
762 " 3. Links them together for execution\n"
763 " 4. Validates that the reference is valid\n\n"
765 " <BehaviorTree ID=\"MainAI\">\n"
766 " <SubTree ID=\"PatrolBehavior\"/>\n"
767 " ^^^^^^^^^^^^^^^^^^^^^\n"
768 " This attribute references another tree\n"
769 " </BehaviorTree>\n\n"
771 " - Should typically MATCH your Tree ID Attribute setting\n"
772 " - Referenced tree must exist in the same or loaded files\n"
773 " - Parser validates references during loading";
774 HelpDialog dlg(
this,
"SubTree Reference Attribute - Help", helpText);
777 labelSizer5->Add(infoBtn5, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
778 labelSizer5->Add(
new wxStaticText(panel, wxID_ANY,
"SubTree Reference Attribute:"), 0, wxALIGN_CENTER_VERTICAL);
779 sizer->Add(labelSizer5, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
781 m_subtreeRefAttr->SetToolTip(
"Attribute containing referenced tree ID (e.g., 'ID')");
783 sizer->Add(
m_subtreeRefAttr, wxGBPosition(row, 1), wxDefaultSpan, wxEXPAND);
787 wxBoxSizer *labelSizer6 =
new wxBoxSizer(wxHORIZONTAL);
788 wxBitmapButton *infoBtn6 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
789 wxBORDER_NONE | wxBU_EXACTFIT);
790 infoBtn6->SetBitmapHover(infoHover);
791 infoBtn6->SetBitmapPressed(infoPressed);
792 infoBtn6->SetBitmapDisabled(infoDisabled);
793 infoBtn6->SetToolTip(
"Click for detailed information");
794 infoBtn6->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
795 wxString helpText =
"VALIDATE TREE STRUCTURE\n"
796 "===========================================================\n\n"
797 "Enables comprehensive structural validation to ensure your behavior\n"
798 "trees follow proper hierarchical and semantic rules.\n\n"
799 "ENABLED (Recommended):\n"
800 " The parser performs these critical checks:\n"
801 " - Control nodes (Sequence, Selector, etc.) have at least one child\n"
802 " - Decorator nodes have EXACTLY one child\n"
803 " - Action/Condition nodes have NO children\n"
804 " - No circular subtree references (A->B->A)\n"
805 " - All node types are properly nested\n"
806 " - Tree structure matches behavior tree semantics\n\n"
808 " - No structural validation performed\n"
809 " - Faster parsing (minimal performance gain)\n"
810 " - MAY allow invalid trees that crash at runtime\n"
811 " - Use ONLY if you're 100% certain trees are valid\n\n"
812 "BENEFITS OF ENABLING:\n"
813 " - Catches errors EARLY during file loading\n"
814 " - Prevents mysterious runtime crashes\n"
815 " - Provides CLEAR, actionable error messages\n"
816 " - Saves debugging time\n\n"
818 "Keep this ENABLED, especially during development!";
819 HelpDialog dlg(
this,
"Validate Tree Structure - Help", helpText);
822 labelSizer6->Add(infoBtn6, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
826 sizer->Add(labelSizer6, wxGBPosition(row, 0), wxGBSpan(1, 2));
830 wxBoxSizer *labelSizer7 =
new wxBoxSizer(wxHORIZONTAL);
831 wxBitmapButton *infoBtn7 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
832 wxBORDER_NONE | wxBU_EXACTFIT);
833 infoBtn7->SetBitmapHover(infoHover);
834 infoBtn7->SetBitmapPressed(infoPressed);
835 infoBtn7->SetBitmapDisabled(infoDisabled);
836 infoBtn7->SetToolTip(
"Click for detailed information");
837 infoBtn7->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
838 wxString helpText =
"REQUIRE ROOT NODE\n"
839 "===========================================================\n\n"
840 "Determines whether each behavior tree must have at least one\n"
841 "root node (a direct child of the BehaviorTree element).\n\n"
842 "ENABLED (Recommended):\n"
843 " - Each tree MUST contain at least one root-level node\n"
844 " - Empty trees are REJECTED during parsing\n"
845 " - Ensures all trees are executable and meaningful\n"
846 " - Catches incomplete or placeholder trees\n"
847 " - Standard for production-ready behavior trees\n\n"
849 " - Empty trees are ALLOWED (no root node required)\n"
850 " - Useful for template/stub trees during development\n"
851 " - May allow non-functional tree structures\n"
852 " - Could lead to runtime issues if tree is called\n\n"
853 "EXAMPLE (VALID - with root):\n"
854 " <BehaviorTree ID=\"MainTree\">\n"
855 " <Sequence> <!-- ROOT NODE (direct child) -->\n"
856 " <Action name=\"DoSomething\"/>\n"
858 " </BehaviorTree>\n\n"
859 "EXAMPLE (INVALID - no root):\n"
860 " <BehaviorTree ID=\"EmptyTree\">\n"
861 " <!-- No nodes! -->\n"
862 " </BehaviorTree>\n\n"
864 "Keep ENABLED to ensure all trees are complete and executable!";
865 HelpDialog dlg(
this,
"Require Root Node - Help", helpText);
868 labelSizer7->Add(infoBtn7, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
872 sizer->Add(labelSizer7, wxGBPosition(row, 0), wxGBSpan(1, 2));
875 sizer->AddGrowableCol(1);
876 panel->SetSizer(sizer);
881 wxPanel *panel =
new wxPanel(notebook);
882 wxGridBagSizer *sizer =
new wxGridBagSizer(5, 5);
885 wxBitmap infoNormal(
GetResourcePath(
"buttons/info/Info_Normal_20.png"), wxBITMAP_TYPE_PNG);
886 wxBitmap infoHover(
GetResourcePath(
"buttons/info/Info_Hovered_20.png"), wxBITMAP_TYPE_PNG);
887 wxBitmap infoPressed(
GetResourcePath(
"buttons/info/Info_Pressed_20.png"), wxBITMAP_TYPE_PNG);
888 wxBitmap infoDisabled(
GetResourcePath(
"buttons/info/Info_Disabled_20.png"), wxBITMAP_TYPE_PNG);
893 wxBoxSizer *labelSizer1 =
new wxBoxSizer(wxHORIZONTAL);
894 wxBitmapButton *infoBtn1 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
895 wxBORDER_NONE | wxBU_EXACTFIT);
896 infoBtn1->SetBitmapHover(infoHover);
897 infoBtn1->SetBitmapPressed(infoPressed);
898 infoBtn1->SetBitmapDisabled(infoDisabled);
899 infoBtn1->SetToolTip(
"Click for detailed information");
900 infoBtn1->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
901 wxString helpText =
"CONTROL NODE ELEMENT\n"
902 "===========================================================\n\n"
904 "The XML element name that represents control flow nodes - nodes that\n"
905 "control the execution order and logic of their children.\n\n"
907 " - 'Control' - Generic control node element\n"
908 " - Leave empty to use specific names (Sequence, Selector, etc.)\n\n"
909 "CONTROL NODE TYPES:\n"
910 "Control nodes determine HOW and WHEN child nodes execute:\n"
911 " - Sequence: Execute children in order until one fails\n"
912 " - Selector/Fallback: Execute children until one succeeds\n"
913 " - Parallel: Execute multiple children simultaneously\n"
914 " - Random: Execute children in random order\n\n"
916 "If set to 'Control':\n"
917 " <Control type=\"Sequence\">\n"
918 " <Action name=\"Step1\"/>\n"
919 " <Action name=\"Step2\"/>\n"
921 "If left empty (common in BehaviorTree.CPP):\n"
922 " <Sequence> <!-- Direct element name -->\n"
923 " <Action name=\"Step1\"/>\n"
926 "For BehaviorTree.CPP compatibility, leave empty and use\n"
927 "specific element names like <Sequence>, <Selector>, etc.";
928 HelpDialog dlg(
this,
"Control Node Element - Help", helpText);
931 labelSizer1->Add(infoBtn1, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
932 labelSizer1->Add(
new wxStaticText(panel, wxID_ANY,
"Control Node Element:"), 0, wxALIGN_CENTER_VERTICAL);
933 sizer->Add(labelSizer1, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
935 m_controlElement->SetToolTip(
"Element name for control nodes (e.g., 'Control')");
937 sizer->Add(
m_controlElement, wxGBPosition(row, 1), wxDefaultSpan, wxEXPAND);
941 wxBoxSizer *labelSizer2 =
new wxBoxSizer(wxHORIZONTAL);
942 wxBitmapButton *infoBtn2 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
943 wxBORDER_NONE | wxBU_EXACTFIT);
944 infoBtn2->SetBitmapHover(infoHover);
945 infoBtn2->SetBitmapPressed(infoPressed);
946 infoBtn2->SetBitmapDisabled(infoDisabled);
947 infoBtn2->SetToolTip(
"Click for detailed information");
948 infoBtn2->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
949 wxString helpText =
"ACTION NODE ELEMENT\n"
950 "===========================================================\n\n"
952 "The XML element name that represents action nodes - nodes that\n"
953 "perform actual tasks or operations in your behavior tree.\n\n"
955 " - 'Action' - Standard BehaviorTree.CPP format\n"
956 " - 'Task' - Alternative naming\n"
957 " - 'Do' - Simple variant\n\n"
958 "WHAT ARE ACTION NODES?\n"
959 "Actions are the LEAF NODES that do the actual work:\n"
960 " - Move to a position\n"
961 " - Play an animation\n"
962 " - Attack an enemy\n"
963 " - Wait for a duration\n"
964 " - Set a variable\n\n"
966 " - Have NO children (leaf nodes)\n"
967 " - Return SUCCESS, FAILURE, or RUNNING\n"
968 " - Contain the actual executable logic\n"
969 " - May take parameters via attributes\n\n"
971 " <BehaviorTree ID=\"PatrolAI\">\n"
973 " <Action name=\"MoveToWaypoint\"/>\n"
974 " <Action name=\"Wait\" duration=\"2.0\"/>\n"
975 " <Action name=\"LookAround\"/>\n"
977 " </BehaviorTree>\n\n"
979 "Use 'Action' for standard BehaviorTree.CPP compatibility.";
980 HelpDialog dlg(
this,
"Action Node Element - Help", helpText);
983 labelSizer2->Add(infoBtn2, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
984 labelSizer2->Add(
new wxStaticText(panel, wxID_ANY,
"Action Node Element:"), 0, wxALIGN_CENTER_VERTICAL);
985 sizer->Add(labelSizer2, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
987 m_actionElement->SetToolTip(
"Element name for action nodes (e.g., 'Action')");
989 sizer->Add(
m_actionElement, wxGBPosition(row, 1), wxDefaultSpan, wxEXPAND);
993 wxBoxSizer *labelSizer3 =
new wxBoxSizer(wxHORIZONTAL);
994 wxBitmapButton *infoBtn3 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
995 wxBORDER_NONE | wxBU_EXACTFIT);
996 infoBtn3->SetBitmapHover(infoHover);
997 infoBtn3->SetBitmapPressed(infoPressed);
998 infoBtn3->SetBitmapDisabled(infoDisabled);
999 infoBtn3->SetToolTip(
"Click for detailed information");
1000 infoBtn3->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
1001 wxString helpText =
"CONDITION NODE ELEMENT\n"
1002 "===========================================================\n\n"
1004 "The XML element name that represents condition nodes - nodes that\n"
1005 "check/test a state and return SUCCESS or FAILURE immediately.\n\n"
1007 " - 'Condition' - Standard BehaviorTree.CPP format\n"
1008 " - 'Check' - Alternative naming\n"
1009 " - 'Test' - Some implementations\n\n"
1010 "WHAT ARE CONDITION NODES?\n"
1011 "Conditions are LEAF NODES that perform instant checks:\n"
1012 " - Is enemy in range?\n"
1013 " - Is health below 50%?\n"
1014 " - Is door open?\n"
1015 " - Has item in inventory?\n"
1016 " - Is time > X?\n\n"
1017 "KEY CHARACTERISTICS:\n"
1018 " - Have NO children (leaf nodes)\n"
1019 " - Execute INSTANTLY (never return RUNNING)\n"
1020 " - Return only SUCCESS or FAILURE\n"
1021 " - Used for decision-making logic\n"
1022 " - Often used with Selectors for branching\n\n"
1026 " <Condition name=\"IsEnemyClose\"/>\n"
1027 " <Action name=\"Attack\"/>\n"
1029 " <Action name=\"Patrol\"/>\n"
1032 "Use 'Condition' for standard BehaviorTree.CPP compatibility.";
1033 HelpDialog dlg(
this,
"Condition Node Element - Help", helpText);
1036 labelSizer3->Add(infoBtn3, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
1037 labelSizer3->Add(
new wxStaticText(panel, wxID_ANY,
"Condition Node Element:"), 0, wxALIGN_CENTER_VERTICAL);
1038 sizer->Add(labelSizer3, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
1040 m_conditionElement->SetToolTip(
"Element name for condition nodes (e.g., 'Condition')");
1046 wxBoxSizer *labelSizer4 =
new wxBoxSizer(wxHORIZONTAL);
1047 wxBitmapButton *infoBtn4 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
1048 wxBORDER_NONE | wxBU_EXACTFIT);
1049 infoBtn4->SetBitmapHover(infoHover);
1050 infoBtn4->SetBitmapPressed(infoPressed);
1051 infoBtn4->SetBitmapDisabled(infoDisabled);
1052 infoBtn4->SetToolTip(
"Click for detailed information");
1053 infoBtn4->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
1054 wxString helpText =
"DECORATOR NODE ELEMENT\n"
1055 "===========================================================\n\n"
1057 "The XML element name that represents decorator nodes - nodes that\n"
1058 "modify or enhance the behavior of EXACTLY ONE child node.\n\n"
1060 " - 'Decorator' - Generic decorator element\n"
1061 " - Leave empty to use specific names (Inverter, Retry, etc.)\n\n"
1062 "WHAT ARE DECORATOR NODES?\n"
1063 "Decorators WRAP a single child and modify its behavior:\n"
1064 " - Inverter: Flip SUCCESS <-> FAILURE\n"
1065 " - Retry: Repeat child until success (N times)\n"
1066 " - Repeat: Execute child multiple times\n"
1067 " - Force Success/Failure: Override child's result\n"
1068 " - Timeout: Fail child if it takes too long\n"
1069 " - Delay: Wait before executing child\n\n"
1070 "KEY CHARACTERISTICS:\n"
1071 " - Must have EXACTLY ONE child\n"
1072 " - Act as a wrapper/modifier\n"
1073 " - Don't change the tree structure\n"
1074 " - Commonly used for logic inversion and retries\n\n"
1077 " <Inverter> <!-- Decorator: flips result -->\n"
1078 " <Condition name=\"IsEnemyClose\"/>\n"
1080 " <Action name=\"Patrol\"/>\n"
1083 "Leave empty and use specific names like <Inverter>, <Retry>.";
1084 HelpDialog dlg(
this,
"Decorator Node Element - Help", helpText);
1087 labelSizer4->Add(infoBtn4, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
1088 labelSizer4->Add(
new wxStaticText(panel, wxID_ANY,
"Decorator Node Element:"), 0, wxALIGN_CENTER_VERTICAL);
1089 sizer->Add(labelSizer4, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
1091 m_decoratorElement->SetToolTip(
"Element name for decorator nodes (e.g., 'Decorator')");
1097 wxBoxSizer *labelSizer5 =
new wxBoxSizer(wxHORIZONTAL);
1098 wxBitmapButton *infoBtn5 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
1099 wxBORDER_NONE | wxBU_EXACTFIT);
1100 infoBtn5->SetBitmapHover(infoHover);
1101 infoBtn5->SetBitmapPressed(infoPressed);
1102 infoBtn5->SetBitmapDisabled(infoDisabled);
1103 infoBtn5->SetToolTip(
"Click for detailed information");
1104 infoBtn5->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
1105 wxString helpText =
"GENERIC NODE ELEMENT\n"
1106 "===========================================================\n\n"
1108 "A fallback element name used when a node doesn't match any\n"
1109 "of the specific node type elements (Control, Action, etc.).\n\n"
1111 " - 'Node' - Simple generic name\n"
1112 " - Leave empty if not needed\n\n"
1113 "WHEN IS IT USED?\n"
1114 "This acts as a catch-all for nodes that don't fit standard categories:\n"
1115 " - Custom node types specific to your implementation\n"
1116 " - Experimental or plugin nodes\n"
1117 " - Nodes that need runtime type determination\n\n"
1119 "Parser checks elements in this order:\n"
1120 " 1. Is it a Control node? (e.g., <Sequence>)\n"
1121 " 2. Is it an Action node? (e.g., <Action>)\n"
1122 " 3. Is it a Condition node? (e.g., <Condition>)\n"
1123 " 4. Is it a Decorator node? (e.g., <Inverter>)\n"
1124 " 5. Is it the Generic element? (e.g., <Node>)\n"
1125 " 6. Unknown element (error or ignored)\n\n"
1127 " <Node type=\"CustomPlugin\" name=\"SpecialBehavior\">\n"
1128 " <!-- Custom implementation -->\n"
1131 "Leave empty unless you have custom node types that don't\n"
1132 "fit the standard categories.";
1133 HelpDialog dlg(
this,
"Generic Node Element - Help", helpText);
1136 labelSizer5->Add(infoBtn5, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
1137 labelSizer5->Add(
new wxStaticText(panel, wxID_ANY,
"Generic Node Element:"), 0, wxALIGN_CENTER_VERTICAL);
1138 sizer->Add(labelSizer5, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
1146 wxBoxSizer *labelSizer6 =
new wxBoxSizer(wxHORIZONTAL);
1147 wxBitmapButton *infoBtn6 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
1148 wxBORDER_NONE | wxBU_EXACTFIT);
1149 infoBtn6->SetBitmapHover(infoHover);
1150 infoBtn6->SetBitmapPressed(infoPressed);
1151 infoBtn6->SetBitmapDisabled(infoDisabled);
1152 infoBtn6->SetToolTip(
"Click for detailed information");
1153 infoBtn6->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
1154 wxString helpText =
"NODE ID ATTRIBUTE\n"
1155 "===========================================================\n\n"
1157 "The XML attribute name that identifies the specific TYPE or\n"
1158 "CLASS of a node (e.g., 'Sequence', 'MoveToTarget', 'IsHealthLow').\n\n"
1160 " - 'ID' - BehaviorTree.CPP standard\n"
1161 " - 'type' - Alternative common usage\n"
1162 " - 'class' - Some implementations\n\n"
1163 "WHAT DOES IT CONTAIN?\n"
1164 "The ID typically specifies the node's TYPE/CLASS:\n"
1165 " - For Control: 'Sequence', 'Selector', 'Parallel'\n"
1166 " - For Action: 'MoveToTarget', 'Attack', 'PlayAnimation'\n"
1167 " - For Condition: 'IsHealthLow', 'IsEnemyNear'\n"
1168 " - For Decorator: 'Inverter', 'Retry', 'Timeout'\n\n"
1169 "EXAMPLE (using ID='type'):\n"
1170 " <Control ID=\"Sequence\">\n"
1171 " <Action ID=\"MoveToWaypoint\" target=\"wp1\"/>\n"
1172 " <Action ID=\"Wait\" duration=\"2.0\"/>\n"
1174 "vs EXAMPLE (element name is type):\n"
1176 " <MoveToWaypoint target=\"wp1\"/>\n"
1177 " <Wait duration=\"2.0\"/>\n"
1180 "Use 'ID' for BehaviorTree.CPP compatibility when using\n"
1181 "generic element names. Leave empty if using specific\n"
1182 "element names for each node type.";
1183 HelpDialog dlg(
this,
"Node ID Attribute - Help", helpText);
1186 labelSizer6->Add(infoBtn6, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
1187 labelSizer6->Add(
new wxStaticText(panel, wxID_ANY,
"Node ID Attribute:"), 0, wxALIGN_CENTER_VERTICAL);
1188 sizer->Add(labelSizer6, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
1190 m_nodeIdAttr->SetToolTip(
"Attribute name for node identifier/type (e.g., 'ID')");
1192 sizer->Add(
m_nodeIdAttr, wxGBPosition(row, 1), wxDefaultSpan, wxEXPAND);
1196 wxBoxSizer *labelSizer7 =
new wxBoxSizer(wxHORIZONTAL);
1197 wxBitmapButton *infoBtn7 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
1198 wxBORDER_NONE | wxBU_EXACTFIT);
1199 infoBtn7->SetBitmapHover(infoHover);
1200 infoBtn7->SetBitmapPressed(infoPressed);
1201 infoBtn7->SetBitmapDisabled(infoDisabled);
1202 infoBtn7->SetToolTip(
"Click for detailed information");
1203 infoBtn7->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
1204 wxString helpText =
"NODE NAME ATTRIBUTE\n"
1205 "===========================================================\n\n"
1207 "The XML attribute name that provides a human-readable display\n"
1208 "name or label for a node instance.\n\n"
1210 " - 'name' - Most common standard\n"
1211 " - 'label' - Alternative\n"
1212 " - 'displayName' - Explicit variant\n\n"
1213 "WHAT'S THE DIFFERENCE FROM NODE ID?\n"
1214 " - Node ID: The TYPE/CLASS of the node (e.g., 'MoveToTarget')\n"
1215 " - Node Name: A specific INSTANCE label (e.g., 'Move to Enemy')\n\n"
1217 " - Provide descriptive labels in visual editors\n"
1218 " - Make trees more readable in XML\n"
1219 " - Help with debugging and logging\n"
1220 " - Distinguish between multiple instances of same node type\n\n"
1222 " <Action ID=\"MoveToTarget\" name=\"Move to Waypoint 1\">\n"
1223 " ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^\n"
1224 " Node type/class Human-readable name\n"
1226 " <Action ID=\"MoveToTarget\" name=\"Return to Base\">\n"
1227 " Same type Different instance name\n\n"
1228 "IN VISUAL EDITOR:\n"
1229 "The 'name' would be displayed on the node box, making the\n"
1230 "tree easier to understand at a glance.\n\n"
1232 "Use 'name' for standard compatibility and readability.";
1233 HelpDialog dlg(
this,
"Node Name Attribute - Help", helpText);
1236 labelSizer7->Add(infoBtn7, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
1237 labelSizer7->Add(
new wxStaticText(panel, wxID_ANY,
"Node Name Attribute:"), 0, wxALIGN_CENTER_VERTICAL);
1238 sizer->Add(labelSizer7, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
1240 m_nodeNameAttr->SetToolTip(
"Attribute name for node display name (e.g., 'name')");
1242 sizer->Add(
m_nodeNameAttr, wxGBPosition(row, 1), wxDefaultSpan, wxEXPAND);
1246 wxBoxSizer *labelSizer8 =
new wxBoxSizer(wxHORIZONTAL);
1247 wxBitmapButton *infoBtn8 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
1248 wxBORDER_NONE | wxBU_EXACTFIT);
1249 infoBtn8->SetBitmapHover(infoHover);
1250 infoBtn8->SetBitmapPressed(infoPressed);
1251 infoBtn8->SetBitmapDisabled(infoDisabled);
1252 infoBtn8->SetToolTip(
"Click for detailed information");
1253 infoBtn8->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
1254 wxString helpText =
"NODE TYPE ATTRIBUTE\n"
1255 "===========================================================\n\n"
1257 "An ALTERNATIVE attribute used for by-attribute node classification,\n"
1258 "where node category is specified via attribute instead of element name.\n\n"
1260 " - 'type' - Most common\n"
1261 " - 'category' - Alternative\n"
1262 " - 'nodeType' - Explicit variant\n\n"
1263 "WHEN IS THIS USED?\n"
1264 "Some XML formats use a SINGLE generic element with a type attribute\n"
1265 "instead of different elements for each node category:\n\n"
1266 "BY-ELEMENT APPROACH (most common):\n"
1268 " <Action name=\"Move\"/>\n"
1269 " <Condition name=\"IsClose\"/>\n"
1271 "BY-ATTRIBUTE APPROACH:\n"
1272 " <Node type=\"Sequence\">\n"
1273 " <Node type=\"Action\" name=\"Move\"/>\n"
1274 " <Node type=\"Condition\" name=\"IsClose\"/>\n"
1277 " This attribute specifies node category\n\n"
1278 "ATTRIBUTE VALUES:\n"
1279 " - 'Control', 'Action', 'Condition', 'Decorator'\n"
1280 " - Used by parser to classify nodes\n\n"
1282 "Only use this if your XML format uses by-attribute\n"
1283 "classification. Leave empty for standard element-based\n"
1284 "classification (BehaviorTree.CPP style).";
1285 HelpDialog dlg(
this,
"Node Type Attribute - Help", helpText);
1288 labelSizer8->Add(infoBtn8, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
1289 labelSizer8->Add(
new wxStaticText(panel, wxID_ANY,
"Node Type Attribute:"), 0, wxALIGN_CENTER_VERTICAL);
1290 sizer->Add(labelSizer8, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
1292 m_nodeTypeAttr->SetToolTip(
"Attribute name for node type (used in by-attribute classification)");
1294 sizer->Add(
m_nodeTypeAttr, wxGBPosition(row, 1), wxDefaultSpan, wxEXPAND);
1298 wxBoxSizer *labelSizer9 =
new wxBoxSizer(wxHORIZONTAL);
1299 wxBitmapButton *infoBtn9 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
1300 wxBORDER_NONE | wxBU_EXACTFIT);
1301 infoBtn9->SetBitmapHover(infoHover);
1302 infoBtn9->SetBitmapPressed(infoPressed);
1303 infoBtn9->SetBitmapDisabled(infoDisabled);
1304 infoBtn9->SetToolTip(
"Click for detailed information");
1305 infoBtn9->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
1306 wxString helpText =
"ALLOW CUSTOM ATTRIBUTES\n"
1307 "===========================================================\n\n"
1308 "Controls whether the parser preserves and stores custom/additional\n"
1309 "attributes found on nodes beyond the standard configuration attributes.\n\n"
1310 "ENABLED (Recommended):\n"
1311 " - ALL attributes on nodes are parsed and stored\n"
1312 " - Custom parameters are preserved for runtime use\n"
1313 " - Enables flexible node parameterization\n"
1314 " - Required for most practical behavior trees\n\n"
1316 " - Only recognized/standard attributes are stored\n"
1317 " - Custom attributes are IGNORED during parsing\n"
1318 " - Stricter validation, but less flexible\n"
1319 " - May lose important node parameters\n\n"
1320 "EXAMPLE (custom attributes in bold concept):\n"
1321 " <Action name=\"MoveToTarget\" \n"
1322 " speed=\"5.0\" <!-- Custom attribute -->\n"
1323 " target=\"enemy\" <!-- Custom attribute -->\n"
1324 " acceptableRadius=\"2.0\"> <!-- Custom -->\n\n"
1326 " - Actions/Conditions need parameters to work\n"
1327 " - Different node instances need different values\n"
1328 " - Runtime system reads these for behavior\n"
1329 " - Standard in BehaviorTree.CPP and most frameworks\n\n"
1331 "KEEP THIS ENABLED! Most behavior trees require custom\n"
1332 "attributes for node parameters, making trees functional\n"
1333 "and configurable.";
1334 HelpDialog dlg(
this,
"Allow Custom Attributes - Help", helpText);
1337 labelSizer9->Add(infoBtn9, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
1341 sizer->Add(labelSizer9, wxGBPosition(row, 0), wxGBSpan(1, 2));
1344 sizer->AddGrowableCol(1);
1345 panel->SetSizer(sizer);
1350 wxPanel *panel =
new wxPanel(notebook);
1351 wxBoxSizer *mainSizer =
new wxBoxSizer(wxVERTICAL);
1354 wxBitmap infoNormal(
GetResourcePath(
"buttons/info/Info_Normal_20.png"), wxBITMAP_TYPE_PNG);
1355 wxBitmap infoHover(
GetResourcePath(
"buttons/info/Info_Hovered_20.png"), wxBITMAP_TYPE_PNG);
1356 wxBitmap infoPressed(
GetResourcePath(
"buttons/info/Info_Pressed_20.png"), wxBITMAP_TYPE_PNG);
1357 wxBitmap infoDisabled(
GetResourcePath(
"buttons/info/Info_Disabled_20.png"), wxBITMAP_TYPE_PNG);
1360 wxBoxSizer *strategySizer =
new wxBoxSizer(wxHORIZONTAL);
1362 wxBitmapButton *infoBtn1 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
1363 wxBORDER_NONE | wxBU_EXACTFIT);
1364 infoBtn1->SetBitmapHover(infoHover);
1365 infoBtn1->SetBitmapPressed(infoPressed);
1366 infoBtn1->SetBitmapDisabled(infoDisabled);
1367 infoBtn1->SetToolTip(
"Click for detailed information");
1368 infoBtn1->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
1369 wxString helpText =
"CLASSIFICATION STRATEGY\n"
1370 "===========================================================\n\n"
1371 "Determines HOW the parser identifies what type of node it's dealing\n"
1372 "with when reading your XML.\n\n"
1373 "THREE STRATEGIES:\n\n"
1374 "1. BY ELEMENT NAME (Most Common)\n"
1375 " - Node type is determined by the XML element name itself\n"
1376 " - Different elements for different types\n"
1378 " <Sequence> <!-- Control node -->\n"
1379 " <Action name=\"Move\"/> <!-- Action node -->\n"
1380 " <Condition name=\"Check\"/> <!-- Condition node -->\n"
1382 " Pros: Clean, readable XML; standard in BehaviorTree.CPP\n"
1383 " Use when: You want clear, self-documenting trees\n\n"
1385 " - Single generic element with 'type' attribute\n"
1386 " - All nodes use the same element name\n"
1388 " <Node type=\"Sequence\">\n"
1389 " <Node type=\"Action\" name=\"Move\"/>\n"
1390 " <Node type=\"Condition\" name=\"Check\"/>\n"
1392 " Pros: Uniform structure; easier schema validation\n"
1393 " Use when: You need strict XML schema conformance\n\n"
1395 " - Mix of both approaches\n"
1396 " - Checks element name first, falls back to attribute\n"
1398 " <Sequence> <!-- By element name -->\n"
1399 " <Node type=\"Action\" name=\"Custom\"/> <!-- By attribute -->\n"
1400 " <Condition name=\"Check\"/> <!-- By element name -->\n"
1402 " Pros: Maximum flexibility; supports mixed formats\n"
1403 " Use when: Working with multiple XML formats\n\n"
1405 "Use 'By Element Name' for standard BehaviorTree.CPP compatibility\n"
1406 "and maximum readability.";
1407 HelpDialog dlg(
this,
"Classification Strategy - Help", helpText);
1410 strategySizer->Add(infoBtn1, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
1411 strategySizer->Add(
new wxStaticText(panel, wxID_ANY,
"Classification Strategy:"), 0,
1412 wxALIGN_CENTER_VERTICAL | wxALL, 5);
1413 wxArrayString strategyChoices;
1414 strategyChoices.Add(
"By Element Name");
1415 strategyChoices.Add(
"By Attribute");
1416 strategyChoices.Add(
"Hybrid");
1420 mainSizer->Add(strategySizer, 0, wxEXPAND);
1423 wxBoxSizer *listsHeaderSizer =
new wxBoxSizer(wxHORIZONTAL);
1426 wxBitmap infoNormal4(
GetResourcePath(
"buttons/info/Info_Normal_20.png"), wxBITMAP_TYPE_PNG);
1427 wxBitmap infoHover4(
GetResourcePath(
"buttons/info/Info_Hovered_20.png"), wxBITMAP_TYPE_PNG);
1428 wxBitmap infoPressed4(
GetResourcePath(
"buttons/info/Info_Pressed_20.png"), wxBITMAP_TYPE_PNG);
1429 wxBitmap infoDisabled4(
GetResourcePath(
"buttons/info/Info_Disabled_20.png"), wxBITMAP_TYPE_PNG);
1431 wxBitmapButton *infoBtn4 =
new wxBitmapButton(panel, wxID_ANY, infoNormal4, wxDefaultPosition, wxSize(40, 40),
1432 wxBORDER_NONE | wxBU_EXACTFIT);
1433 infoBtn4->SetBitmapHover(infoHover4);
1434 infoBtn4->SetBitmapPressed(infoPressed4);
1435 infoBtn4->SetBitmapDisabled(infoDisabled4);
1436 infoBtn4->SetToolTip(
"Click for detailed information");
1437 infoBtn4->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
1438 wxString helpText =
"NODE TYPE LISTS\n"
1439 "===========================================================\n\n"
1440 "These lists define the SPECIFIC NODE TYPES recognized in each\n"
1441 "category. Used for element-name and attribute-based classification.\n\n"
1443 "When the parser encounters a node, it checks if the node's name\n"
1444 "(element or attribute value) appears in one of these lists to\n"
1445 "determine its category.\n\n"
1446 "FOUR CATEGORIES:\n\n"
1447 "1. CONTROL TYPES (Required)\n"
1448 " Flow control nodes that manage child execution\n"
1449 " Common examples:\n"
1450 " - Sequence, Selector, Fallback\n"
1451 " - Parallel, ParallelSequence\n"
1452 " - ReactiveSequence, ReactiveFallback\n"
1453 " - IfThenElse, Switch, WhileDoElse\n"
1454 " These nodes MUST have at least one child\n\n"
1455 "2. DECORATOR TYPES (Required)\n"
1456 " Wrapper nodes that modify a single child's behavior\n"
1457 " Common examples:\n"
1458 " - Inverter, ForceSuccess, ForceFailure\n"
1459 " - Retry, Repeat, RepeatUntilSuccess\n"
1460 " - Timeout, Delay\n"
1461 " - KeepRunningUntilFailure\n"
1462 " These nodes MUST have exactly one child\n\n"
1463 "3. ACTION TYPES (Optional)\n"
1464 " Leaf nodes that perform tasks\n"
1465 " Common examples:\n"
1466 " - MoveToTarget, Attack, Wait\n"
1467 " - PlayAnimation, SetBlackboard\n"
1468 " - Custom action nodes\n"
1469 " Leave empty to allow any non-classified leaf as Action\n\n"
1470 "4. CONDITION TYPES (Optional)\n"
1471 " Leaf nodes that check state (instant, no RUNNING)\n"
1472 " Common examples:\n"
1473 " - IsHealthLow, IsEnemyInRange\n"
1474 " - CheckBlackboard, IsBoolTrue\n"
1475 " - Custom condition nodes\n"
1476 " Leave empty to allow any non-classified leaf as Condition\n\n"
1478 " 1. Click '+' button\n"
1479 " 2. Enter the exact node type name\n"
1480 " 3. Case-sensitive (usually)\n\n"
1481 "EXAMPLE CLASSIFICATION:\n"
1482 " Lists: Control=[Sequence, Selector], Decorator=[Inverter]\n"
1483 " XML: <Sequence> -> Control (in list)\n"
1484 " XML: <Inverter> -> Decorator (in list)\n"
1485 " XML: <CustomAction> -> Action (not in any list)\n\n"
1487 "Always define Control and Decorator types. Leave Action/Condition\n"
1488 "empty for maximum flexibility unless you need strict validation.";
1489 HelpDialog dlg(
this,
"Node Type Lists - Help", helpText);
1492 listsHeaderSizer->Add(infoBtn4, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
1493 wxStaticText *listsLabel =
new wxStaticText(panel, wxID_ANY,
"Node Type Recognition Lists:");
1494 wxFont font = listsLabel->GetFont();
1495 font.SetWeight(wxFONTWEIGHT_BOLD);
1496 listsLabel->SetFont(font);
1497 listsHeaderSizer->Add(listsLabel, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
1498 mainSizer->Add(listsHeaderSizer, 0, wxEXPAND);
1501 wxBoxSizer *listsGrid =
new wxBoxSizer(wxHORIZONTAL);
1504 wxStaticBoxSizer *controlBox =
new wxStaticBoxSizer(wxVERTICAL, panel,
"Control Types");
1507 wxBoxSizer *controlBtnSizer =
new wxBoxSizer(wxHORIZONTAL);
1512 controlBox->Add(controlBtnSizer, 0, wxEXPAND);
1513 listsGrid->Add(controlBox, 1, wxEXPAND | wxALL, 5);
1516 wxStaticBoxSizer *decoratorBox =
new wxStaticBoxSizer(wxVERTICAL, panel,
"Decorator Types");
1519 wxBoxSizer *decoratorBtnSizer =
new wxBoxSizer(wxHORIZONTAL);
1524 decoratorBox->Add(decoratorBtnSizer, 0, wxEXPAND);
1525 listsGrid->Add(decoratorBox, 1, wxEXPAND | wxALL, 5);
1527 mainSizer->Add(listsGrid, 1, wxEXPAND);
1530 wxBoxSizer *listsGrid2 =
new wxBoxSizer(wxHORIZONTAL);
1533 wxStaticBoxSizer *actionBox =
new wxStaticBoxSizer(wxVERTICAL, panel,
"Action Types (optional)");
1536 wxBoxSizer *actionBtnSizer =
new wxBoxSizer(wxHORIZONTAL);
1541 actionBox->Add(actionBtnSizer, 0, wxEXPAND);
1542 listsGrid2->Add(actionBox, 1, wxEXPAND | wxALL, 5);
1545 wxStaticBoxSizer *conditionBox =
new wxStaticBoxSizer(wxVERTICAL, panel,
"Condition Types (optional)");
1548 wxBoxSizer *conditionBtnSizer =
new wxBoxSizer(wxHORIZONTAL);
1553 conditionBox->Add(conditionBtnSizer, 0, wxEXPAND);
1554 listsGrid2->Add(conditionBox, 1, wxEXPAND | wxALL, 5);
1556 mainSizer->Add(listsGrid2, 1, wxEXPAND);
1559 wxBoxSizer *unknownSizer =
new wxBoxSizer(wxHORIZONTAL);
1562 wxBitmap infoNormal2(
GetResourcePath(
"buttons/info/Info_Normal_20.png"), wxBITMAP_TYPE_PNG);
1563 wxBitmap infoHover2(
GetResourcePath(
"buttons/info/Info_Hovered_20.png"), wxBITMAP_TYPE_PNG);
1564 wxBitmap infoPressed2(
GetResourcePath(
"buttons/info/Info_Pressed_20.png"), wxBITMAP_TYPE_PNG);
1565 wxBitmap infoDisabled2(
GetResourcePath(
"buttons/info/Info_Disabled_20.png"), wxBITMAP_TYPE_PNG);
1567 wxBitmapButton *infoBtn2 =
new wxBitmapButton(panel, wxID_ANY, infoNormal2, wxDefaultPosition, wxSize(40, 40),
1568 wxBORDER_NONE | wxBU_EXACTFIT);
1569 infoBtn2->SetBitmapHover(infoHover2);
1570 infoBtn2->SetBitmapPressed(infoPressed2);
1571 infoBtn2->SetBitmapDisabled(infoDisabled2);
1572 infoBtn2->SetToolTip(
"Click for detailed information");
1573 infoBtn2->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
1574 wxString helpText =
"UNKNOWN TYPE BEHAVIOR\n"
1575 "===========================================================\n\n"
1576 "Determines what happens when the parser encounters a node type\n"
1577 "that is NOT in your defined type lists (Control, Decorator, etc.).\n\n"
1578 "THREE OPTIONS:\n\n"
1579 "1. ERROR (Strict - Recommended for Development)\n"
1580 " - Parser STOPS and reports an error\n"
1581 " - File loading FAILS\n"
1582 " - Ensures all node types are explicitly defined\n"
1583 " Example: <UnknownNode/> causes parsing to fail\n"
1585 " - Developing new trees - catch typos early\n"
1586 " - Want strict validation\n"
1587 " - Need to ensure only known types are used\n\n"
1588 "2. WARNING (Permissive)\n"
1589 " - Parser CONTINUES but logs a warning\n"
1590 " - File loads successfully\n"
1591 " - Unknown node is treated as Generic Node\n"
1592 " Example: <UnknownNode/> becomes a generic node + warning\n"
1594 " - Working with mixed/evolving formats\n"
1595 " - Want to see what's unrecognized but still load\n"
1596 " - Debugging format compatibility\n\n"
1597 "3. GENERIC NODE (Silent Fallback)\n"
1598 " - Parser treats unknown types as generic nodes\n"
1599 " - NO warning or error\n"
1600 " - Maximum compatibility\n"
1601 " Example: <UnknownNode/> silently becomes generic node\n"
1603 " - Working with highly variable XML formats\n"
1604 " - Want maximum flexibility\n"
1605 " - Already validated your trees externally\n\n"
1607 "Use ERROR during development to catch typos and undefined types.\n"
1608 "Use WARNING in production if you need to support evolving formats.";
1609 HelpDialog dlg(
this,
"Unknown Type Behavior - Help", helpText);
1612 unknownSizer->Add(infoBtn2, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
1613 unknownSizer->Add(
new wxStaticText(panel, wxID_ANY,
"Unknown Type Behavior:"), 0, wxALIGN_CENTER_VERTICAL | wxALL,
1615 wxArrayString unknownChoices;
1616 unknownChoices.Add(
"Error");
1617 unknownChoices.Add(
"Warning");
1618 unknownChoices.Add(
"Generic Node");
1619 m_unknownBehavior =
new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, unknownChoices);
1622 mainSizer->Add(unknownSizer, 0, wxEXPAND);
1625 wxBoxSizer *typeAttrSizer =
new wxBoxSizer(wxHORIZONTAL);
1628 wxBitmap infoNormal3(
GetResourcePath(
"buttons/info/Info_Normal_20.png"), wxBITMAP_TYPE_PNG);
1629 wxBitmap infoHover3(
GetResourcePath(
"buttons/info/Info_Hovered_20.png"), wxBITMAP_TYPE_PNG);
1630 wxBitmap infoPressed3(
GetResourcePath(
"buttons/info/Info_Pressed_20.png"), wxBITMAP_TYPE_PNG);
1631 wxBitmap infoDisabled3(
GetResourcePath(
"buttons/info/Info_Disabled_20.png"), wxBITMAP_TYPE_PNG);
1633 wxBitmapButton *infoBtn3 =
new wxBitmapButton(panel, wxID_ANY, infoNormal3, wxDefaultPosition, wxSize(40, 40),
1634 wxBORDER_NONE | wxBU_EXACTFIT);
1635 infoBtn3->SetBitmapHover(infoHover3);
1636 infoBtn3->SetBitmapPressed(infoPressed3);
1637 infoBtn3->SetBitmapDisabled(infoDisabled3);
1638 infoBtn3->SetToolTip(
"Click for detailed information");
1639 infoBtn3->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
1640 wxString helpText =
"TYPE ATTRIBUTE NAME\n"
1641 "===========================================================\n\n"
1642 "The XML attribute name used for by-attribute node classification.\n"
1643 "Only relevant when using 'By Attribute' or 'Hybrid' strategy.\n\n"
1645 "When using attribute-based classification, this attribute specifies\n"
1646 "the node category (Control, Action, Condition, Decorator).\n\n"
1648 " - 'type' - Most common standard\n"
1649 " - 'nodeType' - Explicit variant\n"
1650 " - 'category' - Alternative naming\n\n"
1652 "BY ATTRIBUTE STRATEGY:\n"
1653 " <Node type=\"Sequence\"> <!-- 'type' is the attribute -->\n"
1654 " <Node type=\"Action\" name=\"Move\"/>\n"
1655 " <Node type=\"Condition\" name=\"Check\"/>\n"
1657 " The parser reads the 'type' attribute to determine:\n"
1658 " - 'Sequence' -> Control node (from Control Types list)\n"
1659 " - 'Action' -> Action node (from Action Types list)\n"
1660 " - 'Condition' -> Condition node (from Condition Types list)\n\n"
1661 "HYBRID STRATEGY:\n"
1662 " <Sequence> <!-- Element name = Control -->\n"
1663 " <Node type=\"Action\" name=\"Custom\"/> <!-- Attribute -->\n"
1664 " <Condition name=\"Check\"/> <!-- Element name -->\n"
1666 " Parser checks element name first, falls back to attribute.\n\n"
1667 "BY ELEMENT NAME STRATEGY:\n"
1668 " This setting is IGNORED (not used)\n\n"
1669 "CLASSIFICATION FLOW:\n"
1670 " 1. Read node's type attribute value\n"
1671 " 2. Check if value is in Control Types -> Control node\n"
1672 " 3. Check if value is in Decorator Types -> Decorator node\n"
1673 " 4. Check if value is in Action Types -> Action node\n"
1674 " 5. Check if value is in Condition Types -> Condition node\n"
1675 " 6. Not found -> Apply Unknown Type Behavior\n\n"
1677 "Use 'type' for standard compatibility. Leave empty if using\n"
1678 "'By Element Name' strategy exclusively.";
1679 HelpDialog dlg(
this,
"Type Attribute Name - Help", helpText);
1682 typeAttrSizer->Add(infoBtn3, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
1683 typeAttrSizer->Add(
new wxStaticText(panel, wxID_ANY,
"Type Attribute Name:"), 0, wxALIGN_CENTER_VERTICAL | wxALL,
1686 m_typeAttrName->SetToolTip(
"Attribute name used for by-attribute classification");
1689 mainSizer->Add(typeAttrSizer, 0, wxEXPAND);
1691 panel->SetSizer(mainSizer);
1696 wxPanel *panel =
new wxPanel(notebook);
1697 wxBoxSizer *mainSizer =
new wxBoxSizer(wxVERTICAL);
1700 wxBitmap infoNormal(
GetResourcePath(
"buttons/info/Info_Normal_20.png"), wxBITMAP_TYPE_PNG);
1701 wxBitmap infoHover(
GetResourcePath(
"buttons/info/Info_Hovered_20.png"), wxBITMAP_TYPE_PNG);
1702 wxBitmap infoPressed(
GetResourcePath(
"buttons/info/Info_Pressed_20.png"), wxBITMAP_TYPE_PNG);
1703 wxBitmap infoDisabled(
GetResourcePath(
"buttons/info/Info_Disabled_20.png"), wxBITMAP_TYPE_PNG);
1706 wxGridBagSizer *basicSizer =
new wxGridBagSizer(5, 5);
1710 wxBoxSizer *labelSizer1 =
new wxBoxSizer(wxHORIZONTAL);
1711 wxBitmapButton *infoBtn1 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
1712 wxBORDER_NONE | wxBU_EXACTFIT);
1713 infoBtn1->SetBitmapHover(infoHover);
1714 infoBtn1->SetBitmapPressed(infoPressed);
1715 infoBtn1->SetBitmapDisabled(infoDisabled);
1716 infoBtn1->SetToolTip(
"Click for detailed information");
1717 infoBtn1->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
1718 wxString helpText =
"BLACKBOARD ELEMENT\n"
1719 "===========================================================\n\n"
1721 "The XML element name that represents a blackboard definition - a\n"
1722 "shared data storage that behavior trees use to store and access variables.\n\n"
1724 " - 'BlackboardModel' - BehaviorTree.CPP standard\n"
1725 " - 'Blackboard' - Simplified variant\n"
1726 " - 'Variables' - Alternative naming\n\n"
1727 "WHAT IS A BLACKBOARD?\n"
1728 "A blackboard is a KEY-VALUE data store that:\n"
1729 " - Stores variables shared across the behavior tree\n"
1730 " - Provides data for condition checks and actions\n"
1731 " - Can be defined once and used by multiple trees\n"
1732 " - Supports typed data (int, float, string, bool, etc.)\n\n"
1735 " <BlackboardModel ID=\"PlayerBlackboard\">\n"
1736 " <Entry key=\"health\" type=\"int\" value=\"100\"/>\n"
1737 " <Entry key=\"target\" type=\"string\"/>\n"
1738 " <Entry key=\"isAggressive\" type=\"bool\" value=\"false\"/>\n"
1739 " </BlackboardModel>\n\n"
1740 " <BehaviorTree ID=\"MainAI\" blackboard=\"PlayerBlackboard\">\n"
1741 " <!-- Tree uses the blackboard -->\n"
1742 " </BehaviorTree>\n"
1744 "WHY USE BLACKBOARDS?\n"
1745 " - Share data between different parts of the tree\n"
1746 " - Parameterize behavior trees for reusability\n"
1747 " - Type-safe data access\n"
1748 " - Runtime variable inspection and debugging";
1749 HelpDialog dlg(
this,
"Blackboard Element - Help", helpText);
1752 labelSizer1->Add(infoBtn1, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
1753 labelSizer1->Add(
new wxStaticText(panel, wxID_ANY,
"Blackboard Element:"), 0, wxALIGN_CENTER_VERTICAL);
1754 basicSizer->Add(labelSizer1, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
1761 wxBoxSizer *labelSizer2 =
new wxBoxSizer(wxHORIZONTAL);
1762 wxBitmapButton *infoBtn2 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
1763 wxBORDER_NONE | wxBU_EXACTFIT);
1764 infoBtn2->SetBitmapHover(infoHover);
1765 infoBtn2->SetBitmapPressed(infoPressed);
1766 infoBtn2->SetBitmapDisabled(infoDisabled);
1767 infoBtn2->SetToolTip(
"Click for detailed information");
1768 infoBtn2->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
1769 wxString helpText =
"BLACKBOARD ID ATTRIBUTE\n"
1770 "===========================================================\n\n"
1772 "The XML attribute name that contains the unique identifier for\n"
1773 "each blackboard definition.\n\n"
1775 " - 'ID' - Standard naming (most common)\n"
1776 " - 'name' - Alternative\n"
1777 " - 'id' - Lowercase variant\n\n"
1778 "WHY IS IT NEEDED?\n"
1780 " - Multiple blackboard definitions in one file\n"
1781 " - Behavior trees to reference specific blackboards\n"
1782 " - Blackboard inheritance (one extends another)\n"
1783 " - Runtime blackboard lookup by name\n\n"
1785 " <BlackboardModel ID=\"BaseAI\">\n"
1786 " <Entry key=\"speed\" type=\"float\" value=\"5.0\"/>\n"
1787 " </BlackboardModel>\n\n"
1788 " <BlackboardModel ID=\"EnemyAI\" parent=\"BaseAI\">\n"
1789 " <Entry key=\"health\" type=\"int\" value=\"100\"/>\n"
1790 " <!-- Inherits 'speed' from BaseAI -->\n"
1791 " </BlackboardModel>\n\n"
1792 " <BehaviorTree ID=\"Enemy\" blackboard=\"EnemyAI\">\n"
1793 " ^^^^^^^^^^^^^^^^^^^\n"
1794 " References blackboard by ID\n"
1795 " </BehaviorTree>\n\n"
1797 "Use 'ID' for consistency with BehaviorTree.CPP standard.";
1798 HelpDialog dlg(
this,
"Blackboard ID Attribute - Help", helpText);
1801 labelSizer2->Add(infoBtn2, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
1802 labelSizer2->Add(
new wxStaticText(panel, wxID_ANY,
"Blackboard ID Attribute:"), 0, wxALIGN_CENTER_VERTICAL);
1803 basicSizer->Add(labelSizer2, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
1810 wxBoxSizer *labelSizer3 =
new wxBoxSizer(wxHORIZONTAL);
1811 wxBitmapButton *infoBtn3 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
1812 wxBORDER_NONE | wxBU_EXACTFIT);
1813 infoBtn3->SetBitmapHover(infoHover);
1814 infoBtn3->SetBitmapPressed(infoPressed);
1815 infoBtn3->SetBitmapDisabled(infoDisabled);
1816 infoBtn3->SetToolTip(
"Click for detailed information");
1817 infoBtn3->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
1818 wxString helpText =
"PARENT/INHERITANCE ATTRIBUTE\n"
1819 "===========================================================\n\n"
1821 "The XML attribute name that specifies a parent blackboard from\n"
1822 "which the current blackboard inherits entries.\n\n"
1824 " - 'parent' - Most common\n"
1825 " - 'extends' - Object-oriented terminology\n"
1826 " - 'inherits' - Explicit naming\n"
1827 " - 'base' - Alternative\n\n"
1828 "HOW INHERITANCE WORKS:\n"
1829 "A child blackboard:\n"
1830 " - Inherits ALL entries from its parent\n"
1831 " - Can add NEW entries not in the parent\n"
1832 " - Can OVERRIDE parent entries with different defaults\n"
1833 " - Cannot remove parent entries\n\n"
1835 " <BlackboardModel ID=\"BaseCharacter\">\n"
1836 " <Entry key=\"health\" type=\"int\" value=\"100\"/>\n"
1837 " <Entry key=\"speed\" type=\"float\" value=\"5.0\"/>\n"
1838 " </BlackboardModel>\n\n"
1839 " <BlackboardModel ID=\"Player\" parent=\"BaseCharacter\">\n"
1840 " <Entry key=\"mana\" type=\"int\" value=\"50\"/>\n"
1841 " <Entry key=\"speed\" type=\"float\" value=\"7.0\"/>\n"
1842 " <!-- Inherits: health=100 (from parent) -->\n"
1843 " <!-- Overrides: speed=7.0 (not 5.0) -->\n"
1844 " <!-- Adds: mana=50 (new entry) -->\n"
1845 " </BlackboardModel>\n\n"
1847 " - Reduce duplication in blackboard definitions\n"
1848 " - Create base templates for common variables\n"
1849 " - Organize related blackboards hierarchically";
1850 HelpDialog dlg(
this,
"Parent/Inheritance Attribute - Help", helpText);
1853 labelSizer3->Add(infoBtn3, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
1854 labelSizer3->Add(
new wxStaticText(panel, wxID_ANY,
"Parent/Inheritance Attribute:"), 0, wxALIGN_CENTER_VERTICAL);
1855 basicSizer->Add(labelSizer3, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
1862 wxBoxSizer *labelSizer4 =
new wxBoxSizer(wxHORIZONTAL);
1863 wxBitmapButton *infoBtn4 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
1864 wxBORDER_NONE | wxBU_EXACTFIT);
1865 infoBtn4->SetBitmapHover(infoHover);
1866 infoBtn4->SetBitmapPressed(infoPressed);
1867 infoBtn4->SetBitmapDisabled(infoDisabled);
1868 infoBtn4->SetToolTip(
"Click for detailed information");
1869 infoBtn4->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
1870 wxString helpText =
"ENTRY ELEMENT\n"
1871 "===========================================================\n\n"
1873 "The XML element name that represents a single variable/entry\n"
1874 "within a blackboard definition.\n\n"
1876 " - 'Entry' - BehaviorTree.CPP standard\n"
1877 " - 'Variable' - Descriptive alternative\n"
1878 " - 'Field' - Object-oriented terminology\n"
1879 " - 'Property' - Another variant\n\n"
1880 "WHAT IS AN ENTRY?\n"
1881 "Each entry represents ONE variable in the blackboard:\n"
1882 " - Has a KEY (variable name)\n"
1883 " - Has a TYPE (int, float, string, bool, etc.)\n"
1884 " - May have a DEFAULT VALUE\n"
1885 " - Can be read/written by nodes during execution\n\n"
1887 " <BlackboardModel ID=\"GameAI\">\n"
1888 " <Entry key=\"playerHealth\" type=\"int\" value=\"100\"/>\n"
1889 " <Entry key=\"targetPosition\" type=\"Vector3\"/>\n"
1890 " <Entry key=\"isAlerted\" type=\"bool\" value=\"false\"/>\n"
1891 " <Entry key=\"patrolSpeed\" type=\"float\" value=\"2.5\"/>\n"
1892 " <Entry key=\"weaponName\" type=\"string\" value=\"Sword\"/>\n"
1893 " </BlackboardModel>\n\n"
1894 "USAGE IN BEHAVIOR TREE:\n"
1895 " <Condition name=\"CheckHealth\">\n"
1896 " <input key=\"health\" blackboard_key=\"playerHealth\"/>\n"
1898 " <Action name=\"SetAlert\">\n"
1899 " <output key=\"isAlerted\" blackboard_key=\"isAlerted\" value=\"true\"/>\n"
1901 HelpDialog dlg(
this,
"Entry Element - Help", helpText);
1904 labelSizer4->Add(infoBtn4, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
1905 labelSizer4->Add(
new wxStaticText(panel, wxID_ANY,
"Entry Element:"), 0, wxALIGN_CENTER_VERTICAL);
1906 basicSizer->Add(labelSizer4, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
1909 basicSizer->Add(
m_entryElement, wxGBPosition(row, 1), wxDefaultSpan, wxEXPAND);
1913 wxBoxSizer *labelSizer5 =
new wxBoxSizer(wxHORIZONTAL);
1914 wxBitmapButton *infoBtn5 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
1915 wxBORDER_NONE | wxBU_EXACTFIT);
1916 infoBtn5->SetBitmapHover(infoHover);
1917 infoBtn5->SetBitmapPressed(infoPressed);
1918 infoBtn5->SetBitmapDisabled(infoDisabled);
1919 infoBtn5->SetToolTip(
"Click for detailed information");
1920 infoBtn5->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
1921 wxString helpText =
"ENTRY KEY ATTRIBUTE\n"
1922 "===========================================================\n\n"
1924 "The XML attribute name that contains the KEY (variable name)\n"
1925 "for a blackboard entry.\n\n"
1927 " - 'key' - BehaviorTree.CPP standard\n"
1928 " - 'name' - Alternative common usage\n"
1929 " - 'id' - Some implementations\n\n"
1931 "The key is the UNIQUE IDENTIFIER for a variable within a blackboard:\n"
1932 " - Acts as the variable name\n"
1933 " - Used to read/write the value at runtime\n"
1934 " - Must be unique within the blackboard\n"
1935 " - Case-sensitive (usually)\n\n"
1937 " <Entry key=\"playerHealth\" type=\"int\" value=\"100\"/>\n"
1938 " ^^^^^^^^^^^^^^^^^^^\n"
1939 " This is the key - the variable name\n\n"
1940 " <!-- In behavior tree nodes: -->\n"
1941 " <Condition name=\"IsHealthLow\">\n"
1942 " <input key=\"health\" blackboard_key=\"playerHealth\"/>\n"
1943 " ^^^^^^^^^^^^^^^^^\n"
1944 " References by key\n"
1946 "NAMING CONVENTIONS:\n"
1947 " - camelCase: playerHealth, maxSpeed, isActive\n"
1948 " - snake_case: player_health, max_speed, is_active\n"
1949 " - PascalCase: PlayerHealth, MaxSpeed, IsActive\n\n"
1951 "Use descriptive, consistent names following your project's\n"
1952 "naming convention. Common standard is camelCase.";
1953 HelpDialog dlg(
this,
"Entry Key Attribute - Help", helpText);
1956 labelSizer5->Add(infoBtn5, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
1957 labelSizer5->Add(
new wxStaticText(panel, wxID_ANY,
"Entry Key Attribute:"), 0, wxALIGN_CENTER_VERTICAL);
1958 basicSizer->Add(labelSizer5, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
1961 basicSizer->Add(
m_entryKeyAttr, wxGBPosition(row, 1), wxDefaultSpan, wxEXPAND);
1965 wxBoxSizer *labelSizer6 =
new wxBoxSizer(wxHORIZONTAL);
1966 wxBitmapButton *infoBtn6 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
1967 wxBORDER_NONE | wxBU_EXACTFIT);
1968 infoBtn6->SetBitmapHover(infoHover);
1969 infoBtn6->SetBitmapPressed(infoPressed);
1970 infoBtn6->SetBitmapDisabled(infoDisabled);
1971 infoBtn6->SetToolTip(
"Click for detailed information");
1972 infoBtn6->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
1973 wxString helpText =
"ENTRY TYPE ATTRIBUTE\n"
1974 "===========================================================\n\n"
1976 "The XML attribute name that specifies the DATA TYPE for a\n"
1977 "blackboard entry (int, float, string, bool, etc.).\n\n"
1979 " - 'type' - Most common standard\n"
1980 " - 'dataType' - Explicit variant\n"
1981 " - 'valueType' - Alternative\n\n"
1982 "SUPPORTED TYPES (typical):\n"
1984 " - 'int' / 'integer' - Whole numbers (e.g., 42, -10)\n"
1985 " - 'float' / 'double' - Decimals (e.g., 3.14, -2.5)\n"
1986 " - 'bool' / 'boolean' - true/false\n"
1987 " - 'string' - Text (e.g., \"Hello\", \"weapon_1\")\n\n"
1988 " ADVANCED (depends on implementation):\n"
1989 " - 'Vector2' / 'Vector3' - Position/direction\n"
1990 " - 'Pose' / 'Pose2D' - Position + rotation\n"
1991 " - 'array' - List of values\n"
1992 " - 'object' - Complex custom types\n\n"
1994 " <Entry key=\"health\" type=\"int\" value=\"100\"/>\n"
1995 " <Entry key=\"speed\" type=\"float\" value=\"5.5\"/>\n"
1996 " <Entry key=\"isAlive\" type=\"bool\" value=\"true\"/>\n"
1997 " <Entry key=\"name\" type=\"string\" value=\"Player\"/>\n"
1998 " <Entry key=\"position\" type=\"Vector3\"/>\n\n"
1999 "WHY TYPES MATTER:\n"
2000 " - Type safety: prevent wrong value assignments\n"
2001 " - Runtime validation\n"
2002 " - Editor support (proper UI widgets)\n"
2003 " - Performance optimization";
2004 HelpDialog dlg(
this,
"Entry Type Attribute - Help", helpText);
2007 labelSizer6->Add(infoBtn6, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
2008 labelSizer6->Add(
new wxStaticText(panel, wxID_ANY,
"Entry Type Attribute:"), 0, wxALIGN_CENTER_VERTICAL);
2009 basicSizer->Add(labelSizer6, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
2012 basicSizer->Add(
m_entryTypeAttr, wxGBPosition(row, 1), wxDefaultSpan, wxEXPAND);
2016 wxBoxSizer *labelSizer7 =
new wxBoxSizer(wxHORIZONTAL);
2017 wxBitmapButton *infoBtn7 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
2018 wxBORDER_NONE | wxBU_EXACTFIT);
2019 infoBtn7->SetBitmapHover(infoHover);
2020 infoBtn7->SetBitmapPressed(infoPressed);
2021 infoBtn7->SetBitmapDisabled(infoDisabled);
2022 infoBtn7->SetToolTip(
"Click for detailed information");
2023 infoBtn7->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
2024 wxString helpText =
"ENTRY VALUE ATTRIBUTE\n"
2025 "===========================================================\n\n"
2027 "The XML attribute name that contains the DEFAULT VALUE for a\n"
2028 "blackboard entry.\n\n"
2030 " - 'value' - Most common\n"
2031 " - 'default' - Explicit naming\n"
2032 " - 'defaultValue' - Verbose variant\n\n"
2033 "WHAT IS A DEFAULT VALUE?\n"
2034 "The default value is the INITIAL value assigned when:\n"
2035 " - A blackboard is first created/instantiated\n"
2036 " - A behavior tree starts executing\n"
2037 " - The blackboard is reset\n\n"
2038 "OPTIONAL vs REQUIRED:\n"
2039 " - Some entries HAVE defaults (value specified)\n"
2040 " - Some entries DON'T (must be set at runtime)\n\n"
2042 " <Entry key=\"health\" type=\"int\" value=\"100\"/>\n"
2044 " Starts with 100\n\n"
2045 " <Entry key=\"currentTarget\" type=\"string\"/>\n"
2046 " No default - must be set\n\n"
2047 " <Entry key=\"isAlerted\" type=\"bool\" value=\"false\"/>\n"
2048 " ^^^^^^^^^^^^^^^^\n"
2049 " Starts as false\n\n"
2050 "TYPE-SPECIFIC FORMATS:\n"
2051 " - int: \"42\", \"-10\", \"0\"\n"
2052 " - float: \"3.14\", \"-2.5\", \"0.0\"\n"
2053 " - bool: \"true\", \"false\" (case-insensitive)\n"
2054 " - string: \"PlayerName\", \"idle_animation\"\n"
2055 " - Vector3: \"1.0,2.0,3.0\" (comma-separated)\n\n"
2057 "Provide sensible defaults when possible to make trees\n"
2058 "more self-contained and easier to test.";
2059 HelpDialog dlg(
this,
"Entry Value Attribute - Help", helpText);
2062 labelSizer7->Add(infoBtn7, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
2063 labelSizer7->Add(
new wxStaticText(panel, wxID_ANY,
"Entry Value Attribute:"), 0, wxALIGN_CENTER_VERTICAL);
2064 basicSizer->Add(labelSizer7, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
2067 basicSizer->Add(
m_entryValueAttr, wxGBPosition(row, 1), wxDefaultSpan, wxEXPAND);
2070 basicSizer->AddGrowableCol(1);
2071 mainSizer->Add(basicSizer, 0, wxEXPAND | wxALL, 5);
2074 wxStaticBoxSizer *mappingsBox =
new wxStaticBoxSizer(wxVERTICAL, panel,
"Data Type Mappings");
2087 wxBoxSizer *mappingBtnSizer =
new wxBoxSizer(wxHORIZONTAL);
2092 mappingsBox->Add(mappingBtnSizer, 0);
2094 mainSizer->Add(mappingsBox, 1, wxEXPAND | wxALL, 5);
2100 panel->SetSizer(mainSizer);
2105 wxPanel *panel =
new wxPanel(notebook);
2106 wxBoxSizer *mainSizer =
new wxBoxSizer(wxVERTICAL);
2109 wxBitmap infoNormal(
GetResourcePath(
"buttons/info/Info_Normal_20.png"), wxBITMAP_TYPE_PNG);
2110 wxBitmap infoHover(
GetResourcePath(
"buttons/info/Info_Hovered_20.png"), wxBITMAP_TYPE_PNG);
2111 wxBitmap infoPressed(
GetResourcePath(
"buttons/info/Info_Pressed_20.png"), wxBITMAP_TYPE_PNG);
2112 wxBitmap infoDisabled(
GetResourcePath(
"buttons/info/Info_Disabled_20.png"), wxBITMAP_TYPE_PNG);
2115 wxGridBagSizer *sizer =
new wxGridBagSizer(5, 5);
2119 wxBoxSizer *labelSizer1 =
new wxBoxSizer(wxHORIZONTAL);
2120 wxBitmapButton *infoBtn1 =
new wxBitmapButton(panel, wxID_ANY, infoNormal, wxDefaultPosition, wxSize(40, 40),
2121 wxBORDER_NONE | wxBU_EXACTFIT);
2122 infoBtn1->SetBitmapHover(infoHover);
2123 infoBtn1->SetBitmapPressed(infoPressed);
2124 infoBtn1->SetBitmapDisabled(infoDisabled);
2125 infoBtn1->SetToolTip(
"Click for detailed information");
2126 infoBtn1->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
2127 wxString helpText =
"ENABLE PROGRESS REPORTING\n"
2128 "===========================================================\n\n"
2130 "Controls whether the parser reports progress updates during XML\n"
2131 "parsing operations, especially useful for large files.\n\n"
2133 " - Parser emits progress callbacks during parsing\n"
2134 " - UI can show loading bars or progress indicators\n"
2135 " - Helps prevent \"app not responding\" appearance\n"
2136 " - Useful for files > 1000 nodes\n"
2137 " - Small performance overhead (~2-5%)\n\n"
2139 " - No progress updates\n"
2140 " - Slightly faster parsing\n"
2141 " - Simpler implementation\n"
2142 " - Best for small/medium files\n\n"
2145 " - Loading very large behavior tree files\n"
2146 " - Need to show user feedback during loading\n"
2147 " - Parsing operations take > 1 second\n\n"
2149 " - Working with small files (< 100 nodes)\n"
2150 " - Maximum parsing speed is priority\n"
2151 " - No UI for displaying progress\n\n"
2153 "Enable for production applications to improve user experience\n"
2154 "when loading large behavior tree files.";
2155 HelpDialog dlg(
this,
"Progress Reporting - Help", helpText);
2158 labelSizer1->Add(infoBtn1, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
2162 sizer->Add(labelSizer1, wxGBPosition(row, 0), wxGBSpan(1, 2));
2166 wxBoxSizer *labelSizer2 =
new wxBoxSizer(wxHORIZONTAL);
2167 wxBitmap infoNormal2(
GetResourcePath(
"buttons/info/Info_Normal_20.png"), wxBITMAP_TYPE_PNG);
2168 wxBitmap infoHover2(
GetResourcePath(
"buttons/info/Info_Hovered_20.png"), wxBITMAP_TYPE_PNG);
2169 wxBitmap infoPressed2(
GetResourcePath(
"buttons/info/Info_Pressed_20.png"), wxBITMAP_TYPE_PNG);
2170 wxBitmap infoDisabled2(
GetResourcePath(
"buttons/info/Info_Disabled_20.png"), wxBITMAP_TYPE_PNG);
2171 wxBitmapButton *infoBtn2 =
new wxBitmapButton(panel, wxID_ANY, infoNormal2, wxDefaultPosition, wxSize(40, 40),
2172 wxBORDER_NONE | wxBU_EXACTFIT);
2173 infoBtn2->SetBitmapHover(infoHover2);
2174 infoBtn2->SetBitmapPressed(infoPressed2);
2175 infoBtn2->SetBitmapDisabled(infoDisabled2);
2176 infoBtn2->SetToolTip(
"Click for detailed information");
2177 infoBtn2->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
2178 wxString helpText =
"DETAILED ERROR MESSAGES\n"
2179 "===========================================================\n\n"
2180 "Controls the verbosity of error messages when parsing fails.\n\n"
2181 "ENABLED (Recommended for Development):\n"
2182 " - Full error descriptions with context\n"
2183 " - Shows exact line and column numbers\n"
2184 " - Includes surrounding XML context\n"
2185 " - Lists all violated validation rules\n"
2186 " - Suggests possible fixes\n\n"
2187 "Example detailed error:\n"
2188 " ERROR at line 42, column 15:\n"
2189 " Unknown element 'Sequenc' found.\n"
2190 " Context: <Sequenc name=\"Patrol\">\n"
2191 " Did you mean: 'Sequence'?\n"
2192 " Valid elements: Sequence, Selector, Parallel\n\n"
2193 "DISABLED (Production):\n"
2194 " - Brief error messages\n"
2195 " - Just error type and location\n"
2196 " - Less information leakage\n"
2197 " - Slightly faster\n\n"
2198 "Example simple error:\n"
2199 " Parse error at line 42: Unknown element\n\n"
2202 " - Developing behavior trees\n"
2203 " - Debugging XML format issues\n"
2204 " - Users need helpful error messages\n\n"
2206 " - Production/release builds\n"
2207 " - Security concerns about information disclosure\n"
2208 " - Minimal error output desired\n\n"
2210 "Keep ENABLED during development. Consider disabling for\n"
2211 "production if error details are security-sensitive.";
2212 HelpDialog dlg(
this,
"Detailed Error Messages - Help", helpText);
2215 labelSizer2->Add(infoBtn2, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
2216 m_detailedErrors =
new wxCheckBox(panel, wxID_ANY,
"Detailed Error Messages");
2217 m_detailedErrors->SetToolTip(
"Include detailed context in error messages");
2219 sizer->Add(labelSizer2, wxGBPosition(row, 0), wxGBSpan(1, 2));
2223 wxBoxSizer *labelSizer3 =
new wxBoxSizer(wxHORIZONTAL);
2224 wxBitmap infoNormal3(
GetResourcePath(
"buttons/info/Info_Normal_20.png"), wxBITMAP_TYPE_PNG);
2225 wxBitmap infoHover3(
GetResourcePath(
"buttons/info/Info_Hovered_20.png"), wxBITMAP_TYPE_PNG);
2226 wxBitmap infoPressed3(
GetResourcePath(
"buttons/info/Info_Pressed_20.png"), wxBITMAP_TYPE_PNG);
2227 wxBitmap infoDisabled3(
GetResourcePath(
"buttons/info/Info_Disabled_20.png"), wxBITMAP_TYPE_PNG);
2228 wxBitmapButton *infoBtn3 =
new wxBitmapButton(panel, wxID_ANY, infoNormal3, wxDefaultPosition, wxSize(40, 40),
2229 wxBORDER_NONE | wxBU_EXACTFIT);
2230 infoBtn3->SetBitmapHover(infoHover3);
2231 infoBtn3->SetBitmapPressed(infoPressed3);
2232 infoBtn3->SetBitmapDisabled(infoDisabled3);
2233 infoBtn3->SetToolTip(
"Click for detailed information");
2234 infoBtn3->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
2235 wxString helpText =
"TRACK LINE/COLUMN NUMBERS\n"
2236 "===========================================================\n\n"
2237 "Controls whether the parser maintains line and column position\n"
2238 "information for every parsed element.\n\n"
2240 " - Every node tracks its source location (line, column)\n"
2241 " - Error messages show EXACT locations\n"
2242 " - Enables \"jump to source\" in editors\n"
2243 " - Useful for debugging and validation\n"
2244 " - Small memory overhead per node (~8 bytes)\n"
2245 " - Minor performance impact (~5-10%)\n\n"
2247 " - No line/column tracking\n"
2248 " - Error messages less specific\n"
2249 " - Lower memory usage\n"
2250 " - Slightly faster parsing\n\n"
2251 "ERROR COMPARISON:\n\n"
2252 "With tracking enabled:\n"
2253 " ERROR at line 127, column 23:\n"
2254 " Invalid attribute 'tpye' on Action node.\n"
2255 " <Action tpye=\"Move\" target=\"enemy\"/>\n"
2257 "With tracking disabled:\n"
2258 " ERROR: Invalid attribute 'tpye' on Action node.\n"
2259 " (no location information available)\n\n"
2262 " - Developing/debugging trees\n"
2263 " - Need precise error locations\n"
2264 " - Integrating with XML editors\n\n"
2266 " - Memory is critical constraint\n"
2267 " - Maximum performance needed\n"
2268 " - Source locations not needed\n\n"
2270 "Keep ENABLED during development for better debugging.\n"
2271 "Consider disabling in memory-constrained environments.";
2272 HelpDialog dlg(
this,
"Track Line/Column Numbers - Help", helpText);
2275 labelSizer3->Add(infoBtn3, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
2276 m_trackLineColumn =
new wxCheckBox(panel, wxID_ANY,
"Track Line/Column Numbers");
2279 sizer->Add(labelSizer3, wxGBPosition(row, 0), wxGBSpan(1, 2));
2283 wxBoxSizer *labelSizer4 =
new wxBoxSizer(wxHORIZONTAL);
2284 wxBitmap infoNormal4(
GetResourcePath(
"buttons/info/Info_Normal_20.png"), wxBITMAP_TYPE_PNG);
2285 wxBitmap infoHover4(
GetResourcePath(
"buttons/info/Info_Hovered_20.png"), wxBITMAP_TYPE_PNG);
2286 wxBitmap infoPressed4(
GetResourcePath(
"buttons/info/Info_Pressed_20.png"), wxBITMAP_TYPE_PNG);
2287 wxBitmap infoDisabled4(
GetResourcePath(
"buttons/info/Info_Disabled_20.png"), wxBITMAP_TYPE_PNG);
2288 wxBitmapButton *infoBtn4 =
new wxBitmapButton(panel, wxID_ANY, infoNormal4, wxDefaultPosition, wxSize(40, 40),
2289 wxBORDER_NONE | wxBU_EXACTFIT);
2290 infoBtn4->SetBitmapHover(infoHover4);
2291 infoBtn4->SetBitmapPressed(infoPressed4);
2292 infoBtn4->SetBitmapDisabled(infoDisabled4);
2293 infoBtn4->SetToolTip(
"Click for detailed information");
2294 infoBtn4->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
2295 wxString helpText =
"SUBTREE EXPANSION\n"
2296 "===========================================================\n\n"
2297 "Controls WHEN subtree references are resolved and loaded during\n"
2298 "parsing. Affects memory usage and loading performance.\n\n"
2299 "THREE STRATEGIES:\n\n"
2300 "1. IMMEDIATE (Default - Recommended)\n"
2301 " - All subtrees loaded and expanded during initial parse\n"
2302 " - Complete tree structure available immediately\n"
2303 " - All errors detected at load time\n"
2304 " - Higher initial memory usage\n"
2305 " - Slightly longer initial load time\n"
2306 " Pros: Simple, predictable, catches all errors early\n"
2307 " Cons: Loads trees that may never be used\n\n"
2308 "2. LAZY (On-Demand Loading)\n"
2309 " - Subtrees loaded only when first accessed\n"
2310 " - Lower initial memory footprint\n"
2311 " - Faster initial load time\n"
2312 " - Subtree errors discovered at runtime\n"
2313 " - Small performance hit on first access\n"
2314 " Pros: Efficient for large tree collections\n"
2315 " Cons: Errors may appear during gameplay/execution\n\n"
2316 "3. MANUAL (Explicit Control)\n"
2317 " - No automatic expansion\n"
2318 " - Application controls when to load\n"
2319 " - Maximum flexibility\n"
2320 " - Requires explicit API calls\n"
2321 " Pros: Full control over loading\n"
2322 " Cons: More complex application code\n\n"
2324 "Tree with subtrees: Main -> Patrol -> GuardPoint\n\n"
2325 "IMMEDIATE: Main, Patrol, GuardPoint all loaded at once\n"
2326 "LAZY: Only Main loaded, Patrol/GuardPoint on first use\n"
2327 "MANUAL: Only Main loaded, app calls LoadSubtree() explicitly\n\n"
2329 "Use IMMEDIATE for most cases - simple and catches errors early.\n"
2330 "Use LAZY for very large tree collections (100+ trees).";
2331 HelpDialog dlg(
this,
"SubTree Expansion - Help", helpText);
2334 labelSizer4->Add(infoBtn4, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
2335 labelSizer4->Add(
new wxStaticText(panel, wxID_ANY,
"SubTree Expansion:"), 0, wxALIGN_CENTER_VERTICAL);
2336 sizer->Add(labelSizer4, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
2337 wxArrayString expansionChoices;
2338 expansionChoices.Add(
"Immediate");
2339 expansionChoices.Add(
"Lazy");
2340 expansionChoices.Add(
"Manual");
2341 m_subtreeExpansion =
new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, expansionChoices);
2348 wxBoxSizer *labelSizer5 =
new wxBoxSizer(wxHORIZONTAL);
2349 wxBitmap infoNormal5(
GetResourcePath(
"buttons/info/Info_Normal_20.png"), wxBITMAP_TYPE_PNG);
2350 wxBitmap infoHover5(
GetResourcePath(
"buttons/info/Info_Hovered_20.png"), wxBITMAP_TYPE_PNG);
2351 wxBitmap infoPressed5(
GetResourcePath(
"buttons/info/Info_Pressed_20.png"), wxBITMAP_TYPE_PNG);
2352 wxBitmap infoDisabled5(
GetResourcePath(
"buttons/info/Info_Disabled_20.png"), wxBITMAP_TYPE_PNG);
2353 wxBitmapButton *infoBtn5 =
new wxBitmapButton(panel, wxID_ANY, infoNormal5, wxDefaultPosition, wxSize(40, 40),
2354 wxBORDER_NONE | wxBU_EXACTFIT);
2355 infoBtn5->SetBitmapHover(infoHover5);
2356 infoBtn5->SetBitmapPressed(infoPressed5);
2357 infoBtn5->SetBitmapDisabled(infoDisabled5);
2358 infoBtn5->SetToolTip(
"Click for detailed information");
2359 infoBtn5->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
2360 wxString helpText =
"MAX RECURSION DEPTH\n"
2361 "===========================================================\n\n"
2362 "Maximum depth of nested subtree references allowed. Prevents\n"
2363 "infinite recursion from circular subtree references.\n\n"
2364 "WHAT IS RECURSION DEPTH?\n"
2365 "The number of levels of subtree-within-subtree nesting:\n\n"
2366 "Depth 1: MainTree -> SubTreeA (1 level)\n"
2367 "Depth 2: MainTree -> SubTreeA -> SubTreeB (2 levels)\n"
2368 "Depth 3: MainTree -> SubTreeA -> SubTreeB -> SubTreeC\n\n"
2369 "CIRCULAR REFERENCE PROTECTION:\n"
2370 "This limit prevents infinite loops from circular references:\n"
2371 " TreeA references TreeB\n"
2372 " TreeB references TreeA <- CIRCULAR!\n"
2373 "Without limit: Infinite expansion and stack overflow\n"
2374 "With limit: Stops after N levels with clear error\n\n"
2375 "VALUE GUIDELINES:\n\n"
2376 "Very Low (1-10):\n"
2377 " - Simple trees with few subtree levels\n"
2378 " - Strict control over complexity\n"
2379 " - Fast circular reference detection\n\n"
2380 "Medium (10-100): RECOMMENDED\n"
2381 " - Handles most reasonable tree structures\n"
2382 " - Default value: 100\n"
2383 " - Good balance of safety and flexibility\n\n"
2384 "High (100-1000):\n"
2385 " - Very complex nested structures\n"
2386 " - Larger memory usage\n"
2387 " - Slower to detect circular refs\n\n"
2389 "Max depth = 10, actual nesting = 12:\n"
2390 " ERROR: Max recursion depth (10) exceeded.\n"
2391 " Subtree expansion stopped at: TreeA -> TreeB -> ... (10 levels)\n"
2392 " Possible circular reference detected.\n\n"
2394 "Keep default 100 - catches circular refs while allowing\n"
2395 "complex legitimate nesting. Increase only if you have\n"
2396 "verified deeply nested structures.";
2397 HelpDialog dlg(
this,
"Max Recursion Depth - Help", helpText);
2400 labelSizer5->Add(infoBtn5, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
2401 labelSizer5->Add(
new wxStaticText(panel, wxID_ANY,
"Max Recursion Depth:"), 0, wxALIGN_CENTER_VERTICAL);
2402 sizer->Add(labelSizer5, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
2406 m_maxRecursionDepth->SetToolTip(
"Prevent infinite loops from circular subtree references");
2411 wxBoxSizer *labelSizer8 =
new wxBoxSizer(wxHORIZONTAL);
2412 wxBitmap infoNormal8(
GetResourcePath(
"buttons/info/Info_Normal_20.png"), wxBITMAP_TYPE_PNG);
2413 wxBitmap infoHover8(
GetResourcePath(
"buttons/info/Info_Hovered_20.png"), wxBITMAP_TYPE_PNG);
2414 wxBitmap infoPressed8(
GetResourcePath(
"buttons/info/Info_Pressed_20.png"), wxBITMAP_TYPE_PNG);
2415 wxBitmap infoDisabled8(
GetResourcePath(
"buttons/info/Info_Disabled_20.png"), wxBITMAP_TYPE_PNG);
2416 wxBitmapButton *infoBtn8 =
new wxBitmapButton(panel, wxID_ANY, infoNormal8, wxDefaultPosition, wxSize(40, 40),
2417 wxBORDER_NONE | wxBU_EXACTFIT);
2418 infoBtn8->SetBitmapHover(infoHover8);
2419 infoBtn8->SetBitmapPressed(infoPressed8);
2420 infoBtn8->SetBitmapDisabled(infoDisabled8);
2421 infoBtn8->SetToolTip(
"Click for detailed information");
2422 infoBtn8->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
2423 wxString helpText =
"XML NAMESPACE URI\n"
2424 "===========================================================\n\n"
2425 "Optional XML namespace for behavior tree elements.\n"
2426 "Used for XML schema validation and element disambiguation.\n\n"
2427 "WHAT IS AN XML NAMESPACE?\n"
2428 "A unique identifier (usually a URI) that prevents naming\n"
2429 "conflicts between XML vocabularies.\n\n"
2430 "EXAMPLE WITHOUT NAMESPACE:\n"
2432 " <BehaviorTree ID=\"AI\">\n"
2433 " <Sequence>...</Sequence>\n"
2434 " </BehaviorTree>\n"
2436 "EXAMPLE WITH NAMESPACE:\n"
2437 " <root xmlns:bt=\"http://behaviortree.dev/bt/1.0\">\n"
2438 " <bt:BehaviorTree ID=\"AI\">\n"
2439 " <bt:Sequence>...</bt:Sequence>\n"
2440 " </bt:BehaviorTree>\n"
2443 "Leave Empty (Most Common):\n"
2444 " - Simple XML files\n"
2445 " - No naming conflicts\n"
2447 " - Easier to read/write\n\n"
2448 "Specify Namespace When:\n"
2449 " - Mixing multiple XML vocabularies\n"
2450 " - Need formal XML schema validation\n"
2451 " - Working with XML tools that require it\n"
2452 " - Preventing element name collisions\n\n"
2453 "COMMON NAMESPACE FORMATS:\n"
2454 " - http://behaviortree.dev/bt/1.0\n"
2455 " - urn:behaviortree:schema:1.0\n"
2456 " - http://example.com/schemas/bt\n\n"
2457 "Note: The URI doesn't need to be a real web address.\n"
2458 "It's just a unique identifier.\n\n"
2460 "If specified, all behavior tree elements must use the\n"
2461 "namespace prefix in your XML files.\n\n"
2463 "Leave empty unless you have specific requirements for\n"
2464 "namespace-based XML validation or element disambiguation.";
2465 HelpDialog dlg(
this,
"XML Namespace - Help", helpText);
2468 labelSizer8->Add(infoBtn8, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
2469 labelSizer8->Add(
new wxStaticText(panel, wxID_ANY,
"XML Namespace URI:"), 0, wxALIGN_CENTER_VERTICAL);
2470 sizer->Add(labelSizer8, wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
2472 m_xmlNamespace->SetToolTip(
"Optional namespace URI (e.g., http://behaviortree.dev/bt/1.0)");
2473 sizer->Add(
m_xmlNamespace, wxGBPosition(row, 1), wxDefaultSpan, wxEXPAND);
2477 wxBoxSizer *labelSizer9 =
new wxBoxSizer(wxHORIZONTAL);
2478 wxBitmap infoNormal9(
GetResourcePath(
"buttons/info/Info_Normal_20.png"), wxBITMAP_TYPE_PNG);
2479 wxBitmap infoHover9(
GetResourcePath(
"buttons/info/Info_Hovered_20.png"), wxBITMAP_TYPE_PNG);
2480 wxBitmap infoPressed9(
GetResourcePath(
"buttons/info/Info_Pressed_20.png"), wxBITMAP_TYPE_PNG);
2481 wxBitmap infoDisabled9(
GetResourcePath(
"buttons/info/Info_Disabled_20.png"), wxBITMAP_TYPE_PNG);
2482 wxBitmapButton *infoBtn9 =
new wxBitmapButton(panel, wxID_ANY, infoNormal9, wxDefaultPosition, wxSize(40, 40),
2483 wxBORDER_NONE | wxBU_EXACTFIT);
2484 infoBtn9->SetBitmapHover(infoHover9);
2485 infoBtn9->SetBitmapPressed(infoPressed9);
2486 infoBtn9->SetBitmapDisabled(infoDisabled9);
2487 infoBtn9->SetToolTip(
"Click for detailed information");
2488 infoBtn9->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
2489 wxString helpText =
"PRESERVE XML COMMENTS\n"
2490 "===========================================================\n\n"
2491 "Controls whether XML comments are kept in memory after parsing.\n\n"
2493 " - Comments stored in parsed tree structure\n"
2494 " - Can be accessed programmatically\n"
2495 " - Preserved when saving/exporting trees\n"
2496 " - Useful for round-trip editing\n"
2497 " - Small memory overhead\n\n"
2498 "DISABLED (Default):\n"
2499 " - Comments discarded during parsing\n"
2500 " - Lower memory usage\n"
2501 " - Slightly faster parsing\n"
2502 " - Lost if tree is saved back to XML\n\n"
2504 " <!-- This is a comment -->\n"
2505 " <!-- Comments can span\n"
2506 " multiple lines -->\n\n"
2508 " <BehaviorTree ID=\"AI\">\n"
2509 " <!-- This is the patrol sequence -->\n"
2511 " <Action name=\"Move\"/> <!-- Move forward -->\n"
2513 " </BehaviorTree>\n\n"
2516 " - Building XML editor/viewer\n"
2517 " - Need to preserve documentation\n"
2518 " - Round-trip editing (load -> modify -> save)\n"
2519 " - Comments contain important metadata\n\n"
2521 " - Only loading trees for execution\n"
2522 " - Memory is constrained\n"
2523 " - Comments are just temporary notes\n"
2524 " - Maximum parsing speed needed\n\n"
2526 "Enable if building an editor or if comments contain important\n"
2527 "information. Disable for runtime-only tree loading.";
2528 HelpDialog dlg(
this,
"Preserve Comments - Help", helpText);
2531 labelSizer9->Add(infoBtn9, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
2535 sizer->Add(labelSizer9, wxGBPosition(row, 0), wxGBSpan(1, 2));
2539 wxBoxSizer *labelSizer10 =
new wxBoxSizer(wxHORIZONTAL);
2540 wxBitmap infoNormal10(
GetResourcePath(
"buttons/info/Info_Normal_20.png"), wxBITMAP_TYPE_PNG);
2541 wxBitmap infoHover10(
GetResourcePath(
"buttons/info/Info_Hovered_20.png"), wxBITMAP_TYPE_PNG);
2542 wxBitmap infoPressed10(
GetResourcePath(
"buttons/info/Info_Pressed_20.png"), wxBITMAP_TYPE_PNG);
2543 wxBitmap infoDisabled10(
GetResourcePath(
"buttons/info/Info_Disabled_20.png"), wxBITMAP_TYPE_PNG);
2544 wxBitmapButton *infoBtn10 =
new wxBitmapButton(panel, wxID_ANY, infoNormal10, wxDefaultPosition, wxSize(40, 40),
2545 wxBORDER_NONE | wxBU_EXACTFIT);
2546 infoBtn10->SetBitmapHover(infoHover10);
2547 infoBtn10->SetBitmapPressed(infoPressed10);
2548 infoBtn10->SetBitmapDisabled(infoDisabled10);
2549 infoBtn10->SetToolTip(
"Click for detailed information");
2550 infoBtn10->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
2551 wxString helpText =
"PRESERVE ATTRIBUTE ORDER\n"
2552 "===========================================================\n\n"
2553 "Controls whether the order of XML attributes is maintained\n"
2554 "exactly as they appear in the source file.\n\n"
2556 " - Attributes stored in original order\n"
2557 " - When saved, attributes appear in same order\n"
2558 " - Useful for version control (minimal diffs)\n"
2559 " - Slight memory/performance overhead\n"
2560 " - Better for human-edited XML\n\n"
2561 "DISABLED (Default):\n"
2562 " - Attributes may be reordered internally\n"
2563 " - Typically alphabetical order\n"
2564 " - Slightly more efficient\n"
2565 " - Doesn't affect functionality\n"
2566 " - Standard XML behavior\n\n"
2567 "XML ATTRIBUTE ORDER:\n\n"
2569 " <Action name=\"Move\" speed=\"5.0\" target=\"enemy\"/>\n\n"
2570 "Preserved (enabled):\n"
2571 " <Action name=\"Move\" speed=\"5.0\" target=\"enemy\"/>\n"
2572 " (Exact same order)\n\n"
2573 "Not preserved (disabled):\n"
2574 " <Action name=\"Move\" speed=\"5.0\" target=\"enemy\"/>\n"
2575 " (May become: name, speed, target OR alphabetically)\n\n"
2577 "XML specification says attribute order is NOT significant.\n"
2578 "All XML parsers must work regardless of attribute order.\n\n"
2581 " - Using version control (Git, SVN)\n"
2582 " - Want minimal diffs between versions\n"
2583 " - Hand-editing XML files\n"
2584 " - Order has semantic meaning to humans\n\n"
2586 " - Pure runtime loading\n"
2587 " - No round-trip editing\n"
2588 " - Programmatically generated XML\n"
2589 " - Order doesn't matter\n\n"
2591 "Enable for editor applications and version-controlled files.\n"
2592 "Disable for runtime-only loading.";
2593 HelpDialog dlg(
this,
"Preserve Attribute Order - Help", helpText);
2596 labelSizer10->Add(infoBtn10, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
2600 sizer->Add(labelSizer10, wxGBPosition(row, 0), wxGBSpan(1, 2));
2603 sizer->AddGrowableCol(1);
2604 mainSizer->Add(sizer, 0, wxEXPAND | wxALL, 5);
2607 mainSizer->Add(
new wxStaticLine(panel), 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5);
2617 wxBoxSizer *rulesLabelSizer =
new wxBoxSizer(wxHORIZONTAL);
2618 wxBitmap infoNormal11(
GetResourcePath(
"buttons/info/Info_Normal_20.png"), wxBITMAP_TYPE_PNG);
2619 wxBitmap infoHover11(
GetResourcePath(
"buttons/info/Info_Hovered_20.png"), wxBITMAP_TYPE_PNG);
2620 wxBitmap infoPressed11(
GetResourcePath(
"buttons/info/Info_Pressed_20.png"), wxBITMAP_TYPE_PNG);
2621 wxBitmap infoDisabled11(
GetResourcePath(
"buttons/info/Info_Disabled_20.png"), wxBITMAP_TYPE_PNG);
2622 wxBitmapButton *infoBtn11 =
new wxBitmapButton(panel, wxID_ANY, infoNormal11, wxDefaultPosition, wxSize(40, 40),
2623 wxBORDER_NONE | wxBU_EXACTFIT);
2624 infoBtn11->SetBitmapHover(infoHover11);
2625 infoBtn11->SetBitmapPressed(infoPressed11);
2626 infoBtn11->SetBitmapDisabled(infoDisabled11);
2627 infoBtn11->SetToolTip(
"Click for detailed information");
2628 infoBtn11->Bind(wxEVT_BUTTON, [
this](wxCommandEvent &) {
2629 wxString helpText =
"CUSTOM VALIDATION RULES\n"
2630 "===========================================================\n\n"
2631 "Define custom validation logic beyond standard XML schema validation.\n"
2632 "Specify rules using a simple scripting language or expressions.\n\n"
2633 "WHAT ARE VALIDATION RULES?\n"
2634 "Custom constraints that your behavior trees must satisfy:\n"
2635 " - Structural rules (e.g., Sequence must have 2+ children)\n"
2636 " - Naming conventions (e.g., Actions must start with verb)\n"
2637 " - Business logic (e.g., no more than 3 decorators deep)\n"
2638 " - Cross-tree references (e.g., all subtrees must exist)\n\n"
2640 "One rule per line. Each rule has:\n"
2641 " - Condition: When to check\n"
2642 " - Validation: What to verify\n"
2643 " - Message: Error to show if fails\n\n"
2644 "EXAMPLE RULES:\n\n"
2645 "1. Structural Rule:\n"
2646 " node.type == 'Sequence' && node.children.count < 2:\n"
2647 " 'Sequence nodes must have at least 2 children'\n\n"
2648 "2. Naming Convention:\n"
2649 " node.type == 'Action' && !node.name.startsWithVerb():\n"
2650 " 'Action names must start with a verb'\n\n"
2651 "3. Decorator Depth:\n"
2652 " node.type == 'Decorator' && node.depth > 3:\n"
2653 " 'Decorators cannot be nested more than 3 levels'\n\n"
2654 "4. Required Attributes:\n"
2655 " node.type == 'Action' && !node.hasAttribute('timeout'):\n"
2656 " 'All actions must specify a timeout'\n\n"
2657 "5. Subtree References:\n"
2658 " node.type == 'SubTree' && !subtreeExists(node.ID):\n"
2659 " 'Referenced subtree does not exist'\n\n"
2660 "AVAILABLE PROPERTIES:\n"
2661 " - node.type: Node type (Action, Sequence, etc.)\n"
2662 " - node.name: Node name/ID\n"
2663 " - node.children.count: Number of child nodes\n"
2664 " - node.depth: Nesting level\n"
2665 " - node.attributes: Map of attributes\n"
2666 " - tree.ID: Current tree identifier\n\n"
2667 "WHEN VALIDATION RUNS:\n"
2668 " - After parsing completes\n"
2669 " - Before tree is made available to application\n"
2670 " - All rules checked, multiple errors reported\n\n"
2672 "If any rule fails:\n"
2673 " - Clear error message shown\n"
2674 " - Parse operation fails\n"
2675 " - Tree not loaded into memory\n\n"
2677 " - Rules checked once at parse time\n"
2678 " - No runtime overhead\n"
2679 " - Complex rules may slow initial load\n\n"
2681 "Use for project-specific constraints that can't be expressed\n"
2682 "in XML schema. Keep rules simple and clear. Too many complex\n"
2683 "rules can make debugging difficult.";
2684 HelpDialog dlg(
this,
"Custom Validation Rules - Help", helpText);
2687 rulesLabelSizer->Add(infoBtn11, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
2688 rulesLabelSizer->Add(
new wxStaticText(panel, wxID_ANY,
"Custom Validation Rules: ( experimental )"), 0,
2689 wxALIGN_CENTER_VERTICAL);
2690 mainSizer->Add(rulesLabelSizer, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5);
2691 m_customValidation =
new wxTextCtrl(panel, wxID_ANY,
"", wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);
2693 m_customValidation->SetToolTip(
"Define custom validation expressions (one rule per line)");
2697 panel->SetSizer(mainSizer);
3311 auto config = std::make_shared<EmberCore::ParserConfig>();
3314 auto &docConfig = config->GetDocumentConfig();
3315 docConfig.root_element =
m_rootElement->GetValue().ToStdString();
3316 docConfig.main_tree_attribute =
m_mainTreeAttr->GetValue().ToStdString();
3319 docConfig.whitespace_handling =
3335 auto &treeConfig = config->GetTreeConfig();
3337 treeConfig.tree_id_attribute =
m_treeIdAttr->GetValue().ToStdString();
3340 treeConfig.subtree_reference_attribute =
m_subtreeRefAttr->GetValue().ToStdString();
3345 auto &nodeConfig = config->GetNodeConfig();
3347 nodeConfig.action_element =
m_actionElement->GetValue().ToStdString();
3351 nodeConfig.node_id_attribute =
m_nodeIdAttr->GetValue().ToStdString();
3352 nodeConfig.node_name_attribute =
m_nodeNameAttr->GetValue().ToStdString();
3353 nodeConfig.node_type_attribute =
m_nodeTypeAttr->GetValue().ToStdString();
3357 auto &classConfig = config->GetClassificationConfig();
3358 classConfig.strategy =
3361 classConfig.control_types.clear();
3366 classConfig.decorator_types.clear();
3371 classConfig.action_types.clear();
3373 classConfig.action_types.push_back(
m_actionTypesList->GetString(i).ToStdString());
3376 classConfig.condition_types.clear();
3381 classConfig.unknown_behavior =
3383 classConfig.type_attribute_name =
m_typeAttrName->GetValue().ToStdString();
3386 auto &bbConfig = config->GetBlackboardConfig();
3390 bbConfig.entry_element =
m_entryElement->GetValue().ToStdString();
3391 bbConfig.entry_key_attribute =
m_entryKeyAttr->GetValue().ToStdString();
3392 bbConfig.entry_type_attribute =
m_entryTypeAttr->GetValue().ToStdString();
3393 bbConfig.entry_value_attribute =
m_entryValueAttr->GetValue().ToStdString();
3396 bbConfig.type_mappings.clear();
3400 if (!xmlType.empty() && !internalType.empty()) {
3401 bbConfig.type_mappings[xmlType] = internalType;
3406 auto &advConfig = config->GetAdvancedConfig();
3410 advConfig.subtree_expansion =
3413 advConfig.xml_namespace_uri =
m_xmlNamespace->GetValue().ToStdString();
3421 advConfig.custom_validation_rules =
"";