|
|
|
|
@ -17,16 +17,17 @@ namespace AzToolsFramework
|
|
|
|
|
{
|
|
|
|
|
PrefabUndoBase::PrefabUndoBase(const AZStd::string& undoOperationName)
|
|
|
|
|
: UndoSystem::URSequencePoint(undoOperationName)
|
|
|
|
|
, m_changed(true)
|
|
|
|
|
, m_templateId(InvalidTemplateId)
|
|
|
|
|
{
|
|
|
|
|
m_instanceToTemplateInterface = AZ::Interface<InstanceToTemplateInterface>::Get();
|
|
|
|
|
AZ_Assert(m_instanceToTemplateInterface, "Failed to grab instance to template interface");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//PrefabInstanceUndo
|
|
|
|
|
PrefabUndoInstance::PrefabUndoInstance(const AZStd::string& undoOperationName, bool useImmediatePropagation)
|
|
|
|
|
PrefabUndoInstance::PrefabUndoInstance(const AZStd::string& undoOperationName)
|
|
|
|
|
: PrefabUndoBase(undoOperationName)
|
|
|
|
|
{
|
|
|
|
|
m_useImmediatePropagation = useImmediatePropagation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PrefabUndoInstance::Capture(
|
|
|
|
|
@ -42,12 +43,12 @@ namespace AzToolsFramework
|
|
|
|
|
|
|
|
|
|
void PrefabUndoInstance::Undo()
|
|
|
|
|
{
|
|
|
|
|
m_instanceToTemplateInterface->PatchTemplate(m_undoPatch, m_templateId, m_useImmediatePropagation);
|
|
|
|
|
m_instanceToTemplateInterface->PatchTemplate(m_undoPatch, m_templateId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PrefabUndoInstance::Redo()
|
|
|
|
|
{
|
|
|
|
|
m_instanceToTemplateInterface->PatchTemplate(m_redoPatch, m_templateId, m_useImmediatePropagation);
|
|
|
|
|
m_instanceToTemplateInterface->PatchTemplate(m_redoPatch, m_templateId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -90,7 +91,7 @@ namespace AzToolsFramework
|
|
|
|
|
void PrefabUndoEntityUpdate::Undo()
|
|
|
|
|
{
|
|
|
|
|
[[maybe_unused]] bool isPatchApplicationSuccessful =
|
|
|
|
|
m_instanceToTemplateInterface->PatchTemplate(m_undoPatch, m_templateId, true);
|
|
|
|
|
m_instanceToTemplateInterface->PatchTemplate(m_undoPatch, m_templateId);
|
|
|
|
|
|
|
|
|
|
AZ_Error(
|
|
|
|
|
"Prefab", isPatchApplicationSuccessful,
|
|
|
|
|
@ -101,7 +102,7 @@ namespace AzToolsFramework
|
|
|
|
|
void PrefabUndoEntityUpdate::Redo()
|
|
|
|
|
{
|
|
|
|
|
[[maybe_unused]] bool isPatchApplicationSuccessful =
|
|
|
|
|
m_instanceToTemplateInterface->PatchTemplate(m_redoPatch, m_templateId, true);
|
|
|
|
|
m_instanceToTemplateInterface->PatchTemplate(m_redoPatch, m_templateId);
|
|
|
|
|
|
|
|
|
|
AZ_Error(
|
|
|
|
|
"Prefab", isPatchApplicationSuccessful,
|
|
|
|
|
@ -112,7 +113,7 @@ namespace AzToolsFramework
|
|
|
|
|
void PrefabUndoEntityUpdate::Redo(InstanceOptionalReference instanceToExclude)
|
|
|
|
|
{
|
|
|
|
|
[[maybe_unused]] bool isPatchApplicationSuccessful =
|
|
|
|
|
m_instanceToTemplateInterface->PatchTemplate(m_redoPatch, m_templateId, false, instanceToExclude);
|
|
|
|
|
m_instanceToTemplateInterface->PatchTemplate(m_redoPatch, m_templateId, instanceToExclude);
|
|
|
|
|
|
|
|
|
|
AZ_Error(
|
|
|
|
|
"Prefab", isPatchApplicationSuccessful,
|
|
|
|
|
@ -328,7 +329,7 @@ namespace AzToolsFramework
|
|
|
|
|
|
|
|
|
|
//propagate the link changes
|
|
|
|
|
link->get().UpdateTarget();
|
|
|
|
|
m_prefabSystemComponentInterface->PropagateTemplateChanges(link->get().GetTargetTemplateId(), false, instanceToExclude);
|
|
|
|
|
m_prefabSystemComponentInterface->PropagateTemplateChanges(link->get().GetTargetTemplateId(), instanceToExclude);
|
|
|
|
|
|
|
|
|
|
//mark as dirty
|
|
|
|
|
m_prefabSystemComponentInterface->SetTemplateDirtyFlag(link->get().GetTargetTemplateId(), true);
|
|
|
|
|
|