|
|
|
@ -57,9 +57,13 @@ namespace SHADE
|
|
|
|
|
skipFrame = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
DrawMenuBar();
|
|
|
|
|
auto const& sceneGraph = SHSceneManager::GetCurrentSceneGraph();
|
|
|
|
|
|
|
|
|
|
DrawMenuBar();
|
|
|
|
|
if(wasFilterChanged && !filter.empty())
|
|
|
|
|
{
|
|
|
|
|
filterHighlightedEntities.clear();
|
|
|
|
|
filterOpenEntities.clear();
|
|
|
|
|
}
|
|
|
|
|
if (const auto root = sceneGraph.GetRoot())
|
|
|
|
|
{
|
|
|
|
|
auto const& children = root->GetChildren();
|
|
|
|
@ -67,7 +71,13 @@ namespace SHADE
|
|
|
|
|
for (const auto child : children)
|
|
|
|
|
{
|
|
|
|
|
if (child)
|
|
|
|
|
{
|
|
|
|
|
if(wasFilterChanged && !filter.empty())
|
|
|
|
|
{
|
|
|
|
|
EntityFilterCheck(child);
|
|
|
|
|
}
|
|
|
|
|
RecursivelyDrawEntityNode(child);
|
|
|
|
|
}
|
|
|
|
|
if (skipFrame)
|
|
|
|
|
{
|
|
|
|
|
ImGui::End();
|
|
|
|
@ -177,9 +187,10 @@ namespace SHADE
|
|
|
|
|
|
|
|
|
|
void SHHierarchyPanel::DrawHierarchyPanelFilter() noexcept
|
|
|
|
|
{
|
|
|
|
|
wasFilterChanged = false;
|
|
|
|
|
if(ImGui::InputTextWithHint("##hierarchyPanelFilter", "Filter", &filter))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
wasFilterChanged = true;
|
|
|
|
|
}
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
|
if(ImGui::Button("x"))
|
|
|
|
@ -199,29 +210,70 @@ namespace SHADE
|
|
|
|
|
bool result = false;
|
|
|
|
|
|
|
|
|
|
result |= SHStringUtilities::StringFindInsensitive(entity->name, filter) != std::string::npos;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(SHStringUtilities::StringFindInsensitive(rttr::type::get<SHTransformComponent>().get_name().data(), filter) != std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
result |= SHComponentManager::HasComponent<SHTransformComponent>(eid);
|
|
|
|
|
}
|
|
|
|
|
//result |= SHStringUtilities::StringFindInsensitive(rttr::type::get<SHColliderComponent>().get_name().data(), filter) != std::string::npos;
|
|
|
|
|
//result |= SHStringUtilities::StringFindInsensitive(rttr::type::get<SHRigidBodyComponent>().get_name().data(), filter) != std::string::npos;
|
|
|
|
|
//result |= SHStringUtilities::StringFindInsensitive(rttr::type::get<SHCameraComponent>().get_name().data(), filter) != std::string::npos;
|
|
|
|
|
//result |= SHStringUtilities::StringFindInsensitive(rttr::type::get<SHCameraArmComponent>().get_name().data(), filter) != std::string::npos;
|
|
|
|
|
//result |= SHStringUtilities::StringFindInsensitive(rttr::type::get<SHRenderable>().get_name().data(), filter) != std::string::npos;
|
|
|
|
|
//result |= SHStringUtilities::StringFindInsensitive(rttr::type::get<SHLightComponent>().get_name().data(), filter) != std::string::npos;
|
|
|
|
|
//result |= SHStringUtilities::StringFindInsensitive(rttr::type::get<SHTextRenderableComponent>().get_name().data(), filter) != std::string::npos;
|
|
|
|
|
//result |= SHStringUtilities::StringFindInsensitive(rttr::type::get<SHUIComponent>().get_name().data(), filter) != std::string::npos;
|
|
|
|
|
//result |= SHStringUtilities::StringFindInsensitive(rttr::type::get<SHButtonComponent>().get_name().data(), filter) != std::string::npos;
|
|
|
|
|
//result |= SHStringUtilities::StringFindInsensitive(rttr::type::get<SHCanvasComponent>().get_name().data(), filter) != std::string::npos;
|
|
|
|
|
if(SHStringUtilities::StringFindInsensitive(rttr::type::get<SHColliderComponent>().get_name().data(), filter) != std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
result |= SHComponentManager::HasComponent<SHColliderComponent>(eid);
|
|
|
|
|
}
|
|
|
|
|
if(SHStringUtilities::StringFindInsensitive(rttr::type::get<SHRigidBodyComponent>().get_name().data(), filter) != std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
result |= SHComponentManager::HasComponent<SHRigidBodyComponent>(eid);
|
|
|
|
|
}
|
|
|
|
|
if(SHStringUtilities::StringFindInsensitive(rttr::type::get<SHCameraComponent>().get_name().data(), filter) != std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
result |= SHComponentManager::HasComponent<SHCameraComponent>(eid);
|
|
|
|
|
}
|
|
|
|
|
if(SHStringUtilities::StringFindInsensitive(rttr::type::get<SHCameraArmComponent>().get_name().data(), filter) != std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
result |= SHComponentManager::HasComponent<SHCameraArmComponent>(eid);
|
|
|
|
|
}
|
|
|
|
|
if(SHStringUtilities::StringFindInsensitive(rttr::type::get<SHRenderable>().get_name().data(), filter) != std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
result |= SHComponentManager::HasComponent<SHRenderable>(eid);
|
|
|
|
|
}
|
|
|
|
|
if(SHStringUtilities::StringFindInsensitive(rttr::type::get<SHLightComponent>().get_name().data(), filter) != std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
result |= SHComponentManager::HasComponent<SHLightComponent>(eid);
|
|
|
|
|
}
|
|
|
|
|
if(SHStringUtilities::StringFindInsensitive(rttr::type::get<SHTextRenderableComponent>().get_name().data(), filter) != std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
result |= SHComponentManager::HasComponent<SHTextRenderableComponent>(eid);
|
|
|
|
|
}
|
|
|
|
|
if(SHStringUtilities::StringFindInsensitive(rttr::type::get<SHUIComponent>().get_name().data(), filter) != std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
result |= SHComponentManager::HasComponent<SHUIComponent>(eid);
|
|
|
|
|
}
|
|
|
|
|
if(SHStringUtilities::StringFindInsensitive(rttr::type::get<SHButtonComponent>().get_name().data(), filter) != std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
result |= SHComponentManager::HasComponent<SHButtonComponent>(eid);
|
|
|
|
|
}
|
|
|
|
|
if(SHStringUtilities::StringFindInsensitive(rttr::type::get<SHCanvasComponent>().get_name().data(), filter) != std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
result |= SHComponentManager::HasComponent<SHCanvasComponent>(eid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//std::vector<SHSceneNode*> const& children = entityNode->GetChildren();
|
|
|
|
|
|
|
|
|
|
//for (auto const& child : children)
|
|
|
|
|
//{
|
|
|
|
|
// result |= EntityFilterCheck(child);
|
|
|
|
|
//}
|
|
|
|
|
if(result)
|
|
|
|
|
{
|
|
|
|
|
filterHighlightedEntities.push_back(eid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<SHSceneNode*> const& children = entityNode->GetChildren();
|
|
|
|
|
|
|
|
|
|
bool open = false;
|
|
|
|
|
for (auto const& child : children)
|
|
|
|
|
{
|
|
|
|
|
open |= EntityFilterCheck(child);
|
|
|
|
|
}
|
|
|
|
|
result |= open;
|
|
|
|
|
|
|
|
|
|
if(open)
|
|
|
|
|
{
|
|
|
|
|
filterOpenEntities.push_back(eid);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -245,31 +297,27 @@ namespace SHADE
|
|
|
|
|
|
|
|
|
|
const bool isSelected = (std::ranges::find(editor->selectedEntities, eid) != editor->selectedEntities.end());
|
|
|
|
|
|
|
|
|
|
bool highlighted = false;
|
|
|
|
|
//if(!filter.empty())
|
|
|
|
|
//{
|
|
|
|
|
// highlighted = EntityFilterCheck(currentNode);
|
|
|
|
|
// if (highlighted)
|
|
|
|
|
// {
|
|
|
|
|
// ImGui::PushStyleColor(ImGuiCol_Text, highlightedColor);
|
|
|
|
|
//
|
|
|
|
|
// ImGui::SetNextItemOpen(true);
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
bool highlighted = false, open = false;
|
|
|
|
|
if(!filter.empty())
|
|
|
|
|
{
|
|
|
|
|
highlighted = (std::ranges::find(filterHighlightedEntities, eid) != filterHighlightedEntities.end());
|
|
|
|
|
if(open = std::ranges::find(filterOpenEntities, eid) != filterOpenEntities.end())
|
|
|
|
|
{
|
|
|
|
|
ImGui::SetNextItemOpen(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!open && !highlighted)
|
|
|
|
|
{
|
|
|
|
|
return ImRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax());
|
|
|
|
|
}
|
|
|
|
|
ImGui::PushStyleColor(ImGuiCol_Text, highlighted ? highlightedColor : ImVec4(0.5f, 0.5f, 0.5f, 1.f ));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ImGuiTreeNodeFlags nodeFlags = ((isSelected) ? ImGuiTreeNodeFlags_Selected : 0) | ((children.empty()) ? ImGuiTreeNodeFlags_Leaf : ImGuiTreeNodeFlags_OpenOnArrow);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Draw Node
|
|
|
|
|
bool isNodeOpen = ImGui::TreeNodeEx(reinterpret_cast<void*>(eid), nodeFlags, "%u: %s", SHEntityManager::GetEntityIndex(eid), entity->name.c_str());
|
|
|
|
|
|
|
|
|
|
if (highlighted)
|
|
|
|
|
if(!filter.empty())
|
|
|
|
|
{
|
|
|
|
|
ImGui::PopStyleColor();
|
|
|
|
|
}
|
|
|
|
|