Merge branch 'development' of https://github.com/o3de/o3de into daimini/settings-registry-origin-tracking
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/IO/SystemFile.h>
|
||||
#include <AzCore/std/containers/fixed_vector.h>
|
||||
#include <AzCore/std/parallel/thread.h>
|
||||
#include <AzCore/std/smart_ptr/shared_ptr.h>
|
||||
|
||||
|
||||
@@ -600,8 +600,8 @@ namespace AzToolsFramework
|
||||
* Open 3D Engine Internal use only.
|
||||
*
|
||||
* Run a specific redo command separate from the undo/redo system.
|
||||
* In many cases before a modifcation on an entity takes place, it is first packaged into
|
||||
* undo/redo commands. Running the modification's redo command separete from the undo/redo
|
||||
* In many cases before a modification on an entity takes place, it is first packaged into
|
||||
* undo/redo commands. Running the modification's redo command separate from the undo/redo
|
||||
* system simulates its execution, and avoids some code duplication.
|
||||
*/
|
||||
virtual void RunRedoSeparately(UndoSystem::URSequencePoint* redoCommand) = 0;
|
||||
|
||||
@@ -1781,5 +1781,4 @@ namespace AzToolsFramework
|
||||
{
|
||||
appType.m_maskValue = AZ::ApplicationTypeQuery::Masks::Tool;
|
||||
};
|
||||
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace AzToolsFramework
|
||||
m_prefabUndoCache.Destroy();
|
||||
}
|
||||
|
||||
PrefabOperationResult PrefabPublicHandler::CreatePrefab(const AZStd::vector<AZ::EntityId>& entityIds, AZ::IO::PathView absolutePath)
|
||||
PrefabOperationResult PrefabPublicHandler::CreatePrefabInMemory(const AZStd::vector<AZ::EntityId>& entityIds, AZ::IO::PathView filePath)
|
||||
{
|
||||
EntityList inputEntityList, topLevelEntities;
|
||||
AZ::EntityId commonRootEntityId;
|
||||
@@ -73,8 +73,6 @@ namespace AzToolsFramework
|
||||
return findCommonRootOutcome;
|
||||
}
|
||||
|
||||
AZ_Assert(absolutePath.IsAbsolute(), "CreatePrefab requires an absolute path for saving the initial prefab file.");
|
||||
|
||||
InstanceOptionalReference instanceToCreate;
|
||||
{
|
||||
// Initialize Undo Batch object
|
||||
@@ -125,7 +123,7 @@ namespace AzToolsFramework
|
||||
PrefabDom linkPatchesCopy;
|
||||
linkPatchesCopy.CopyFrom(linkPatches->get(), linkPatchesCopy.GetAllocator());
|
||||
nestedInstanceLinkPatchesMap.emplace(nestedInstance, AZStd::move(linkPatchesCopy));
|
||||
|
||||
|
||||
RemoveLink(outInstance, commonRootEntityOwningInstance->get().GetTemplateId(), undoBatch.GetUndoBatch());
|
||||
|
||||
instancePtrs.emplace_back(AZStd::move(outInstance));
|
||||
@@ -139,18 +137,20 @@ namespace AzToolsFramework
|
||||
if (!prefabEditorEntityOwnershipInterface)
|
||||
{
|
||||
return AZ::Failure(AZStd::string("Could not create a new prefab out of the entities provided - internal error "
|
||||
"(PrefabEditorEntityOwnershipInterface unavailable)."));
|
||||
"(PrefabEditorEntityOwnershipInterface unavailable)."));
|
||||
}
|
||||
|
||||
// Create the Prefab
|
||||
AZ_Assert(filePath.IsAbsolute(), "CreatePrefabInMemory requires an absolute file path.");
|
||||
|
||||
instanceToCreate = prefabEditorEntityOwnershipInterface->CreatePrefab(
|
||||
entities, AZStd::move(instancePtrs), m_prefabLoaderInterface->GenerateRelativePath(absolutePath),
|
||||
entities, AZStd::move(instancePtrs), m_prefabLoaderInterface->GenerateRelativePath(filePath),
|
||||
commonRootEntityOwningInstance);
|
||||
|
||||
if (!instanceToCreate)
|
||||
{
|
||||
return AZ::Failure(AZStd::string("Could not create a new prefab out of the entities provided - internal error "
|
||||
"(A null instance is returned)."));
|
||||
"(A null instance is returned)."));
|
||||
}
|
||||
|
||||
AZ::EntityId containerEntityId = instanceToCreate->get().GetContainerEntityId();
|
||||
@@ -218,7 +218,7 @@ namespace AzToolsFramework
|
||||
linkUpdate.Redo();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Create a link between the templates of the newly created instance and the instance it's being parented under.
|
||||
CreateLink(
|
||||
instanceToCreate->get(), commonRootEntityOwningInstance->get().GetTemplateId(), undoBatch.GetUndoBatch(),
|
||||
@@ -255,18 +255,35 @@ namespace AzToolsFramework
|
||||
|
||||
// Select Container Entity
|
||||
{
|
||||
auto selectionUndo = aznew SelectionCommand({containerEntityId}, "Select Prefab Container Entity");
|
||||
auto selectionUndo = aznew SelectionCommand({ containerEntityId }, "Select Prefab Container Entity");
|
||||
selectionUndo->SetParent(undoBatch.GetUndoBatch());
|
||||
ToolsApplicationRequestBus::Broadcast(&ToolsApplicationRequestBus::Events::RunRedoSeparately, selectionUndo);
|
||||
}
|
||||
}
|
||||
|
||||
// Save Template to file
|
||||
m_prefabLoaderInterface->SaveTemplateToFile(instanceToCreate->get().GetTemplateId(), absolutePath);
|
||||
|
||||
return AZ::Success();
|
||||
}
|
||||
|
||||
PrefabOperationResult PrefabPublicHandler::CreatePrefabInDisk(const AZStd::vector<AZ::EntityId>& entityIds, AZ::IO::PathView filePath)
|
||||
{
|
||||
auto result = CreatePrefabInMemory(entityIds, filePath);
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
// Save Template to file
|
||||
auto relativePath = m_prefabLoaderInterface->GenerateRelativePath(filePath);
|
||||
Prefab::TemplateId templateId = m_prefabSystemComponentInterface->GetTemplateIdFromFilePath(relativePath);
|
||||
if (!m_prefabLoaderInterface->SaveTemplateToFile(templateId, filePath))
|
||||
{
|
||||
AZStd::string_view filePathString(filePath);
|
||||
return AZ::Failure(AZStd::string::format(
|
||||
"Could not save the newly created prefab to file path %.*s - internal error ",
|
||||
AZ_STRING_ARG(filePathString)));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
PrefabDom PrefabPublicHandler::ApplyContainerTransformAndGeneratePatch(AZ::EntityId containerEntityId, AZ::EntityId parentEntityId, const EntityList& childEntities)
|
||||
{
|
||||
AZ::Entity* containerEntity = GetEntityById(containerEntityId);
|
||||
@@ -301,7 +318,7 @@ namespace AzToolsFramework
|
||||
return AZStd::move(patch);
|
||||
}
|
||||
|
||||
PrefabOperationResult PrefabPublicHandler::InstantiatePrefab(
|
||||
InstantiatePrefabResult PrefabPublicHandler::InstantiatePrefab(
|
||||
AZStd::string_view filePath, AZ::EntityId parent, const AZ::Vector3& position)
|
||||
{
|
||||
auto prefabEditorEntityOwnershipInterface = AZ::Interface<PrefabEditorEntityOwnershipInterface>::Get();
|
||||
@@ -347,6 +364,7 @@ namespace AzToolsFramework
|
||||
relativePath.Native().c_str(), instanceToParentUnder->get().GetTemplateSourcePath().Native().c_str()));
|
||||
}
|
||||
|
||||
AZ::EntityId containerEntityId;
|
||||
{
|
||||
// Initialize Undo Batch object
|
||||
ScopedUndoBatch undoBatch("Instantiate Prefab");
|
||||
@@ -367,7 +385,7 @@ namespace AzToolsFramework
|
||||
instanceToParentUnder->get(), "Update prefab instance", instanceToParentUnderDomBeforeCreate, undoBatch.GetUndoBatch());
|
||||
|
||||
// Create Link with correct container patches
|
||||
AZ::EntityId containerEntityId = instanceToCreate->get().GetContainerEntityId();
|
||||
containerEntityId = instanceToCreate->get().GetContainerEntityId();
|
||||
AZ::Entity* containerEntity = GetEntityById(containerEntityId);
|
||||
AZ_Assert(containerEntity, "Invalid container entity detected in InstantiatePrefab.");
|
||||
|
||||
@@ -394,7 +412,7 @@ namespace AzToolsFramework
|
||||
&AzToolsFramework::ToolsApplicationRequestBus::Events::ClearDirtyEntities);
|
||||
}
|
||||
|
||||
return AZ::Success();
|
||||
return AZ::Success(containerEntityId);
|
||||
}
|
||||
|
||||
PrefabOperationResult PrefabPublicHandler::FindCommonRootOwningInstance(
|
||||
|
||||
@@ -42,8 +42,11 @@ namespace AzToolsFramework
|
||||
void UnregisterPrefabPublicHandlerInterface();
|
||||
|
||||
// PrefabPublicInterface...
|
||||
PrefabOperationResult CreatePrefab(const AZStd::vector<AZ::EntityId>& entityIds, AZ::IO::PathView absolutePath) override;
|
||||
PrefabOperationResult InstantiatePrefab(AZStd::string_view filePath, AZ::EntityId parent, const AZ::Vector3& position) override;
|
||||
PrefabOperationResult CreatePrefabInDisk(
|
||||
const AZStd::vector<AZ::EntityId>& entityIds, AZ::IO::PathView filePath) override;
|
||||
PrefabOperationResult CreatePrefabInMemory(
|
||||
const AZStd::vector<AZ::EntityId>& entityIds, AZ::IO::PathView filePath) override;
|
||||
InstantiatePrefabResult InstantiatePrefab(AZStd::string_view filePath, AZ::EntityId parent, const AZ::Vector3& position) override;
|
||||
PrefabOperationResult SavePrefab(AZ::IO::Path filePath) override;
|
||||
PrefabEntityResult CreateEntity(AZ::EntityId parentId, const AZ::Vector3& position) override;
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace AzToolsFramework
|
||||
namespace Prefab
|
||||
{
|
||||
typedef AZ::Outcome<void, AZStd::string> PrefabOperationResult;
|
||||
typedef AZ::Outcome<AZ::EntityId, AZStd::string> InstantiatePrefabResult;
|
||||
typedef AZ::Outcome<bool, AZStd::string> PrefabRequestResult;
|
||||
typedef AZ::Outcome<AZ::EntityId, AZStd::string> PrefabEntityResult;
|
||||
|
||||
@@ -39,22 +40,34 @@ namespace AzToolsFramework
|
||||
AZ_RTTI(PrefabPublicInterface, "{931AAE9D-C775-4818-9070-A2DA69489CBE}");
|
||||
|
||||
/**
|
||||
* Create a prefab out of the entities provided, at the path provided.
|
||||
* Create a prefab out of the entities provided, at the path provided, and save it in disk immediately.
|
||||
* Automatically detects descendants of entities, and discerns between entities and child instances.
|
||||
* @param entityIds The entities that should form the new prefab (along with their descendants).
|
||||
* @param filePath The absolute path for the new prefab file.
|
||||
* @return An outcome object; on failure, it comes with an error message detailing the cause of the error.
|
||||
*/
|
||||
virtual PrefabOperationResult CreatePrefab(const AZStd::vector<AZ::EntityId>& entityIds, AZ::IO::PathView absolutePath) = 0;
|
||||
virtual PrefabOperationResult CreatePrefabInDisk(
|
||||
const AZStd::vector<AZ::EntityId>& entityIds, AZ::IO::PathView filePath) = 0;
|
||||
|
||||
/**
|
||||
* Create a prefab out of the entities provided, at the path provided, and keep it in memory.
|
||||
* Automatically detects descendants of entities, and discerns between entities and child instances.
|
||||
* @param entityIds The entities that should form the new prefab (along with their descendants).
|
||||
* @param filePath The absolute path for the new prefab file.
|
||||
* @return An outcome object; on failure, it comes with an error message detailing the cause of the error.
|
||||
*/
|
||||
virtual PrefabOperationResult CreatePrefabInMemory(
|
||||
const AZStd::vector<AZ::EntityId>& entityIds, AZ::IO::PathView filePath) = 0;
|
||||
|
||||
/**
|
||||
* Instantiate a prefab from a prefab file.
|
||||
* @param filePath The path to the prefab file to instantiate.
|
||||
* @param parent The entity the prefab should be a child of in the transform hierarchy.
|
||||
* @param position The position in world space the prefab should be instantiated in.
|
||||
* @return An outcome object; on failure, it comes with an error message detailing the cause of the error.
|
||||
* @return An outcome object with an entityId of the new prefab's container entity;
|
||||
* on failure, it comes with an error message detailing the cause of the error.
|
||||
*/
|
||||
virtual PrefabOperationResult InstantiatePrefab(AZStd::string_view filePath, AZ::EntityId parent, const AZ::Vector3& position) = 0;
|
||||
virtual InstantiatePrefabResult InstantiatePrefab(AZStd::string_view filePath, AZ::EntityId parent, const AZ::Vector3& position) = 0;
|
||||
|
||||
/**
|
||||
* Saves changes to prefab to disk.
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Component/EntityId.h>
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/std/string/string_view.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace Prefab
|
||||
{
|
||||
/**
|
||||
* The primary purpose of this bus is to facilitate writing automated tests for prefabs.
|
||||
* It calls PrefabPublicInterface internally to talk to the prefab system.
|
||||
* If you would like to integrate prefabs into your system, please call PrefabPublicInterface
|
||||
* directly for better performance.
|
||||
*/
|
||||
class PrefabPublicRequests
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
using Bus = AZ::EBus<PrefabPublicRequests>;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual ~PrefabPublicRequests() = default;
|
||||
|
||||
/**
|
||||
* Create a prefab out of the entities provided, at the path provided, and keep it in memory.
|
||||
* Automatically detects descendants of entities, and discerns between entities and child instances.
|
||||
*/
|
||||
virtual bool CreatePrefabInMemory(
|
||||
const AZStd::vector<AZ::EntityId>& entityIds, AZStd::string_view filePath) = 0;
|
||||
|
||||
/**
|
||||
* Instantiate a prefab from a prefab file.
|
||||
*/
|
||||
virtual AZ::EntityId InstantiatePrefab(AZStd::string_view filePath, AZ::EntityId parent, const AZ::Vector3& position) = 0;
|
||||
};
|
||||
|
||||
using PrefabPublicRequestBus = AZ::EBus<PrefabPublicRequests>;
|
||||
|
||||
} // namespace Prefab
|
||||
} // namespace AzToolsFramework
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzToolsFramework/Prefab/PrefabPublicRequestHandler.h>
|
||||
|
||||
#include <AzToolsFramework/Prefab/PrefabPublicInterface.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace Prefab
|
||||
{
|
||||
void PrefabPublicRequestHandler::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context);
|
||||
if (behaviorContext)
|
||||
{
|
||||
behaviorContext->EBus<PrefabPublicRequestBus>("PrefabPublicRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation)
|
||||
->Attribute(AZ::Script::Attributes::Category, "Prefab")
|
||||
->Attribute(AZ::Script::Attributes::Module, "prefab")
|
||||
->Event("CreatePrefabInMemory", &PrefabPublicRequests::CreatePrefabInMemory)
|
||||
->Event("InstantiatePrefab", &PrefabPublicRequests::InstantiatePrefab)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
void PrefabPublicRequestHandler::Connect()
|
||||
{
|
||||
m_prefabPublicInterface = AZ::Interface<Prefab::PrefabPublicInterface>::Get();
|
||||
AZ_Assert(m_prefabPublicInterface, "PrefabPublicRequestHandler - Could not retrieve instance of PrefabPublicInterface");
|
||||
|
||||
PrefabPublicRequestBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
void PrefabPublicRequestHandler::Disconnect()
|
||||
{
|
||||
PrefabPublicRequestBus::Handler::BusDisconnect();
|
||||
|
||||
m_prefabPublicInterface = nullptr;
|
||||
}
|
||||
|
||||
bool PrefabPublicRequestHandler::CreatePrefabInMemory(const AZStd::vector<AZ::EntityId>& entityIds, AZStd::string_view filePath)
|
||||
{
|
||||
auto createPrefabOutcome = m_prefabPublicInterface->CreatePrefabInMemory(entityIds, filePath);
|
||||
if (!createPrefabOutcome.IsSuccess())
|
||||
{
|
||||
AZ_Error("CreatePrefabInMemory", false,
|
||||
"Failed to create Prefab on file path '%.*s'. Error message: %s.",
|
||||
AZ_STRING_ARG(filePath),
|
||||
createPrefabOutcome.GetError().c_str());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
AZ::EntityId PrefabPublicRequestHandler::InstantiatePrefab(AZStd::string_view filePath, AZ::EntityId parent, const AZ::Vector3& position)
|
||||
{
|
||||
auto instantiatePrefabOutcome = m_prefabPublicInterface->InstantiatePrefab(filePath, parent, position);
|
||||
if (!instantiatePrefabOutcome.IsSuccess())
|
||||
{
|
||||
AZ_Error("InstantiatePrefab", false,
|
||||
"Failed to instantiate Prefab on file path '%.*s'. Error message: %s.",
|
||||
AZ_STRING_ARG(filePath),
|
||||
instantiatePrefabOutcome.GetError().c_str());
|
||||
|
||||
return AZ::EntityId();
|
||||
}
|
||||
|
||||
return instantiatePrefabOutcome.GetValue();
|
||||
}
|
||||
} // namespace Prefab
|
||||
} // namespace AzToolsFramework
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
|
||||
#include <AzToolsFramework/Prefab/PrefabPublicRequestBus.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace Prefab
|
||||
{
|
||||
class PrefabPublicInterface;
|
||||
|
||||
class PrefabPublicRequestHandler final
|
||||
: public PrefabPublicRequestBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(PrefabPublicRequestHandler, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(PrefabPublicRequestHandler, "{83FBDDF9-10BE-4373-B1DC-44B47EE4805C}");
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
void Connect();
|
||||
void Disconnect();
|
||||
|
||||
bool CreatePrefabInMemory(const AZStd::vector<AZ::EntityId>& entityIds, AZStd::string_view filePath) override;
|
||||
AZ::EntityId InstantiatePrefab(AZStd::string_view filePath, AZ::EntityId parent, const AZ::Vector3& position) override;
|
||||
|
||||
private:
|
||||
PrefabPublicInterface* m_prefabPublicInterface = nullptr;
|
||||
};
|
||||
} // namespace Prefab
|
||||
} // namespace AzToolsFramework
|
||||
@@ -35,12 +35,14 @@ namespace AzToolsFramework
|
||||
m_instanceUpdateExecutor.RegisterInstanceUpdateExecutorInterface();
|
||||
m_instanceToTemplatePropagator.RegisterInstanceToTemplateInterface();
|
||||
m_prefabPublicHandler.RegisterPrefabPublicHandlerInterface();
|
||||
m_prefabPublicRequestHandler.Connect();
|
||||
AZ::SystemTickBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
void PrefabSystemComponent::Deactivate()
|
||||
{
|
||||
AZ::SystemTickBus::Handler::BusDisconnect();
|
||||
m_prefabPublicRequestHandler.Disconnect();
|
||||
m_prefabPublicHandler.UnregisterPrefabPublicHandlerInterface();
|
||||
m_instanceToTemplatePropagator.UnregisterInstanceToTemplateInterface();
|
||||
m_instanceUpdateExecutor.UnregisterInstanceUpdateExecutorInterface();
|
||||
@@ -54,6 +56,7 @@ namespace AzToolsFramework
|
||||
AzToolsFramework::Prefab::PrefabConversionUtils::PrefabConversionPipeline::Reflect(context);
|
||||
AzToolsFramework::Prefab::PrefabConversionUtils::PrefabCatchmentProcessor::Reflect(context);
|
||||
AzToolsFramework::Prefab::PrefabConversionUtils::EditorInfoRemover::Reflect(context);
|
||||
PrefabPublicRequestHandler::Reflect(context);
|
||||
|
||||
AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serialize)
|
||||
@@ -62,7 +65,6 @@ namespace AzToolsFramework
|
||||
}
|
||||
|
||||
AZ::JsonRegistrationContext* jsonRegistration = azrtti_cast<AZ::JsonRegistrationContext*>(context);
|
||||
|
||||
if (jsonRegistration)
|
||||
{
|
||||
jsonRegistration->Serializer<JsonInstanceSerializer>()->HandlesType<Instance>();
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <AzToolsFramework/Prefab/PrefabIdTypes.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabLoader.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabPublicHandler.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabPublicRequestHandler.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabSystemComponentInterface.h>
|
||||
#include <AzToolsFramework/Prefab/Template/Template.h>
|
||||
|
||||
@@ -369,6 +370,9 @@ namespace AzToolsFramework
|
||||
|
||||
// Used for updating Templates when Instances are modified
|
||||
InstanceToTemplatePropagator m_instanceToTemplatePropagator;
|
||||
|
||||
// Handler of the public Prefab requests
|
||||
PrefabPublicRequestHandler m_prefabPublicRequestHandler;
|
||||
};
|
||||
} // namespace Prefab
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
+4
-4
@@ -256,11 +256,11 @@ namespace AzToolsFramework
|
||||
|
||||
void PrefabIntegrationManager::HandleSourceFileType(AZStd::string_view sourceFilePath, AZ::EntityId parentId, AZ::Vector3 position) const
|
||||
{
|
||||
auto createPrefabOutcome = s_prefabPublicInterface->InstantiatePrefab(sourceFilePath, parentId, position);
|
||||
auto instantiatePrefabOutcome = s_prefabPublicInterface->InstantiatePrefab(sourceFilePath, parentId, position);
|
||||
|
||||
if (!createPrefabOutcome.IsSuccess())
|
||||
if (!instantiatePrefabOutcome.IsSuccess())
|
||||
{
|
||||
WarnUserOfError("Prefab Instantiation Error", createPrefabOutcome.GetError());
|
||||
WarnUserOfError("Prefab Instantiation Error", instantiatePrefabOutcome.GetError());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
auto createPrefabOutcome = s_prefabPublicInterface->CreatePrefab(selectedEntities, prefabFilePath.data());
|
||||
auto createPrefabOutcome = s_prefabPublicInterface->CreatePrefabInDisk(selectedEntities, prefabFilePath.data());
|
||||
|
||||
if (!createPrefabOutcome.IsSuccess())
|
||||
{
|
||||
|
||||
@@ -657,6 +657,9 @@ set(FILES
|
||||
Prefab/PrefabPublicHandler.cpp
|
||||
Prefab/PrefabPublicInterface.h
|
||||
Prefab/PrefabPublicNotificationBus.h
|
||||
Prefab/PrefabPublicRequestBus.h
|
||||
Prefab/PrefabPublicRequestHandler.h
|
||||
Prefab/PrefabPublicRequestHandler.cpp
|
||||
Prefab/PrefabUndo.h
|
||||
Prefab/PrefabUndo.cpp
|
||||
Prefab/PrefabUndoCache.cpp
|
||||
|
||||
@@ -1527,7 +1527,7 @@ namespace GridMate
|
||||
if (0 != WSAIoctl( m_socket, SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER, &functionTableId,
|
||||
sizeof(GUID), (void**)&m_RIO_FN_TABLE, sizeof(m_RIO_FN_TABLE), &dwBytes, 0, 0))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not initialize RIO: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not initialize RIO: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
else
|
||||
@@ -1542,13 +1542,13 @@ namespace GridMate
|
||||
|
||||
if ((m_events[WakeupOnSend] = WSACreateEvent()) == WSA_INVALID_EVENT)
|
||||
{
|
||||
AZ_Error("GridMate", false, "Failed WSACreateEvent(): %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Failed WSACreateEvent(): %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
if ((m_events[ReceiveEvent] = WSACreateEvent()) == WSA_INVALID_EVENT)
|
||||
{
|
||||
AZ_Error("GridMate", false, "Failed WSACreateEvent(): %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Failed WSACreateEvent(): %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
RIO_NOTIFICATION_COMPLETION typeRecv;
|
||||
@@ -1558,13 +1558,13 @@ namespace GridMate
|
||||
m_RIORecvQueue = m_RIO_FN_TABLE.RIOCreateCompletionQueue(maxOutstandingReceive, &typeRecv);
|
||||
if (m_RIORecvQueue == RIO_INVALID_CQ)
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not RIOCreateCompletionQueue: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not RIOCreateCompletionQueue: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
if ((m_events[SendEvent] = WSACreateEvent()) == WSA_INVALID_EVENT)
|
||||
{
|
||||
AZ_Error("GridMate", false, "Failed WSACreateEvent(): %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Failed WSACreateEvent(): %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
RIO_NOTIFICATION_COMPLETION typeSend;
|
||||
@@ -1574,7 +1574,7 @@ namespace GridMate
|
||||
m_RIOSendQueue = m_RIO_FN_TABLE.RIOCreateCompletionQueue(maxOutstandingSend, &typeSend);
|
||||
if (m_RIOSendQueue == RIO_INVALID_CQ)
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not RIOCreateCompletionQueue: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not RIOCreateCompletionQueue: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
@@ -1582,7 +1582,7 @@ namespace GridMate
|
||||
maxReceiveDataBuffers, maxOutstandingSend, maxSendDataBuffers, m_RIORecvQueue, m_RIOSendQueue, pContext);
|
||||
if (m_requestQueue == RIO_INVALID_RQ)
|
||||
{
|
||||
AZ_Error("GridMate", m_requestQueue != NULL, "Could not RIOCreateRequestQueue: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", m_requestQueue != NULL, "Could not RIOCreateRequestQueue: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
@@ -1595,24 +1595,24 @@ namespace GridMate
|
||||
//Setup Recv raw buffer and RIO record
|
||||
if (nullptr == (m_rawRecvBuffer = AllocRIOBuffer(bufferSize, m_RIORecvBufferCount, &recvAllocated)))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not allocate buffer: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not allocate buffer: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
if (RIO_INVALID_BUFFERID == (recvBufferId = m_RIO_FN_TABLE.RIORegisterBuffer(m_rawRecvBuffer, bufferSize * m_RIORecvBufferCount)))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not register buffer: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not register buffer: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
//Setup Recv address raw buffer and RIO record
|
||||
if (nullptr == (m_rawRecvAddressBuffer = AllocRIOBuffer(sizeof(SOCKADDR_INET), m_RIORecvBufferCount, &recvAddrsAllocated)))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not allocate buffer: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not allocate buffer: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
if (RIO_INVALID_BUFFERID == (recvAddressBufferId = m_RIO_FN_TABLE.RIORegisterBuffer(m_rawRecvAddressBuffer, sizeof(SOCKADDR_INET) * m_RIORecvBufferCount)))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not register buffer: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not register buffer: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
@@ -1639,7 +1639,7 @@ namespace GridMate
|
||||
//Start Receive Handler
|
||||
if (false == m_RIO_FN_TABLE.RIOReceiveEx(m_requestQueue, &m_RIORecvBuffer[i], 1, NULL, &m_RIORecvAddressBuffer[i], NULL, NULL, 0, pBuffer))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not RIOReceive: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not RIOReceive: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
}
|
||||
@@ -1649,25 +1649,25 @@ namespace GridMate
|
||||
//setup send raw buffer and RIO record
|
||||
if (nullptr == (m_rawSendBuffer = AllocRIOBuffer(bufferSize, m_RIOSendBufferCount, &sendAllocated)))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not allocate buffer: %u", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not allocate buffer: %u", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
if (RIO_INVALID_BUFFERID == (sendBufferId = m_RIO_FN_TABLE.RIORegisterBuffer(m_rawSendBuffer, m_RIOSendBufferCount * bufferSize)))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not register buffer: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not register buffer: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
//setup send address raw buffer and RIO record
|
||||
if (nullptr == (m_rawSendAddressBuffer = AllocRIOBuffer(sizeof(SOCKADDR_INET), m_RIOSendBufferCount, &sendAddrsAllocated)))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not allocate send address buffer: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not allocate send address buffer: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
if (RIO_INVALID_BUFFERID == (sendAddressBufferId = m_RIO_FN_TABLE.RIORegisterBuffer(m_rawSendAddressBuffer, m_RIOSendBufferCount * sizeof(SOCKADDR_INET))))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not register buffer: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not register buffer: %u\n", GridMate::Platform::GetSocketError());
|
||||
return EC_SOCKET_CREATE;
|
||||
}
|
||||
|
||||
@@ -1725,7 +1725,7 @@ namespace GridMate
|
||||
if (!m_RIO_FN_TABLE.RIOSendEx(m_requestQueue, &m_RIOSendBuffer[m_workerNextSendBuffer],
|
||||
bufferCount, NULL, &m_RIOSendAddressBuffer[m_workerNextSendBuffer], NULL, NULL, 0, 0))
|
||||
{
|
||||
const DWORD lastError = ::WSAGetLastError();
|
||||
const DWORD lastError = GridMate::Platform::GetSocketError();
|
||||
if (lastError == WSAENOBUFS)
|
||||
{
|
||||
continue; //spin until free
|
||||
@@ -1835,7 +1835,7 @@ namespace GridMate
|
||||
if (false == m_RIO_FN_TABLE.RIOReceiveEx(m_requestQueue, &m_RIORecvBuffer[m_RIONextRecvBuffer],
|
||||
bufferCount, NULL, &m_RIORecvAddressBuffer[m_RIONextRecvBuffer], NULL, NULL, 0, 0))
|
||||
{
|
||||
AZ_Error("GridMate", false, "Could not RIOReceive: %u\n", ::WSAGetLastError());
|
||||
AZ_Error("GridMate", false, "Could not RIOReceive: %u\n", GridMate::Platform::GetSocketError());
|
||||
}
|
||||
|
||||
if (recvd)
|
||||
@@ -1866,7 +1866,7 @@ namespace GridMate
|
||||
{
|
||||
if (!WSAResetEvent(m_events[Index - WSA_WAIT_EVENT_0]))
|
||||
{
|
||||
AZ_Assert(false, "WSAResetEvent failed with error = %d\n", ::WSAGetLastError());
|
||||
AZ_Assert(false, "WSAResetEvent failed with error = %d\n", GridMate::Platform::GetSocketError());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1925,7 +1925,7 @@ namespace GridMate
|
||||
}
|
||||
else if (isFailed(Index))
|
||||
{
|
||||
AZ_Assert(false, "WSAWaitForMultipleEvents failed with error = %d\n", ::WSAGetLastError());
|
||||
AZ_Assert(false, "WSAWaitForMultipleEvents failed with error = %d\n", GridMate::Platform::GetSocketError());
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -1944,7 +1944,7 @@ namespace GridMate
|
||||
{
|
||||
if (!SetEvent(m_events[WakeupOnSend])) //Wake thread
|
||||
{
|
||||
AZ_Assert(false, "SetEvent failed with error = %d\n", ::WSAGetLastError());
|
||||
AZ_Assert(false, "SetEvent failed with error = %d\n", GridMate::Platform::GetSocketError());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user