add EditorNameComponent by default
This commit is contained in:
@@ -37,7 +37,7 @@ namespace Nz
|
|||||||
bool CloseLevel();
|
bool CloseLevel();
|
||||||
bool OpenLevel(const std::filesystem::path& path);
|
bool OpenLevel(const std::filesystem::path& path);
|
||||||
|
|
||||||
entt::handle CreateEntity();
|
entt::handle CreateEntity(const std::string& name);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void RegisterWindow()
|
void RegisterWindow()
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include <NazaraEditor/Core/Application/BaseApplication.hpp>
|
#include <NazaraEditor/Core/Application/BaseApplication.hpp>
|
||||||
|
#include <NazaraEditor/Core/Components/NameComponent.hpp>
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
@@ -49,9 +50,12 @@ namespace Nz
|
|||||||
return m_level;
|
return m_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
entt::handle EditorBaseApplication::CreateEntity()
|
entt::handle EditorBaseApplication::CreateEntity(const std::string& name)
|
||||||
{
|
{
|
||||||
entt::handle entity = m_level.CreateEntity();
|
entt::handle entity = m_level.CreateEntity();
|
||||||
|
Nz::EditorNameComponent& nameComponent = entity.emplace<Nz::EditorNameComponent>();
|
||||||
|
nameComponent.SetName(name);
|
||||||
|
|
||||||
entity.emplace<Nz::NodeComponent>();
|
entity.emplace<Nz::NodeComponent>();
|
||||||
|
|
||||||
OnEntityCreated(entity);
|
OnEntityCreated(entity);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ int WinMain(int argc, char* argv[])
|
|||||||
.type(entt::type_hash<Nz::EditorNameComponent>::value())
|
.type(entt::type_hash<Nz::EditorNameComponent>::value())
|
||||||
.func<&Nz::ReflectComponent<Nz::EditorPropertyInspector<Nz::EditorRenderer>, Nz::EditorNameComponent>>(entt::hashed_string("Reflect"));
|
.func<&Nz::ReflectComponent<Nz::EditorPropertyInspector<Nz::EditorRenderer>, Nz::EditorNameComponent>>(entt::hashed_string("Reflect"));
|
||||||
|
|
||||||
entt::handle entity = app.CreateEntity();
|
entt::handle entity = app.CreateEntity("TestEntity");
|
||||||
|
|
||||||
return app.Run();
|
return app.Run();
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user