6#include "../../Source/third_party/imgui/imgui.h"
17 auto now = std::chrono::system_clock::now();
18 auto time = std::chrono::system_clock::to_time_t(
now);
26 ss << std::put_time(&
timeInfo,
"%Y-%m-%dT%H:%M:%S");
37 hfsm[
"schema_version"] = 2;
38 hfsm[
"blueprintType"] =
"HFSM";
40 hfsm[
"description"] =
"";
41 hfsm[
"metadata"][
"author"] =
"Atlasbruce";
43 hfsm[
"metadata"][
"tags"] = json::array();
44 hfsm[
"editorState"][
"zoom"] = 1.0;
45 hfsm[
"editorState"][
"scrollOffset"] = nlohmann::json::object();
46 hfsm[
"editorState"][
"scrollOffset"][
"x"] = 0;
47 hfsm[
"editorState"][
"scrollOffset"][
"y"] = 0;
48 hfsm[
"data"][
"initialState"] =
"Idle";
49 hfsm[
"data"][
"states"] = json::array();
50 hfsm[
"data"][
"transitions"] = json::array();
56 if (
blueprint.contains(
"blueprintType") &&
blueprint[
"blueprintType"].is_string() &&
blueprint[
"blueprintType"].get<std::string>() ==
"HFSM")
63 std::vector<ValidationError> errors;
67 errors.push_back(
error);
74 ImGui::Text(
"HFSM Editor");
75 ImGui::Text(
"States: %d", blueprintData.contains(
"data") && blueprintData[
"data"].contains(
"states") ?
76 (
int)blueprintData[
"data"][
"states"].size() : 0);
81 ImGui::Text(
"Type: HFSM");
86 ImGui::Button(
"Add State");
96 anim[
"schema_version"] = 2;
97 anim[
"blueprintType"] =
"AnimationGraph";
99 anim[
"description"] =
"";
100 anim[
"metadata"][
"author"] =
"Atlasbruce";
102 anim[
"metadata"][
"tags"] = json::array();
103 anim[
"editorState"][
"zoom"] = 1.0;
104 anim[
"editorState"][
"scrollOffset"] = nlohmann::json::object();
105 anim[
"editorState"][
"scrollOffset"][
"x"] = 0;
106 anim[
"editorState"][
"scrollOffset"][
"y"] = 0;
107 anim[
"data"][
"initialState"] =
"Idle";
108 anim[
"data"][
"states"] = json::array();
109 anim[
"data"][
"transitions"] = json::array();
115 if (
blueprint.contains(
"blueprintType") &&
blueprint[
"blueprintType"].is_string() &&
blueprint[
"blueprintType"].get<std::string>() ==
"AnimationGraph")
122 std::vector<ValidationError> errors;
126 errors.push_back(
error);
133 ImGui::Text(
"Animation Graph Editor");
134 if (blueprintData.contains(
"data") && blueprintData[
"data"].contains(
"states"))
136 const json& states = blueprintData[
"data"][
"states"];
137 ImGui::Text(
"Animation States: %d", (
int)states.size());
139 for (
size_t i = 0;
i < states.size(); ++
i)
141 const json& state = states[
i];
142 std::string
stateName = state.contains(
"name") && state[
"name"].is_string()
143 ? state[
"name"].get<std::string>()
145 ImGui::BulletText(
"%s",
stateName.c_str());
152 ImGui::Text(
"Type: Animation Graph");
157 ImGui::Button(
"Add Animation State");
167 event[
"schema_version"] = 2;
168 event[
"blueprintType"] =
"ScriptedEvent";
169 event[
"name"] = name;
170 event[
"description"] =
"";
171 event[
"metadata"][
"author"] =
"Atlasbruce";
173 event[
"metadata"][
"tags"] = json::array();
174 event[
"editorState"][
"zoom"] = 1.0;
175 event[
"editorState"][
"scrollOffset"] = nlohmann::json::object();
176 event[
"editorState"][
"scrollOffset"][
"x"] = 0;
177 event[
"editorState"][
"scrollOffset"][
"y"] = 0;
178 event[
"data"][
"triggerType"] =
"Manual";
179 event[
"data"][
"oneShot"] =
true;
180 event[
"data"][
"sequence"] = json::array();
186 if (
blueprint.contains(
"blueprintType") &&
blueprint[
"blueprintType"].is_string() &&
blueprint[
"blueprintType"].get<std::string>() ==
"ScriptedEvent")
193 std::vector<ValidationError> errors;
197 errors.push_back(
error);
204 ImGui::Text(
"Scripted Event Editor");
205 if (blueprintData.contains(
"data") && blueprintData[
"data"].contains(
"sequence"))
207 const json&
sequence = blueprintData[
"data"][
"sequence"];
208 ImGui::Text(
"Steps: %d", (
int)
sequence.size());
214 ?
step[
"type"].get<std::string>()
217 ?
step[
"step"].get<
int>()
226 ImGui::Text(
"Type: Scripted Event");
231 ImGui::Button(
"Add Step");
241 level[
"schema_version"] = 2;
242 level[
"blueprintType"] =
"LevelDefinition";
243 level[
"name"] = name;
244 level[
"description"] =
"";
245 level[
"metadata"][
"author"] =
"Atlasbruce";
247 level[
"metadata"][
"tags"] = json::array();
248 level[
"editorState"][
"zoom"] = 0.5;
249 level[
"editorState"][
"scrollOffset"] = nlohmann::json::object();
250 level[
"editorState"][
"scrollOffset"][
"x"] = 0;
251 level[
"editorState"][
"scrollOffset"][
"y"] = 0;
252 level[
"data"][
"levelName"] = name;
254 worldSize[
"width"] = 1024;
255 worldSize[
"height"] = 768;
256 level[
"data"][
"worldSize"] = worldSize;
257 level[
"data"][
"entities"] = json::array();
263 if (
blueprint.contains(
"blueprintType") &&
blueprint[
"blueprintType"].is_string() &&
blueprint[
"blueprintType"].get<std::string>() ==
"LevelDefinition")
270 std::vector<ValidationError> errors;
274 errors.push_back(
error);
281 ImGui::Text(
"Level Definition Editor");
282 if (blueprintData.contains(
"data"))
284 auto& data = blueprintData[
"data"];
285 ImGui::Text(
"Level: %s", (data.contains(
"levelName") && data[
"levelName"].is_string() ? data[
"levelName"].get<std::string>() :
"Unnamed").
c_str());
287 if (data.contains(
"entities"))
288 ImGui::Text(
"Entities: %d", (
int)data[
"entities"].size());
290 if (data.contains(
"objectives"))
291 ImGui::Text(
"Objectives: %d", (
int)data[
"objectives"].size());
297 ImGui::Text(
"Type: Level Definition");
302 ImGui::Button(
"Add Entity");
304 ImGui::Button(
"Add Objective");
314 menu[
"schema_version"] = 2;
315 menu[
"blueprintType"] =
"UIMenu";
317 menu[
"description"] =
"";
318 menu[
"metadata"][
"author"] =
"Atlasbruce";
320 menu[
"metadata"][
"tags"] = json::array();
321 menu[
"editorState"][
"zoom"] = 1.0;
322 menu[
"editorState"][
"scrollOffset"] = nlohmann::json::object();
323 menu[
"editorState"][
"scrollOffset"][
"x"] = 0;
324 menu[
"editorState"][
"scrollOffset"][
"y"] = 0;
325 menu[
"data"][
"menuName"] = name;
326 menu[
"data"][
"elements"] = json::array();
332 if (
blueprint.contains(
"blueprintType") &&
blueprint[
"blueprintType"].is_string() &&
blueprint[
"blueprintType"].get<std::string>() ==
"UIMenu")
339 std::vector<ValidationError> errors;
343 errors.push_back(
error);
350 ImGui::Text(
"UI Menu Editor");
351 if (blueprintData.contains(
"data") && blueprintData[
"data"].contains(
"elements"))
353 const json& elements = blueprintData[
"data"][
"elements"];
354 ImGui::Text(
"UI Elements: %d", (
int)elements.size());
356 for (
size_t i = 0;
i < elements.size(); ++
i)
360 ?
element[
"type"].get<std::string>()
363 ?
element[
"id"].get<std::string>()
372 ImGui::Text(
"Type: UI Menu");
377 ImGui::Button(
"Add UI Element");
ComponentTypeID GetComponentTypeID_Static()
void RenderProperties(const nlohmann::json &blueprintData) override
void RenderToolbar(nlohmann::json &blueprintData) override
bool CanHandle(const nlohmann::json &blueprint) const override
std::vector< ValidationError > Validate(const nlohmann::json &blueprint) override
nlohmann::json CreateNew(const std::string &name) override
void RenderEditor(nlohmann::json &blueprintData, EditorContext_st &ctx) override
nlohmann::json CreateNew(const std::string &name) override
void RenderProperties(const nlohmann::json &blueprintData) override
std::vector< ValidationError > Validate(const nlohmann::json &blueprint) override
void RenderToolbar(nlohmann::json &blueprintData) override
bool CanHandle(const nlohmann::json &blueprint) const override
void RenderEditor(nlohmann::json &blueprintData, EditorContext_st &ctx) override
bool CanHandle(const nlohmann::json &blueprint) const override
void RenderEditor(nlohmann::json &blueprintData, EditorContext_st &ctx) override
void RenderToolbar(nlohmann::json &blueprintData) override
void RenderProperties(const nlohmann::json &blueprintData) override
nlohmann::json CreateNew(const std::string &name) override
std::vector< ValidationError > Validate(const nlohmann::json &blueprint) override
void RenderEditor(nlohmann::json &blueprintData, EditorContext_st &ctx) override
bool CanHandle(const nlohmann::json &blueprint) const override
void RenderProperties(const nlohmann::json &blueprintData) override
void RenderToolbar(nlohmann::json &blueprintData) override
nlohmann::json CreateNew(const std::string &name) override
std::vector< ValidationError > Validate(const nlohmann::json &blueprint) override
static std::string GetCurrentTimestamp()