6#include "BlueprintEditor.h"
8#include "../third_party/imgui/imgui.h"
11#include "../third_party/nlohmann/json.hpp"
20 , m_ShowSaveAsTemplateModal(
false)
21 , m_SelectedCategoryIndex(0)
61 ImGui::Text(
"Template Manager not initialized");
67 if (ImGui::Button(
"Save Current as Template"))
73 if (ImGui::Button(
"Refresh"))
84 std::vector<std::string> categories =
templateManager.GetAllCategories();
89 for (
const auto&
cat : categories)
105 if (templates.empty())
107 ImGui::TextColored(
ImVec4(0.7f, 0.7f, 0.7f, 1.0f),
108 "No templates available. Create one using 'Save Current as Template'");
117 for (
const auto&
tpl : templates)
131 ImGui::PushID(
tpl.id.c_str());
135 if (ImGui::Selectable(
tpl.name.c_str(), isSelected))
141 if (ImGui::IsItemHovered())
143 ImGui::BeginTooltip();
144 ImGui::Text(
"Name: %s",
tpl.name.c_str());
145 ImGui::Text(
"Description: %s",
tpl.description.c_str());
146 ImGui::Text(
"Category: %s",
tpl.category.c_str());
147 ImGui::Text(
"Author: %s",
tpl.author.c_str());
148 ImGui::Text(
"Version: %s",
tpl.version.c_str());
153 if (ImGui::BeginPopupContextItem())
155 if (ImGui::MenuItem(
"Apply to Current Blueprint"))
159 std::cout <<
"Applied template: " <<
tpl.name << std::endl;
163 std::cerr <<
"Failed to apply template: " <<
tpl.name << std::endl;
169 if (ImGui::MenuItem(
"Delete"))
173 std::cout <<
"Deleted template: " <<
tpl.name << std::endl;
181 std::cerr <<
"Failed to delete template: " <<
tpl.name << std::endl;
196 if (ImGui::Button(
"Apply Selected Template",
ImVec2(200, 0)))
206 std::cerr <<
"Failed to apply template" << std::endl;
210 ImGui::EndDisabled();
222 ImGui::OpenPopup(
"Save as Template");
230 ImGui::Text(
"Create a new template from the current blueprint");
240 if (ImGui::Button(
"Save",
ImVec2(120, 0)))
263 std::cerr <<
"Failed to save template: "
270 if (ImGui::Button(
"Cancel",
ImVec2(120, 0)))
ComponentTypeID GetComponentTypeID_Static()
std::string GetLastError() const
static BlueprintEditor & Get()
void RenderTemplateBrowser()
std::string m_SelectedTemplateId
int m_SelectedCategoryIndex
char m_TemplateDescriptionBuffer[512]
char m_TemplateCategoryBuffer[256]
bool m_ShowSaveAsTemplateModal
void RenderSaveAsTemplateModal()
char m_TemplateNameBuffer[256]
static TemplateManager & Get()