Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jmorton06 committed Dec 10, 2024
1 parent 70a3265 commit d94ba07
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
31 changes: 20 additions & 11 deletions Editor/Source/HierarchyPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,26 @@ namespace Lumos

if(!node.Valid())
return;
bool visible = ImGui::IsRectVisible(ImVec2(ImGui::GetContentRegionMax().x, ImGui::GetTextLineHeightWithSpacing()));
if (!visible)
{
ImGui::NewLine();
return;
}

Entity nodeEntity = { node, Application::Get().GetSceneManager()->GetCurrentScene() };

String8 name = PushStr8Copy(m_StringArena, node.GetName().c_str()); // StringUtilities::ToString(entt::to_integral(node));
String8 name = PushStr8Copy(m_StringArena, node.GetName().c_str());

if(m_HierarchyFilter.IsActive())
if(visible && m_HierarchyFilter.IsActive())
{
if(!m_HierarchyFilter.PassFilter((const char*)name.str))
{
show = false;
}
}


if(show)
{
// ImGui::PushID((int)node);
Expand All @@ -92,8 +99,7 @@ namespace Lumos
nodeFlags |= ImGuiTreeNodeFlags_Leaf;
}

// auto activeComponent = registry.try_get<ActiveComponent>(node);
bool active = Entity(node, m_Editor->GetCurrentScene()).Active(); // activeComponent ? activeComponent->active : true;
bool active = visible && Entity(node, m_Editor->GetCurrentScene()).Active();

if(!active)
ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled));
Expand All @@ -117,12 +123,16 @@ namespace Lumos
String8 icon = Str8C((char*)ICON_MDI_CUBE_OUTLINE);
auto& iconMap = m_Editor->GetComponentIconMap();

if(node.HasComponent<Camera>())
if (!visible)
{
icon = Str8C((char*)ICON_MDI_CUBE_OUTLINE);
}
else if(node.HasComponent<Camera>())
{
if(iconMap.find(typeid(Camera).hash_code()) != iconMap.end())
icon = Str8C((char*)iconMap[typeid(Camera).hash_code()]);
}
if(node.HasComponent<LuaScriptComponent>())
else if(node.HasComponent<LuaScriptComponent>())
{
if(iconMap.find(typeid(LuaScriptComponent).hash_code()) != iconMap.end())
icon = Str8C((char*)iconMap[typeid(LuaScriptComponent).hash_code()]);
Expand Down Expand Up @@ -159,7 +169,7 @@ namespace Lumos
}

ImGui::PushStyleColor(ImGuiCol_Text, ImGuiUtilities::GetIconColour());
// ImGui::BeginGroup();

bool nodeOpen = ImGui::TreeNodeEx((void*)(intptr_t)node.GetID(), nodeFlags, "%s", (const char*)icon.str);
{
if(ImGui::BeginDragDropSource())
Expand Down Expand Up @@ -204,7 +214,7 @@ namespace Lumos
m_DoubleClicked = {};
}

if(ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left) && ImGui::IsItemHovered(ImGuiHoveredFlags_None))
if(visible && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left) && ImGui::IsItemHovered(ImGuiHoveredFlags_None))
{
m_DoubleClicked = node;
if(Application::Get().GetEditorState() == EditorState::Preview)
Expand Down Expand Up @@ -247,7 +257,6 @@ namespace Lumos
if(isPrefab)
ImGui::PopStyleColor();
}
// ImGui::EndGroup();

if(doubleClicked)
{
Expand Down Expand Up @@ -427,7 +436,7 @@ namespace Lumos
m_CurrentPrevious = node;

#if 1
bool showButton = true; // hovered || !active;
bool showButton = true;// hovered || !active;

if(showButton)
{
Expand Down Expand Up @@ -457,7 +466,7 @@ namespace Lumos
verticalLineStart.x += SmallOffsetX; // to nicely line up with the arrow symbol
ImVec2 verticalLineEnd = verticalLineStart;

if(!noChildren)
if(visible && !noChildren)
{
entt::entity child = hierarchyComponent->First();
while(child != entt::null && registry.valid(child))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ namespace Lumos

float frictionalMass = (m_pNodeA->GetInverseMass() + m_pNodeB->GetInverseMass())
+ Maths::Dot(tangent, Maths::Cross(m_pNodeA->GetInverseInertia() * Maths::Cross(r1, tangent), r1) + Maths::Cross(m_pNodeB->GetInverseInertia() * Maths::Cross(r2, tangent), r2));
float frictionCoef = Maths::Sqrt(Maths::Max(m_pNodeA->GetFriction(), 0.1f) * Maths::Max(m_pNodeB->GetFriction(), 0.1f));
float frictionCoef = Maths::Sqrt(m_pNodeA->GetFriction() * m_pNodeB->GetFriction());
float jt = -1.0f * frictionCoef * Maths::Dot(dv, tangent) / frictionalMass;

// Clamp friction to never apply more force than the main collision
Expand Down
2 changes: 1 addition & 1 deletion Lumos/Source/Lumos/Platform/iOS/iOSWindow.mm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{
auto prop = properties;

auto iosOS = (iOSOS*)iOSOS::Instance();
auto iosOS = (iOSOS*)&iOSOS::Get();

prop.Width = (uint32_t)iosOS->GetWidth();
prop.Height = (uint32_t)iosOS->GetHeight();
Expand Down

0 comments on commit d94ba07

Please sign in to comment.