Revert "Delay propagation for all template updates in detach prefab workflow (#4707)"

This reverts commit 87533d80c1.

Signed-off-by: srikappa-amzn <srikappa@amazon.com>
monroegm-disable-blank-issue-2
srikappa-amzn 4 years ago
parent d3ff91f153
commit 1025eb3929

@ -1051,10 +1051,10 @@ namespace AzToolsFramework
DuplicateNestedEntitiesInInstance(commonOwningInstance->get(), DuplicateNestedEntitiesInInstance(commonOwningInstance->get(),
entities, instanceDomAfter, duplicatedEntityAndInstanceIds, duplicateEntityAliasMap); entities, instanceDomAfter, duplicatedEntityAndInstanceIds, duplicateEntityAliasMap);
PrefabUndoInstance* command = aznew PrefabUndoInstance("Entity/Instance duplication", false); PrefabUndoInstance* command = aznew PrefabUndoInstance("Entity/Instance duplication");
command->SetParent(undoBatch.GetUndoBatch()); command->SetParent(undoBatch.GetUndoBatch());
command->Capture(instanceDomBefore, instanceDomAfter, commonOwningInstance->get().GetTemplateId()); command->Capture(instanceDomBefore, instanceDomAfter, commonOwningInstance->get().GetTemplateId());
command->Redo(); command->RedoBatched();
DuplicateNestedInstancesInInstance(commonOwningInstance->get(), DuplicateNestedInstancesInInstance(commonOwningInstance->get(),
instances, instanceDomAfter, duplicatedEntityAndInstanceIds, newInstanceAliasToOldInstanceMap); instances, instanceDomAfter, duplicatedEntityAndInstanceIds, newInstanceAliasToOldInstanceMap);
@ -1322,7 +1322,7 @@ namespace AzToolsFramework
Prefab::PrefabDom instanceDomAfter; Prefab::PrefabDom instanceDomAfter;
m_instanceToTemplateInterface->GenerateDomForInstance(instanceDomAfter, parentInstance); m_instanceToTemplateInterface->GenerateDomForInstance(instanceDomAfter, parentInstance);
PrefabUndoInstance* command = aznew PrefabUndoInstance("Instance detachment", false); PrefabUndoInstance* command = aznew PrefabUndoInstance("Instance detachment");
command->Capture(instanceDomBefore, instanceDomAfter, parentTemplateId); command->Capture(instanceDomBefore, instanceDomAfter, parentTemplateId);
command->SetParent(undoBatch.GetUndoBatch()); command->SetParent(undoBatch.GetUndoBatch());
{ {

@ -17,16 +17,17 @@ namespace AzToolsFramework
{ {
PrefabUndoBase::PrefabUndoBase(const AZStd::string& undoOperationName) PrefabUndoBase::PrefabUndoBase(const AZStd::string& undoOperationName)
: UndoSystem::URSequencePoint(undoOperationName) : UndoSystem::URSequencePoint(undoOperationName)
, m_changed(true)
, m_templateId(InvalidTemplateId)
{ {
m_instanceToTemplateInterface = AZ::Interface<InstanceToTemplateInterface>::Get(); m_instanceToTemplateInterface = AZ::Interface<InstanceToTemplateInterface>::Get();
AZ_Assert(m_instanceToTemplateInterface, "Failed to grab instance to template interface"); AZ_Assert(m_instanceToTemplateInterface, "Failed to grab instance to template interface");
} }
//PrefabInstanceUndo //PrefabInstanceUndo
PrefabUndoInstance::PrefabUndoInstance(const AZStd::string& undoOperationName, bool useImmediatePropagation) PrefabUndoInstance::PrefabUndoInstance(const AZStd::string& undoOperationName)
: PrefabUndoBase(undoOperationName) : PrefabUndoBase(undoOperationName)
{ {
m_useImmediatePropagation = useImmediatePropagation;
} }
void PrefabUndoInstance::Capture( void PrefabUndoInstance::Capture(
@ -42,12 +43,17 @@ namespace AzToolsFramework
void PrefabUndoInstance::Undo() void PrefabUndoInstance::Undo()
{ {
m_instanceToTemplateInterface->PatchTemplate(m_undoPatch, m_templateId, m_useImmediatePropagation); m_instanceToTemplateInterface->PatchTemplate(m_undoPatch, m_templateId, true);
} }
void PrefabUndoInstance::Redo() void PrefabUndoInstance::Redo()
{ {
m_instanceToTemplateInterface->PatchTemplate(m_redoPatch, m_templateId, m_useImmediatePropagation); m_instanceToTemplateInterface->PatchTemplate(m_redoPatch, m_templateId, true);
}
void PrefabUndoInstance::RedoBatched()
{
m_instanceToTemplateInterface->PatchTemplate(m_redoPatch, m_templateId);
} }

@ -29,15 +29,14 @@ namespace AzToolsFramework
bool Changed() const override { return m_changed; } bool Changed() const override { return m_changed; }
protected: protected:
TemplateId m_templateId = InvalidTemplateId; TemplateId m_templateId;
PrefabDom m_redoPatch; PrefabDom m_redoPatch;
PrefabDom m_undoPatch; PrefabDom m_undoPatch;
InstanceToTemplateInterface* m_instanceToTemplateInterface = nullptr; InstanceToTemplateInterface* m_instanceToTemplateInterface = nullptr;
bool m_changed = true; bool m_changed;
bool m_useImmediatePropagation = true;
}; };
//! handles the addition and removal of entities from instances //! handles the addition and removal of entities from instances
@ -45,7 +44,7 @@ namespace AzToolsFramework
: public PrefabUndoBase : public PrefabUndoBase
{ {
public: public:
explicit PrefabUndoInstance(const AZStd::string& undoOperationName, bool useImmediatePropagation = true); explicit PrefabUndoInstance(const AZStd::string& undoOperationName);
void Capture( void Capture(
const PrefabDom& initialState, const PrefabDom& initialState,
@ -54,6 +53,7 @@ namespace AzToolsFramework
void Undo() override; void Undo() override;
void Redo() override; void Redo() override;
void RedoBatched();
}; };
//! handles entity updates, such as when the values on an entity change //! handles entity updates, such as when the values on an entity change

@ -23,10 +23,10 @@ namespace AzToolsFramework
PrefabDom instanceDomAfterUpdate; PrefabDom instanceDomAfterUpdate;
PrefabDomUtils::StoreInstanceInPrefabDom(instance, instanceDomAfterUpdate); PrefabDomUtils::StoreInstanceInPrefabDom(instance, instanceDomAfterUpdate);
PrefabUndoInstance* state = aznew Prefab::PrefabUndoInstance(undoMessage, false); PrefabUndoInstance* state = aznew Prefab::PrefabUndoInstance(undoMessage);
state->Capture(instanceDomBeforeUpdate, instanceDomAfterUpdate, instance.GetTemplateId()); state->Capture(instanceDomBeforeUpdate, instanceDomAfterUpdate, instance.GetTemplateId());
state->SetParent(undoBatch); state->SetParent(undoBatch);
state->Redo(); state->RedoBatched();
} }
LinkId CreateLink( LinkId CreateLink(

Loading…
Cancel
Save