checkpoint: commit current workspace state
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include "Scene/EditorSceneRuntime.h"
|
||||
#include "Scene/EditorSceneRuntime.h"
|
||||
|
||||
#include <XCEngine/Components/ComponentFactoryRegistry.h>
|
||||
#include <XCEngine/Components/CameraComponent.h>
|
||||
@@ -501,17 +501,17 @@ bool EditorSceneRuntime::MoveGameObjectToRoot(std::string_view itemId) {
|
||||
|
||||
bool EditorSceneRuntime::AddComponentToSelectedGameObject(
|
||||
std::string_view componentTypeName) {
|
||||
if (componentTypeName.empty()) {
|
||||
return AddComponentToGameObject(GetSelectedItemId(), componentTypeName);
|
||||
}
|
||||
|
||||
bool EditorSceneRuntime::AddComponentToGameObject(
|
||||
std::string_view itemId,
|
||||
std::string_view componentTypeName) {
|
||||
if (itemId.empty() || componentTypeName.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::optional<GameObject::ID> selectedId = GetSelectedGameObjectId();
|
||||
Scene* scene = GetActiveScene();
|
||||
if (!selectedId.has_value() || scene == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
GameObject* gameObject = scene->FindByID(selectedId.value());
|
||||
GameObject* gameObject = FindGameObject(itemId);
|
||||
if (gameObject == nullptr) {
|
||||
return false;
|
||||
}
|
||||
@@ -1071,3 +1071,4 @@ void EditorSceneRuntime::ClearInvalidToolInteractionState() {
|
||||
}
|
||||
|
||||
} // namespace XCEngine::UI::Editor::App
|
||||
|
||||
|
||||
Reference in New Issue
Block a user