feat: update editor ui framework and assets
This commit is contained in:
@@ -17,14 +17,16 @@ void DrawHierarchyTreePrefix(const XCEngine::Editor::UI::TreeNodePrefixContext&
|
||||
return;
|
||||
}
|
||||
|
||||
const ImVec4 color = XCEngine::Editor::UI::NavigationTreePrefixColor(context.selected, context.hovered);
|
||||
const float size = 9.0f;
|
||||
const float centerX = context.min.x + (context.max.x - context.min.x) * 0.5f;
|
||||
const float centerY = context.min.y + (context.max.y - context.min.y) * 0.5f;
|
||||
const ImVec2 min(centerX - size * 0.5f, centerY - size * 0.5f);
|
||||
const ImVec2 max(centerX + size * 0.5f, centerY + size * 0.5f);
|
||||
context.drawList->AddRect(min, max, ImGui::GetColorU32(color), 1.5f);
|
||||
context.drawList->AddLine(ImVec2(min.x, centerY), ImVec2(max.x, centerY), ImGui::GetColorU32(color), 1.0f);
|
||||
const float width = context.max.x - context.min.x;
|
||||
const float height = context.max.y - context.min.y;
|
||||
const float iconExtent = XCEngine::Editor::UI::NavigationTreeIconSize();
|
||||
const float minX = context.min.x + (width - iconExtent) * 0.5f;
|
||||
const float minY = context.min.y + (height - iconExtent) * 0.5f;
|
||||
XCEngine::Editor::UI::DrawAssetIcon(
|
||||
context.drawList,
|
||||
ImVec2(minX, minY),
|
||||
ImVec2(minX + iconExtent, minY + iconExtent),
|
||||
XCEngine::Editor::UI::AssetIconKind::GameObject);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -95,7 +97,7 @@ void HierarchyPanel::Render() {
|
||||
|
||||
Actions::ObserveFocusedActionRoute(*m_context, EditorActionRoute::Hierarchy);
|
||||
|
||||
UI::PanelContentScope content("EntityList");
|
||||
UI::PanelContentScope content("EntityList", UI::HierarchyPanelContentPadding());
|
||||
if (!content.IsOpen()) {
|
||||
ImGui::PopStyleColor(2);
|
||||
return;
|
||||
@@ -103,6 +105,7 @@ void HierarchyPanel::Render() {
|
||||
|
||||
auto& sceneManager = m_context->GetSceneManager();
|
||||
auto rootEntities = sceneManager.GetRootEntities();
|
||||
UI::ResetTreeLayout();
|
||||
|
||||
for (auto* gameObject : rootEntities) {
|
||||
RenderEntity(gameObject);
|
||||
@@ -147,6 +150,7 @@ void HierarchyPanel::RenderEntity(::XCEngine::Components::GameObject* gameObject
|
||||
nodeDefinition.options.leaf = gameObject->GetChildCount() == 0;
|
||||
const std::string persistenceKey = std::to_string(gameObject->GetUUID());
|
||||
nodeDefinition.persistenceKey = persistenceKey;
|
||||
nodeDefinition.style = UI::HierarchyTreeStyle();
|
||||
nodeDefinition.prefix.width = UI::NavigationTreePrefixWidth();
|
||||
nodeDefinition.prefix.draw = DrawHierarchyTreePrefix;
|
||||
nodeDefinition.callbacks.onInteraction = [this, gameObject](const UI::TreeNodeResult& node) {
|
||||
|
||||
Reference in New Issue
Block a user