Support for "name" attribute on entities

This commit is contained in:
2016-01-11 11:24:00 +01:00
parent c47ef61ddc
commit 297a3fb493
7 changed files with 69 additions and 25 deletions
+8 -2
View File
@@ -279,7 +279,6 @@ bool EditorSystem::OnFileDropped(const Events::FileDropped& e)
return true;
}
void EditorSystem::createWidget()
{
if (m_Widget == EntityID_Invalid) {
@@ -600,7 +599,14 @@ bool EditorSystem::createEntityNode(World* world, EntityID entity)
}
ImGui::SetNextTreeNodeOpened(true, ImGuiSetCond_Once);
if (ImGui::TreeNode((std::string("#") + std::to_string(entity)).c_str())) {
std::string nodeTitle;
const std::string& entityName = world->GetName(entity);
if (!entityName.empty()) {
nodeTitle = entityName;
} else {
nodeTitle = std::string("#") + std::to_string(entity);
}
if (ImGui::TreeNode(nodeTitle.c_str())) {
if (m_UIDraggingEntity != EntityID_Invalid && ImGui::IsItemHoveredRect() && ImGui::IsMouseReleased(0)) {
LOG_DEBUG("Changed parent of %i to %i", m_UIDraggingEntity, entity);
changeParent(m_UIDraggingEntity, entity);