From 500f6731439ee2f470d8967942b722e81e3cd0c5 Mon Sep 17 00:00:00 2001 From: Glimps3 <46634213+Glimps3@users.noreply.github.com> Date: Tue, 1 Oct 2024 13:38:15 +0200 Subject: [PATCH 1/8] Add files via upload --- Source/Game/EntityDescription.cpp | 17 +++++++++++++++++ Source/Game/EntityDescription.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/Source/Game/EntityDescription.cpp b/Source/Game/EntityDescription.cpp index 3faeb23d6..dbbbb942f 100644 --- a/Source/Game/EntityDescription.cpp +++ b/Source/Game/EntityDescription.cpp @@ -567,6 +567,15 @@ void EntityDescription::SaveToXML(TiXmlElement* parent) const { } break; } + //Glimpse - Group no_navmesh. + case EDF_CHILDREN_NO_NAVMESH: { + bool val; + field.ReadBool(&val); + if (val) { + object->SetAttribute("children_no_navmesh", "true"); + } + break; + } case EDF_PREFAB_LOCKED: { bool val; field.ReadBool(&val); @@ -868,6 +877,14 @@ void LoadGroupDescriptionFromXML(EntityDescription& desc, const TiXmlElement* el } desc.AddVec3(EDF_COLOR, color); + // Glimpse - Group no_navmesh. + const char* children_no_navmesh = el->Attribute("children_no_navmesh"); + if (children_no_navmesh) { + desc.AddBool(EDF_CHILDREN_NO_NAVMESH, saysTrue(children_no_navmesh) == 1); + } else { + desc.AddBool(EDF_CHILDREN_NO_NAVMESH, false); + } + LoadEntityDescriptionListFromXML(desc.children, el); } diff --git a/Source/Game/EntityDescription.h b/Source/Game/EntityDescription.h index b0a364407..bd6853676 100644 --- a/Source/Game/EntityDescription.h +++ b/Source/Game/EntityDescription.h @@ -71,6 +71,8 @@ enum EntityDescriptionFieldType { EDF_GI_COEFFICIENTS, EDF_NAV_MESH_CONNECTIONS, EDF_NO_NAVMESH, + //Glimpse - Group no_navmesh. + EDF_CHILDREN_NO_NAVMESH, //Used for groups. EDF_PREFAB_LOCKED, EDF_PREFAB_PATH, EDF_ORIGINAL_SCALE, From e14f24513709b80003b9019d7c8444e721dec9c2 Mon Sep 17 00:00:00 2001 From: Glimps3 <46634213+Glimps3@users.noreply.github.com> Date: Tue, 1 Oct 2024 13:38:38 +0200 Subject: [PATCH 2/8] Add files via upload --- Source/Objects/group.cpp | 13 ++++++++++++- Source/Objects/group.h | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Source/Objects/group.cpp b/Source/Objects/group.cpp index c3ad2454f..76229964b 100644 --- a/Source/Objects/group.cpp +++ b/Source/Objects/group.cpp @@ -38,7 +38,9 @@ extern bool g_debug_runtime_disable_group_pre_draw_camera; extern bool g_debug_runtime_disable_group_pre_draw_frame; Group::Group() : child_transforms_need_update(false), - child_moved(false) { + child_moved(false), + //Glimpse - Group no navmesh. + children_no_navmesh(false) { box_.dims = vec3(1.0f); } @@ -118,6 +120,14 @@ bool Group::SetFromDesc(const EntityDescription& desc) { if (!version_edf) { InitShape(); } + for (const auto& field : desc.fields) { + switch (field.type) { + case EDF_CHILDREN_NO_NAVMESH: { + field.ReadBool(&children_no_navmesh); + break; + } + } + } InitRelMats(); } @@ -137,6 +147,7 @@ void Group::GetDesc(EntityDescription& desc) const { obj->GetDesc(desc.children.back()); } } + desc.AddBool(EDF_CHILDREN_NO_NAVMESH, children_no_navmesh); } void Group::InitRelMats() { diff --git a/Source/Objects/group.h b/Source/Objects/group.h index c4c7ea49d..feb782b38 100644 --- a/Source/Objects/group.h +++ b/Source/Objects/group.h @@ -40,6 +40,9 @@ class Group : public Object { bool child_transforms_need_update; bool child_moved; + //Glimpse - Group no navmesh. + bool children_no_navmesh; + Group(); bool Initialize() override; ~Group() override; From 39d2e0c28508484d112f3f13acfda2f46d469aa4 Mon Sep 17 00:00:00 2001 From: Glimps3 <46634213+Glimps3@users.noreply.github.com> Date: Tue, 1 Oct 2024 13:38:56 +0200 Subject: [PATCH 3/8] Add files via upload --- Source/GUI/dimgui/dimgui.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/Source/GUI/dimgui/dimgui.cpp b/Source/GUI/dimgui/dimgui.cpp index 01a63ccf1..044c596da 100644 --- a/Source/GUI/dimgui/dimgui.cpp +++ b/Source/GUI/dimgui/dimgui.cpp @@ -933,6 +933,21 @@ static void DrawLaunchCustomGuiButton(Object* obj, bool& are_script_params_read_ } } +//Glimpse - Group no_navmesh. +static void UpdateChildrenNoNavmesh(Group* group, bool enabled) { + for (auto& i : group->children) { + if (i.direct_ptr->GetType() == _env_object) { + EnvObject* eo = (EnvObject*)i.direct_ptr; + eo->no_navmesh = enabled; + } + if (i.direct_ptr->GetType() == _group) { + Group* sub_group = (Group*)i.direct_ptr; + sub_group->children_no_navmesh = enabled; + UpdateChildrenNoNavmesh(sub_group, enabled); + } + } +} + static void DrawObjectInfoFlat(Object* obj) { ImGui::Indent(ImGui::GetTreeNodeToLabelSpacing()); obj->DrawImGuiEditor(); @@ -1254,6 +1269,15 @@ static void DrawObjectInfoFlat(Object* obj) { ImGui::Separator(); ImGui::Checkbox("no_navmesh", &eo->no_navmesh); } + //Glimpse - Group no_navmesh. + if (obj->GetType() == _group) { + Group* group = (Group*)obj; + ImGui::Separator(); + if (ImGui::Checkbox("children_no_navmesh", &group->children_no_navmesh)) { + bool enabled = group->children_no_navmesh; + UpdateChildrenNoNavmesh(group, enabled); + } + } ImGui::Separator(); if (obj->GetType() == _movement_object) { @@ -1424,6 +1448,16 @@ static void DrawObjectInfo(Object* obj, bool force_expand_script_params) { } } + // Glimpse - Group no_navmesh. + if (obj->GetType() == _group) { + Group* group = (Group*)obj; + ImGui::Separator(); + if (ImGui::Checkbox("children_no_navmesh", &group->children_no_navmesh)) { + bool enabled = group->children_no_navmesh; + UpdateChildrenNoNavmesh(group, enabled); + } + } + if (obj->GetType() == _movement_object) { MovementObject* mo = (MovementObject*)obj; if (ImGui::TreeNode("Color Palette")) { From 0e778ad363e2de360096cdc13d3c3b79088ad5cb Mon Sep 17 00:00:00 2001 From: Glimps3 <46634213+Glimps3@users.noreply.github.com> Date: Tue, 1 Oct 2024 13:41:11 +0200 Subject: [PATCH 4/8] Update EntityDescription.cpp --- Source/Game/EntityDescription.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/Game/EntityDescription.cpp b/Source/Game/EntityDescription.cpp index dbbbb942f..ac7c617ae 100644 --- a/Source/Game/EntityDescription.cpp +++ b/Source/Game/EntityDescription.cpp @@ -567,7 +567,6 @@ void EntityDescription::SaveToXML(TiXmlElement* parent) const { } break; } - //Glimpse - Group no_navmesh. case EDF_CHILDREN_NO_NAVMESH: { bool val; field.ReadBool(&val); @@ -877,7 +876,6 @@ void LoadGroupDescriptionFromXML(EntityDescription& desc, const TiXmlElement* el } desc.AddVec3(EDF_COLOR, color); - // Glimpse - Group no_navmesh. const char* children_no_navmesh = el->Attribute("children_no_navmesh"); if (children_no_navmesh) { desc.AddBool(EDF_CHILDREN_NO_NAVMESH, saysTrue(children_no_navmesh) == 1); From 2641a70a873be2c6c3c6e5ae186efd843f71eb86 Mon Sep 17 00:00:00 2001 From: Glimps3 <46634213+Glimps3@users.noreply.github.com> Date: Tue, 1 Oct 2024 13:41:42 +0200 Subject: [PATCH 5/8] Update EntityDescription.h --- Source/Game/EntityDescription.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/Game/EntityDescription.h b/Source/Game/EntityDescription.h index bd6853676..d8bea72bb 100644 --- a/Source/Game/EntityDescription.h +++ b/Source/Game/EntityDescription.h @@ -71,7 +71,6 @@ enum EntityDescriptionFieldType { EDF_GI_COEFFICIENTS, EDF_NAV_MESH_CONNECTIONS, EDF_NO_NAVMESH, - //Glimpse - Group no_navmesh. EDF_CHILDREN_NO_NAVMESH, //Used for groups. EDF_PREFAB_LOCKED, EDF_PREFAB_PATH, From 9316d35eb0579d6709c3d5d785de025ca3de3732 Mon Sep 17 00:00:00 2001 From: Glimps3 <46634213+Glimps3@users.noreply.github.com> Date: Tue, 1 Oct 2024 13:42:21 +0200 Subject: [PATCH 6/8] Update group.cpp --- Source/Objects/group.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/Objects/group.cpp b/Source/Objects/group.cpp index 76229964b..2357ed0b7 100644 --- a/Source/Objects/group.cpp +++ b/Source/Objects/group.cpp @@ -39,7 +39,6 @@ extern bool g_debug_runtime_disable_group_pre_draw_frame; Group::Group() : child_transforms_need_update(false), child_moved(false), - //Glimpse - Group no navmesh. children_no_navmesh(false) { box_.dims = vec3(1.0f); } From b091e90ba0979e506ca95ce1ddb8beb6f94ed087 Mon Sep 17 00:00:00 2001 From: Glimps3 <46634213+Glimps3@users.noreply.github.com> Date: Tue, 1 Oct 2024 13:42:41 +0200 Subject: [PATCH 7/8] Update group.h --- Source/Objects/group.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/Objects/group.h b/Source/Objects/group.h index feb782b38..aafcfb29b 100644 --- a/Source/Objects/group.h +++ b/Source/Objects/group.h @@ -39,8 +39,6 @@ class Group : public Object { std::vector children; bool child_transforms_need_update; bool child_moved; - - //Glimpse - Group no navmesh. bool children_no_navmesh; Group(); From e33a913b1fdcc5b26a4810e7c4e28b755878b13c Mon Sep 17 00:00:00 2001 From: Glimps3 <46634213+Glimps3@users.noreply.github.com> Date: Tue, 1 Oct 2024 13:43:29 +0200 Subject: [PATCH 8/8] Update dimgui.cpp --- Source/GUI/dimgui/dimgui.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/GUI/dimgui/dimgui.cpp b/Source/GUI/dimgui/dimgui.cpp index 044c596da..2bb25fb9f 100644 --- a/Source/GUI/dimgui/dimgui.cpp +++ b/Source/GUI/dimgui/dimgui.cpp @@ -933,7 +933,6 @@ static void DrawLaunchCustomGuiButton(Object* obj, bool& are_script_params_read_ } } -//Glimpse - Group no_navmesh. static void UpdateChildrenNoNavmesh(Group* group, bool enabled) { for (auto& i : group->children) { if (i.direct_ptr->GetType() == _env_object) { @@ -1269,7 +1268,7 @@ static void DrawObjectInfoFlat(Object* obj) { ImGui::Separator(); ImGui::Checkbox("no_navmesh", &eo->no_navmesh); } - //Glimpse - Group no_navmesh. + if (obj->GetType() == _group) { Group* group = (Group*)obj; ImGui::Separator(); @@ -1448,7 +1447,6 @@ static void DrawObjectInfo(Object* obj, bool force_expand_script_params) { } } - // Glimpse - Group no_navmesh. if (obj->GetType() == _group) { Group* group = (Group*)obj; ImGui::Separator();