80f62d0523
* Add instanceToIgnore to calls leading to instances being added to the queue for propagation. * Change PrefabUndoEntityUpdate to make it so that the instance triggering the prefab template change is not reloaded on propagation, since it will already be up to date due to the way we generated the patch to begin with. * Add FindPrefabDomValue utility function for paths * Expose the level root prefab template id in the Prefab EOS Interface * Fix Instance Alias Path generation to work with the new FindValueInPrefabDom function * Stop reloading ancestors on propagation, and fix instance reloading so that the level dom is used (and overrides are preserved) * Remove commented out code, refactor FindPrefabDomValue for paths (was handling an edge case incorrectly, and it's not even triggered) * Fix issue with PathView reference - with PathView already being a reference, this resulted in a copy and triggered a warning during automated review builds. * Additional fix to the build warning, remove redundant error message * Revert changes to Instance::GetAbsoluteInstanceAliasPath(), as they were impacting serialization. * Remove the dependency to the level root prefab template in the propagation code, climb up the hierarchy instead. This allows tests to work despite not using the EOS properly. Also use PrefabDomPaths to retrieve the instance dom from the root dom instead of iterating. * Remove now unused PrefabDomUtils function, extend optimization to link updates. * Trigger a full instance propagation to correctly refresh alias references. This is an issue in the test because some operations are called from the backend API and will not trigger propagation properly. Tests will soon be rewritten to more properly represent frontend workflows. * Fixes lingering issues with propagation: - Restores code that fixes the selection if entityIds have changed; - Fixes Do() function on link update. Prefab containers will propagate correctly while still being stable during editing. * Remove GetRootPrefabInstanceTemplateId (no longer necessary after the code has been rewritten) * Fix optimization code to account for instances being removed and propagation being run out of order in Create Prefab undo. * Renamed variable, added comments for clarity. * Restore asserts on instance not being found; Rename Do to Redo for clarity; Add comments. * Fixed incomplete comment.
72 lines
3.2 KiB
C++
72 lines
3.2 KiB
C++
/*
|
|
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
|
* its licensors.
|
|
*
|
|
* For complete copyright and license terms please see the LICENSE at the root of this
|
|
* distribution (the "License"). All use of this software is governed by the License,
|
|
* or, if provided, by the license below or the license accompanying this file. Do not
|
|
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AzCore/Interface/Interface.h>
|
|
#include <AzToolsFramework/Prefab/Instance/Instance.h>
|
|
#include <AzToolsFramework/Prefab/Link/Link.h>
|
|
#include <AzToolsFramework/Prefab/PrefabIdTypes.h>
|
|
#include <AzToolsFramework/Prefab/Template/Template.h>
|
|
#include <AzCore/std/smart_ptr/unique_ptr.h>
|
|
|
|
namespace AzToolsFramework
|
|
{
|
|
namespace Prefab
|
|
{
|
|
/*!
|
|
* PrefabSystemComponentInterface
|
|
* Interface serviced by the Prefab System Component.
|
|
*/
|
|
class PrefabSystemComponentInterface
|
|
{
|
|
public:
|
|
AZ_RTTI(PrefabSystemComponentInterface, "{8E95A029-67F9-4F74-895F-DDBFE29516A0}");
|
|
|
|
virtual TemplateReference FindTemplate(const TemplateId& id) = 0;
|
|
virtual LinkReference FindLink(const LinkId& id) = 0;
|
|
|
|
virtual TemplateId AddTemplate(const AZ::IO::Path& filePath, PrefabDom prefabDom) = 0;
|
|
virtual void RemoveTemplate(const TemplateId& templateId) = 0;
|
|
virtual void RemoveAllTemplates() = 0;
|
|
|
|
virtual LinkId AddLink(const TemplateId& sourceTemplateId, const TemplateId& targetTemplateId,
|
|
PrefabDomValue::MemberIterator& instanceIterator, InstanceOptionalReference instance) = 0;
|
|
|
|
//creates a new Link
|
|
virtual LinkId CreateLink(
|
|
const TemplateId& linkTargetId, const TemplateId& linkSourceId, const InstanceAlias& instanceAlias,
|
|
const PrefabDomConstReference linkPatches, const LinkId& linkId = InvalidLinkId) = 0;
|
|
|
|
virtual void RemoveLink(const LinkId& linkId) = 0;
|
|
|
|
virtual TemplateId GetTemplateIdFromFilePath(AZ::IO::PathView filePath) const = 0;
|
|
|
|
virtual bool IsTemplateDirty(const TemplateId& templateId) = 0;
|
|
virtual void SetTemplateDirtyFlag(const TemplateId& templateId, bool dirty) = 0;
|
|
|
|
virtual PrefabDom& FindTemplateDom(TemplateId templateId) = 0;
|
|
virtual void UpdatePrefabTemplate(TemplateId templateId, const PrefabDom& updatedDom) = 0;
|
|
virtual void PropagateTemplateChanges(TemplateId templateId, InstanceOptionalReference instanceToExclude = AZStd::nullopt) = 0;
|
|
|
|
virtual AZStd::unique_ptr<Instance> InstantiatePrefab(AZ::IO::PathView filePath) = 0;
|
|
virtual AZStd::unique_ptr<Instance> InstantiatePrefab(const TemplateId& templateId) = 0;
|
|
virtual AZStd::unique_ptr<Instance> CreatePrefab(const AZStd::vector<AZ::Entity*>& entities,
|
|
AZStd::vector<AZStd::unique_ptr<Instance>>&& instancesToConsume, AZ::IO::PathView filePath,
|
|
AZStd::unique_ptr<AZ::Entity> containerEntity = nullptr, bool ShouldCreateLinks = true) = 0;
|
|
};
|
|
|
|
|
|
} // namespace Prefab
|
|
} // namespace AzToolsFramework
|
|
|