重构ui_editor:向引擎核心类型对齐
- 删除UI::Event,使用XCEngine::Core::Event替代 - GameObject.h重构,Component添加friend class Entity - LogEntry使用XCEngine::Debug::LogLevel - SceneManager/SelectionManager使用XCEngine::Core::Event - LogSystem使用XCEngine::Debug::LogLevel - CMakeLists.txt添加engine/include路径
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "SceneManager.h"
|
||||
#include "SelectionManager.h"
|
||||
#include <algorithm>
|
||||
|
||||
namespace UI {
|
||||
@@ -11,7 +12,7 @@ EntityID SceneManager::CreateEntity(const std::string& name, EntityID parent) {
|
||||
entity.parent = parent;
|
||||
m_entities[id] = std::move(entity);
|
||||
|
||||
if (parent != INVALID_ENTITY) {
|
||||
if (parent != INVALID_ENTITY_ID) {
|
||||
m_entities[parent].children.push_back(id);
|
||||
} else {
|
||||
m_rootEntities.push_back(id);
|
||||
@@ -32,7 +33,7 @@ void SceneManager::DeleteEntity(EntityID id) {
|
||||
DeleteEntity(childId);
|
||||
}
|
||||
|
||||
if (entity.parent != INVALID_ENTITY) {
|
||||
if (entity.parent != INVALID_ENTITY_ID) {
|
||||
auto* parent = GetEntity(entity.parent);
|
||||
if (parent) {
|
||||
auto& siblings = parent->children;
|
||||
@@ -118,14 +119,14 @@ EntityID SceneManager::PasteEntityRecursive(const ClipboardData& data, EntityID
|
||||
}
|
||||
|
||||
EntityID SceneManager::PasteEntity(EntityID parent) {
|
||||
if (!m_clipboard) return INVALID_ENTITY;
|
||||
if (!m_clipboard) return INVALID_ENTITY_ID;
|
||||
return PasteEntityRecursive(*m_clipboard, parent);
|
||||
}
|
||||
|
||||
EntityID SceneManager::DuplicateEntity(EntityID id) {
|
||||
CopyEntity(id);
|
||||
const Entity* entity = GetEntity(id);
|
||||
if (!entity) return INVALID_ENTITY;
|
||||
if (!entity) return INVALID_ENTITY_ID;
|
||||
return PasteEntity(entity->parent);
|
||||
}
|
||||
|
||||
@@ -133,7 +134,7 @@ void SceneManager::MoveEntity(EntityID id, EntityID newParent) {
|
||||
Entity* entity = GetEntity(id);
|
||||
if (!entity || id == newParent) return;
|
||||
|
||||
if (entity->parent != INVALID_ENTITY) {
|
||||
if (entity->parent != INVALID_ENTITY_ID) {
|
||||
Entity* oldParent = GetEntity(entity->parent);
|
||||
if (oldParent) {
|
||||
auto& siblings = oldParent->children;
|
||||
@@ -145,7 +146,7 @@ void SceneManager::MoveEntity(EntityID id, EntityID newParent) {
|
||||
|
||||
entity->parent = newParent;
|
||||
|
||||
if (newParent != INVALID_ENTITY) {
|
||||
if (newParent != INVALID_ENTITY_ID) {
|
||||
Entity* newParentEntity = GetEntity(newParent);
|
||||
if (newParentEntity) {
|
||||
newParentEntity->children.push_back(id);
|
||||
|
||||
Reference in New Issue
Block a user