No longer can create camera in an empty level (#5189)
Signed-off-by: Mikhail Naumov <mnaumov@amazon.com>
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
|
||||
#include <AzToolsFramework/API/EntityCompositionRequestBus.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityHelpers.h>
|
||||
#include <AzToolsFramework/Entity/PrefabEditorEntityOwnershipInterface.h>
|
||||
|
||||
#include <AzToolsFramework/API/EditorCameraBus.h>
|
||||
#include "ViewportCameraSelectorWindow.h"
|
||||
@@ -70,7 +71,20 @@ namespace Camera
|
||||
if (!(flags & AzToolsFramework::EditorEvents::eECMF_HIDE_ENTITY_CREATION))
|
||||
{
|
||||
QAction* action = menu->addAction(QObject::tr("Create camera entity from view"));
|
||||
QObject::connect(action, &QAction::triggered, [this]() { CreateCameraEntityFromViewport(); });
|
||||
const auto prefabEditorEntityOwnershipInterface = AZ::Interface<AzToolsFramework::PrefabEditorEntityOwnershipInterface>::Get();
|
||||
if (prefabEditorEntityOwnershipInterface && !prefabEditorEntityOwnershipInterface->IsRootPrefabAssigned())
|
||||
{
|
||||
action->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
QObject::connect(
|
||||
action, &QAction::triggered,
|
||||
[this]()
|
||||
{
|
||||
CreateCameraEntityFromViewport();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user