Skip to content

Commit

Permalink
Added groups
Browse files Browse the repository at this point in the history
  • Loading branch information
denis authored and denis committed Nov 10, 2024
1 parent 6b1af49 commit fecdb7a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
2 changes: 0 additions & 2 deletions Engine/src/Components/PhysicsMeshComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ void Prisma::PhysicsMeshComponent::ui()

addGlobal(componentBend);

addGlobal(componentType);

addGlobal(componentDynamic);

addGlobal(componentSoftBody);
Expand Down
1 change: 0 additions & 1 deletion Engine/src/Handlers/ComponentsHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ void Prisma::ComponentsHandler::removeComponent(std::shared_ptr<Component> compo
// Erase the removed elements (if any)
if (it != m_components.end())
{
std::cout << "a" << std::endl;
m_components.erase(it);
}
}
Expand Down
3 changes: 2 additions & 1 deletion GUI/include/NodeViewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ namespace Prisma

void showComponents(Node* nodeData);

void showSelected(const NodeData& nodeData, bool end = true, bool showData = true);
void showSelected(const NodeData& nodeData, bool end = true, bool showData = true,
Node* componentAdding = nullptr);
// Getters for textures
const std::shared_ptr<Texture>& rotateTexture() const;

Expand Down
12 changes: 9 additions & 3 deletions GUI/src/MeshInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ void Prisma::MeshInfo::showSelected(const NodeViewer::NodeData& meshData)
{
if (meshData.node)
{
auto parent = meshData;
parent.node = meshData.node->parent();
std::shared_ptr<PhysicsMeshComponent> physicsComponent = nullptr;
for (auto component : meshData.node->components())
{
Expand All @@ -21,9 +23,7 @@ void Prisma::MeshInfo::showSelected(const NodeViewer::NodeData& meshData)
auto mesh = dynamic_cast<Prisma::Mesh*>(meshData.node);
auto isAnimate = dynamic_cast<AnimatedMesh*>(meshData.node);

NodeViewer::getInstance().showSelected(meshData, false,
isAnimate || (physicsComponent && !physicsComponent->collisionData().
softBody) || !physicsComponent);
NodeViewer::getInstance().showSelected(parent, false, false, meshData.node);
ImGui::Dummy(ImVec2(0.0f, 4.0f));

if (mesh)
Expand All @@ -46,6 +46,12 @@ void Prisma::MeshInfo::showSelected(const NodeViewer::NodeData& meshData)
{
physicsComponent->updateCollisionData();
}
ImGui::Dummy(ImVec2(0, 4));
if (isAnimate || (physicsComponent && !physicsComponent->collisionData().
softBody) || !physicsComponent)
{
NodeViewer::getInstance().showComponents(meshData.node);
}

ImGui::Dummy(ImVec2(0, 10));
if (isAnimate)
Expand Down
12 changes: 10 additions & 2 deletions GUI/src/NodeViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ void Prisma::NodeViewer::showComponents(Node* nodeData)

// Getters for textures

void Prisma::NodeViewer::showSelected(const NodeData& nodeData, bool end, bool showData)
void Prisma::NodeViewer::showSelected(const NodeData& nodeData, bool end, bool showData,
Node* componentAdding)
{
if (nodeData.node)
{
Expand Down Expand Up @@ -210,7 +211,14 @@ void Prisma::NodeViewer::showSelected(const NodeData& nodeData, bool end, bool s
ImGui::SameLine();
if (ImGui::Button("Add component"))
{
nodeData.node->addComponent(Prisma::Factory::createInstance(components[m_componentSelect]));
if (componentAdding)
{
componentAdding->addComponent(Prisma::Factory::createInstance(components[m_componentSelect]));
}
else
{
nodeData.node->addComponent(Prisma::Factory::createInstance(components[m_componentSelect]));
}
}
if (showData)
{
Expand Down

0 comments on commit fecdb7a

Please sign in to comment.