From 415f6dd5cd16db8315014db35a5244fbca291f59 Mon Sep 17 00:00:00 2001 From: Antoine Pilote Date: Mon, 17 Jul 2023 01:49:32 -0400 Subject: [PATCH] Added Wren API endpoints + random cleanup --- Editor/resources/Scripts/Scene.wren | 4 +++- Nuake/src/Core/FileSystem.cpp | 2 +- Nuake/src/Scene/Scene.cpp | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Editor/resources/Scripts/Scene.wren b/Editor/resources/Scripts/Scene.wren index b6bfd84a..1464c3c3 100644 --- a/Editor/resources/Scripts/Scene.wren +++ b/Editor/resources/Scripts/Scene.wren @@ -4,7 +4,9 @@ import "Nuake:Math" for Vector3 class Scene { foreign static GetEntityID(name) - + foreign static AddEntity(name) + foreign static AddPrefab(prefabPath) + static GetEntity(name) { var entId = Scene.GetEntityID(name) var ent = Entity.new(entId) diff --git a/Nuake/src/Core/FileSystem.cpp b/Nuake/src/Core/FileSystem.cpp index 92147225..3c5e9661 100644 --- a/Nuake/src/Core/FileSystem.cpp +++ b/Nuake/src/Core/FileSystem.cpp @@ -220,7 +220,7 @@ namespace Nuake std::string FileSystem::GetFileNameFromPath(const std::string& path) { - const auto split = String::Split(path, '\\'); + const auto& split = String::Split(path, '\\'); return String::Split(split[split.size() - 1], '.')[0]; } diff --git a/Nuake/src/Scene/Scene.cpp b/Nuake/src/Scene/Scene.cpp index be9c5350..575d8781 100644 --- a/Nuake/src/Scene/Scene.cpp +++ b/Nuake/src/Scene/Scene.cpp @@ -179,12 +179,14 @@ namespace Nuake { Entity Scene::GetEntity(const std::string& name) { std::vector allEntities; - auto view = m_Registry.view(); + const auto& view = m_Registry.view(); for (auto e : view) { - auto [transform, namec] = view.get(e); + const auto& namec = view.get(e); if (namec.Name == name) + { return Entity{ e, this }; + } } return Entity();