Integrating up through commit 90f050496
This commit is contained in:
@@ -152,7 +152,10 @@ ComponentEntityEditorPlugin::ComponentEntityEditorPlugin([[maybe_unused]] IEdito
|
||||
LyViewPane::CategoryTools,
|
||||
levelInspectorOptions);
|
||||
|
||||
if (GetIEditor()->IsPrefabSystemEnabled())
|
||||
bool prefabSystemEnabled = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(prefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
|
||||
if (prefabSystemEnabled)
|
||||
{
|
||||
// Add the new Outliner to the Tools Menu
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <AzToolsFramework/ToolsComponents/GenericComponentWrapper.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorSelectionAccentSystemComponent.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorEntityIconComponentBus.h>
|
||||
#include <AzToolsFramework/Undo/UndoCacheInterface.h>
|
||||
#include <LmbrCentral/Rendering/RenderNodeBus.h>
|
||||
#include <LmbrCentral/Rendering/MeshComponentBus.h>
|
||||
#include <LmbrCentral/Rendering/MaterialOwnerBus.h>
|
||||
@@ -96,12 +97,10 @@ void CComponentEntityObject::UpdatePreemptiveUndoCache()
|
||||
{
|
||||
using namespace AzToolsFramework;
|
||||
|
||||
PreemptiveUndoCache* preemptiveUndoCache = nullptr;
|
||||
ToolsApplicationRequests::Bus::BroadcastResult(preemptiveUndoCache, &ToolsApplicationRequests::GetUndoCache);
|
||||
|
||||
if (preemptiveUndoCache)
|
||||
auto undoCacheInterface = AZ::Interface<UndoSystem::UndoCacheInterface>::Get();
|
||||
if (undoCacheInterface)
|
||||
{
|
||||
preemptiveUndoCache->UpdateCache(m_entityId);
|
||||
undoCacheInterface->UpdateCache(m_entityId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#include <AzToolsFramework/Undo/UndoSystem.h>
|
||||
#include <AzToolsFramework/UI/EditorEntityUi/EditorEntityUiInterface.h>
|
||||
#include <AzToolsFramework/UI/Layer/AddToLayerMenu.h>
|
||||
#include <AzToolsFramework/UI/Prefab/PrefabIntegrationInterface.h>
|
||||
#include <AzToolsFramework/UI/PropertyEditor/InstanceDataHierarchy.h>
|
||||
#include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
|
||||
#include <AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.hxx>
|
||||
@@ -199,6 +200,12 @@ void SandboxIntegrationManager::Setup()
|
||||
AZ_Assert((m_editorEntityUiInterface != nullptr),
|
||||
"SandboxIntegrationManager requires a EditorEntityUiInterface instance to be present on Setup().");
|
||||
|
||||
m_prefabIntegrationInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabIntegrationInterface>::Get();
|
||||
|
||||
AZ_Assert(
|
||||
(m_prefabIntegrationInterface != nullptr),
|
||||
"SandboxIntegrationManager requires a PrefabIntegrationInterface instance to be present on Setup().");
|
||||
|
||||
AzToolsFramework::Layers::EditorLayerComponentNotificationBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
@@ -259,10 +266,11 @@ void SandboxIntegrationManager::SaveSlice(const bool& QuickPushToFirstLevel)
|
||||
// This event handler is queued on main thread.
|
||||
void SandboxIntegrationManager::OnCatalogAssetAdded(const AZ::Data::AssetId& assetId)
|
||||
{
|
||||
bool isLegacySliceSystemEnabled = true;
|
||||
AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(
|
||||
isLegacySliceSystemEnabled, &AzToolsFramework::ToolsApplicationRequests::IsLegacySliceSystemEnabled);
|
||||
if (isLegacySliceSystemEnabled)
|
||||
bool prefabSystemEnabled = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
prefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
|
||||
if (!prefabSystemEnabled)
|
||||
{
|
||||
AZ::SliceComponent* editorRootSlice = nullptr;
|
||||
AzToolsFramework::SliceEditorEntityOwnershipServiceRequestBus::BroadcastResult(
|
||||
@@ -652,18 +660,21 @@ void SandboxIntegrationManager::PopulateEditorGlobalContextMenu(QMenu* menu, con
|
||||
});
|
||||
}
|
||||
|
||||
menu->addSeparator();
|
||||
bool prefabSystemEnabled = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(prefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
|
||||
action = menu->addAction(QObject::tr("Create layer"));
|
||||
QObject::connect(action, &QAction::triggered, [this] { ContextMenu_NewLayer(); });
|
||||
|
||||
SetupLayerContextMenu(menu);
|
||||
AzToolsFramework::EntityIdSet flattenedSelection;
|
||||
GetSelectedEntitiesSetWithFlattenedHierarchy(flattenedSelection);
|
||||
AzToolsFramework::SetupAddToLayerMenu(menu, flattenedSelection, [this] { return ContextMenu_NewLayer(); });
|
||||
|
||||
if (!GetIEditor()->IsPrefabSystemEnabled())
|
||||
if (!prefabSystemEnabled)
|
||||
{
|
||||
menu->addSeparator();
|
||||
|
||||
action = menu->addAction(QObject::tr("Create layer"));
|
||||
QObject::connect(action, &QAction::triggered, [this] { ContextMenu_NewLayer(); });
|
||||
|
||||
SetupLayerContextMenu(menu);
|
||||
AzToolsFramework::EntityIdSet flattenedSelection;
|
||||
GetSelectedEntitiesSetWithFlattenedHierarchy(flattenedSelection);
|
||||
AzToolsFramework::SetupAddToLayerMenu(menu, flattenedSelection, [this] { return ContextMenu_NewLayer(); });
|
||||
|
||||
SetupSliceContextMenu(menu);
|
||||
}
|
||||
else
|
||||
@@ -674,11 +685,18 @@ void SandboxIntegrationManager::PopulateEditorGlobalContextMenu(QMenu* menu, con
|
||||
AzToolsFramework::EditorContextMenuBus::Broadcast(&AzToolsFramework::EditorContextMenuEvents::PopulateEditorGlobalContextMenu, menu);
|
||||
}
|
||||
|
||||
action = menu->addAction(QObject::tr("Duplicate"));
|
||||
QObject::connect(action, &QAction::triggered, action, [this] { ContextMenu_Duplicate(); });
|
||||
if (selected.size() == 0)
|
||||
bool prefabWipFeaturesEnabled = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
prefabWipFeaturesEnabled, &AzFramework::ApplicationRequests::ArePrefabWipFeaturesEnabled);
|
||||
|
||||
if (!prefabSystemEnabled || (prefabSystemEnabled && prefabWipFeaturesEnabled))
|
||||
{
|
||||
action->setDisabled(true);
|
||||
action = menu->addAction(QObject::tr("Duplicate"));
|
||||
QObject::connect(action, &QAction::triggered, action, [this] { ContextMenu_Duplicate(); });
|
||||
if (selected.size() == 0)
|
||||
{
|
||||
action->setDisabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
action = menu->addAction(QObject::tr("Delete"));
|
||||
@@ -1268,41 +1286,47 @@ AZ::EntityId SandboxIntegrationManager::CreateNewEntityAtPosition(const AZ::Vect
|
||||
{
|
||||
using namespace AzToolsFramework;
|
||||
|
||||
ScopedUndoBatch undo("New Entity");
|
||||
bool prefabSystemEnabled = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(prefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
|
||||
AZ::EntityId newEntityId;
|
||||
|
||||
const AZStd::string name = AZStd::string::format("Entity%d", GetIEditor()->GetObjectManager()->GetObjectCount() + 1);
|
||||
|
||||
EditorEntityContextRequestBus::BroadcastResult(newEntityId, &EditorEntityContextRequests::CreateNewEditorEntity, name.c_str());
|
||||
|
||||
if (newEntityId.IsValid())
|
||||
if (!prefabSystemEnabled)
|
||||
{
|
||||
m_unsavedEntities.insert(newEntityId);
|
||||
const AZStd::string name = AZStd::string::format("Entity%d", GetIEditor()->GetObjectManager()->GetObjectCount() + 1);
|
||||
EditorEntityContextRequestBus::BroadcastResult(newEntityId, &EditorEntityContextRequests::CreateNewEditorEntity, name.c_str());
|
||||
|
||||
AZ::Transform transform = AZ::Transform::CreateIdentity();
|
||||
transform.SetTranslation(pos);
|
||||
if (parentId.IsValid())
|
||||
if (newEntityId.IsValid())
|
||||
{
|
||||
AZ::TransformBus::Event(newEntityId, &AZ::TransformInterface::SetParent, parentId);
|
||||
AZ::TransformBus::Event(newEntityId, &AZ::TransformInterface::SetLocalTM, transform);
|
||||
m_unsavedEntities.insert(newEntityId);
|
||||
|
||||
AZ::Transform transform = AZ::Transform::CreateIdentity();
|
||||
transform.SetTranslation(pos);
|
||||
if (parentId.IsValid())
|
||||
{
|
||||
AZ::TransformBus::Event(newEntityId, &AZ::TransformInterface::SetParent, parentId);
|
||||
AZ::TransformBus::Event(newEntityId, &AZ::TransformInterface::SetLocalTM, transform);
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ::TransformBus::Event(newEntityId, &AZ::TransformInterface::SetWorldTM, transform);
|
||||
}
|
||||
|
||||
// Select the new entity (and deselect others).
|
||||
AzToolsFramework::EntityIdList selection = {newEntityId};
|
||||
|
||||
ScopedUndoBatch undo("New Entity");
|
||||
auto selectionCommand = AZStd::make_unique<AzToolsFramework::SelectionCommand>(selection, "");
|
||||
selectionCommand->SetParent(undo.GetUndoBatch());
|
||||
selectionCommand.release();
|
||||
|
||||
EBUS_EVENT(AzToolsFramework::ToolsApplicationRequests::Bus, SetSelectedEntities, selection);
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ::TransformBus::Event(newEntityId, &AZ::TransformInterface::SetWorldTM, transform);
|
||||
}
|
||||
|
||||
// Select the new entity (and deselect others).
|
||||
AzToolsFramework::EntityIdList selection = { newEntityId };
|
||||
|
||||
auto selectionCommand =
|
||||
AZStd::make_unique<AzToolsFramework::SelectionCommand>(selection, "");
|
||||
selectionCommand->SetParent(undo.GetUndoBatch());
|
||||
selectionCommand.release();
|
||||
|
||||
EBUS_EVENT(AzToolsFramework::ToolsApplicationRequests::Bus, SetSelectedEntities, selection);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
newEntityId = m_prefabIntegrationInterface->CreateNewEntityAtPosition(pos, parentId);
|
||||
}
|
||||
return newEntityId;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,11 @@ namespace AzToolsFramework
|
||||
{
|
||||
class AssetSelectionModel;
|
||||
}
|
||||
|
||||
namespace Prefab
|
||||
{
|
||||
class PrefabIntegrationInterface;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -383,6 +388,7 @@ private:
|
||||
AzToolsFramework::Prefab::PrefabIntegrationManager m_prefabIntegrationManager;
|
||||
|
||||
AzToolsFramework::EditorEntityUiInterface* m_editorEntityUiInterface = nullptr;
|
||||
AzToolsFramework::Prefab::PrefabIntegrationInterface* m_prefabIntegrationInterface = nullptr;
|
||||
|
||||
// Overrides UI styling and behavior for Layer Entities
|
||||
AzToolsFramework::LayerUiHandler m_layerUiOverrideHandler;
|
||||
|
||||
@@ -55,8 +55,6 @@ namespace ProjectSettingsTool
|
||||
->Attribute(Attributes::FuncValidator, ConvertFunctorToVoid(&Validators::FileNameOrEmpty))
|
||||
->Attribute(Attributes::PropertyIdentfier, Identfiers::ProductName)
|
||||
->Attribute(Attributes::LinkedProperty, Identfiers::ExecutableName)
|
||||
->DataElement(Handlers::QValidatedLineEdit, &BaseSettings::m_sysDllGame, "Game Dll Name", "The name of the project's dll.")
|
||||
->Attribute(Attributes::FuncValidator, ConvertFunctorToVoid(&Validators::FileNameOrEmpty))
|
||||
->DataElement(Handlers::QValidatedLineEdit, &BaseSettings::m_projectOutputFolder, "Output Folder", "The folder the packed project will be exported to.")
|
||||
->DataElement(Handlers::QValidatedLineEdit, &BaseSettings::m_codeFolder, "Code Folder (legacy)", "A legacy setting specifing the folder for this project's code.")
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user