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