Skip to content

Commit

Permalink
Added group
Browse files Browse the repository at this point in the history
  • Loading branch information
denis authored and denis committed Nov 10, 2024
1 parent fecdb7a commit ed7e468
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Engine/include/Components/Component.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,17 @@ namespace Prisma

virtual ~Component();

void uiRemovable(bool uiRemovable);

bool uiRemovable();

private:
Node* m_parent = nullptr;
bool m_start = false;
bool m_ui = false;
ComponentTypeVector m_globalVars;
std::string m_name;
uint64_t m_uuid;
bool m_uiRemovable = true;
};
}
10 changes: 10 additions & 0 deletions Engine/src/Components/Component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ Prisma::Component::~Component()
//destroy();
}

void Prisma::Component::uiRemovable(bool uiRemovable)
{
m_uiRemovable = uiRemovable;
}

bool Prisma::Component::uiRemovable()
{
return m_uiRemovable;
}

void Prisma::Component::addGlobal(ComponentType globalVar)
{
m_globalVars.push_back(globalVar);
Expand Down
1 change: 1 addition & 0 deletions Engine/src/Components/MaterialComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ void Prisma::MaterialComponent::ui()
addGlobal(m_componentTypeAmbientOcclusion);
}

uiRemovable(false);

m_id = materialId;
materialId++;
Expand Down
2 changes: 1 addition & 1 deletion GUI/src/NodeViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void Prisma::NodeViewer::showComponents(Node* nodeData)
}
}
std::string nameRemove = "Remove Component##" + std::to_string(i);
if (ImGui::Button(nameRemove.c_str()))
if (component.second->uiRemovable() && ImGui::Button(nameRemove.c_str()))
{
indexRemove = component.first;
}
Expand Down

0 comments on commit ed7e468

Please sign in to comment.