Compare commits

...

1 Commits

Author SHA256 Message Date
11e8d343af small fises in deleting Transformables WIP 2026-01-20 23:11:49 +01:00
5 changed files with 25 additions and 3 deletions

View File

@@ -34,6 +34,10 @@ namespace TSE
objectEntries[id] = this;
}
Transformable::~Transformable()
{
}
Vector3 Transformable::forward() const
{
return Vector3::Normalize(GetGlobalMatrix() * Vector3::forward - GetGlobalMatrix() * Vector3::zero);
@@ -368,12 +372,15 @@ namespace TSE
if(!onlyThis)
for(auto child : t->children)
{
HardDelete(child);
HardDelete(child, onlyThis);
}
//deleting atteched scripts
for (auto& [_, script] : t->components)
{
delete script;
}
t->components.clear();
//deleting self
Delete(t);

View File

@@ -36,7 +36,7 @@ namespace TSE
Transformable(uuids::uuid id);
Transformable(const string& name);
Transformable(const string& name, uuids::uuid id);
~Transformable() = default;
~Transformable();
Vector3 forward() const;
Vector3 right() const;

View File

@@ -123,6 +123,8 @@ void TSE::EDITOR::HirearchieView::MenuBar()
ImGui::EndMenuBar();
}
bool selectedFound = false;
void TSE::EDITOR::HirearchieView::DisplayLayer(Layer *l)
{
ImGui::Indent(20.0f);
@@ -180,10 +182,15 @@ void TSE::EDITOR::HirearchieView::DisplayLayer(Layer *l)
}
if(collapseOpen)
{
selectedFound = false;
for(int i = 0; i < l->GetAllObjects().size(); i++)
{
DisplayObj(l->GetAllObjects()[i], l);
}
if(!selectedFound && PropertiesView::GetCurrentInspectableType() == InspectableType::Transformable)
{
PropertiesView::ForceClearInspectorElement();
}
}
ImGui::Unindent(20.0f);
}
@@ -198,8 +205,10 @@ void TSE::EDITOR::HirearchieView::DisplayObj(Transformable *t, Layer *l)
if(selected == t->id)
{
flags |= ImGuiTreeNodeFlags_Selected;
selectedFound = true;
}
bool open = ImGui::TreeNodeEx((t->GetName() + "##" + to_string(t->id)).c_str(), flags);
string name = t->GetName() + "##" + to_string(t->id);
bool open = ImGui::TreeNodeEx((name).c_str(), flags);
if(ImGui::BeginPopupContextItem())
{
bool disabled = false;

View File

@@ -30,6 +30,11 @@ void TSE::EDITOR::PropertiesView::MenuBar()
ImGui::EndMenuBar();
}
TSE::EDITOR::InspectableType TSE::EDITOR::PropertiesView::GetCurrentInspectableType()
{
return currentlyInspecting.type;
}
void TSE::EDITOR::PropertiesView::SetInspectorElement(InspectableType type, void *element)
{
if(!locked)

View File

@@ -17,6 +17,7 @@ namespace TSE::EDITOR
void Define() override;
void MenuBar();
static InspectableType GetCurrentInspectableType();
static void SetInspectorElement(InspectableType type, void* element);
static void ClearInspectorElement();
static void ForceClearInspectorElement();