|
@@ -152,7 +152,8 @@ namespace AzToolsFramework
|
|
|
PrefabDom commonRootEntityDomBeforeDetaching;
|
|
|
if (commonRootEntityId.IsValid())
|
|
|
{
|
|
|
- m_instanceToTemplateInterface->GenerateDomForEntity(commonRootEntityDomBeforeDetaching,
|
|
|
+ m_instanceToTemplateInterface->GenerateEntityDomBySerializing(
|
|
|
+ commonRootEntityDomBeforeDetaching,
|
|
|
*GetEntityById(commonRootEntityId));
|
|
|
}
|
|
|
|
|
@@ -244,7 +245,7 @@ namespace AzToolsFramework
|
|
|
|
|
|
// Update and patch the container entity DOM in template with new components.
|
|
|
PrefabDom newContainerEntityDomWithComponents(&(newInstanceTemplateDom.GetAllocator()));
|
|
|
- m_instanceToTemplateInterface->GenerateDomForEntity(newContainerEntityDomWithComponents, *newContainerEntity);
|
|
|
+ m_instanceToTemplateInterface->GenerateEntityDomBySerializing(newContainerEntityDomWithComponents, *newContainerEntity);
|
|
|
PrefabDomPath newContainerEntityAliasDomPath(m_instanceToTemplateInterface->GenerateEntityAliasPath(newContainerEntityId).c_str());
|
|
|
newContainerEntityAliasDomPath.Set(newInstanceTemplateDom, newContainerEntityDomWithComponents.Move());
|
|
|
|
|
@@ -255,7 +256,8 @@ namespace AzToolsFramework
|
|
|
// Capture the container entity DOM with parent data in transform.
|
|
|
// This DOM will be used later to generate patches for child sort update and they should not contain transform data differences.
|
|
|
PrefabDom newContainerEntityDomInitialStateWithTransform;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForEntity(newContainerEntityDomInitialStateWithTransform, *newContainerEntity);
|
|
|
+ m_instanceToTemplateInterface->GenerateEntityDomBySerializing(
|
|
|
+ newContainerEntityDomInitialStateWithTransform, *newContainerEntity);
|
|
|
|
|
|
// Parent the non-container top level entities to the new container entity.
|
|
|
// It also patches the entity DOMs to the new template without undo/redo support.
|
|
@@ -271,7 +273,7 @@ namespace AzToolsFramework
|
|
|
|
|
|
// Update the entity DOM with the latest transform data.
|
|
|
PrefabDom topLevelContainerEntityDomWithParentInTransform(&(newInstanceTemplateDom.GetAllocator()));
|
|
|
- m_instanceToTemplateInterface->GenerateDomForEntity(
|
|
|
+ m_instanceToTemplateInterface->GenerateEntityDomBySerializing(
|
|
|
topLevelContainerEntityDomWithParentInTransform, *topLevelEntity);
|
|
|
|
|
|
PrefabDomPath entityAliasDomPath(m_instanceToTemplateInterface->GenerateEntityAliasPath(topLevelEntityId).c_str());
|
|
@@ -306,12 +308,14 @@ namespace AzToolsFramework
|
|
|
if (AZStd::find(topLevelEntities.begin(), topLevelEntities.end(), &nestedInstanceContainerEntity->get()) != topLevelEntities.end())
|
|
|
{
|
|
|
PrefabDom nestedContainerEntityDomBefore;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForEntity(nestedContainerEntityDomBefore, *nestedInstanceContainerEntity);
|
|
|
+ m_instanceToTemplateInterface->GenerateEntityDomBySerializing(
|
|
|
+ nestedContainerEntityDomBefore, *nestedInstanceContainerEntity);
|
|
|
|
|
|
AZ::TransformBus::Event(nestedInstanceContainerEntityId, &AZ::TransformBus::Events::SetParent, newContainerEntityId);
|
|
|
|
|
|
PrefabDom nestedContainerEntityDomAfter;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForEntity(nestedContainerEntityDomAfter, *nestedInstanceContainerEntity);
|
|
|
+ m_instanceToTemplateInterface->GenerateEntityDomBySerializing(
|
|
|
+ nestedContainerEntityDomAfter, *nestedInstanceContainerEntity);
|
|
|
|
|
|
PrefabDom reparentPatch;
|
|
|
m_instanceToTemplateInterface->GeneratePatch(reparentPatch, nestedContainerEntityDomBefore, nestedContainerEntityDomAfter);
|
|
@@ -327,7 +331,8 @@ namespace AzToolsFramework
|
|
|
|
|
|
// Patch the new template with child sort array update without undo/redo support.
|
|
|
PrefabDom newContainerEntityDomWithTransformAndChildSortOrder;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForEntity(newContainerEntityDomWithTransformAndChildSortOrder, *newContainerEntity);
|
|
|
+ m_instanceToTemplateInterface->GenerateEntityDomBySerializing(
|
|
|
+ newContainerEntityDomWithTransformAndChildSortOrder, *newContainerEntity);
|
|
|
|
|
|
PrefabDom childSortOrderUpdatePatches;
|
|
|
m_instanceToTemplateInterface->GeneratePatch(childSortOrderUpdatePatches,
|
|
@@ -342,7 +347,8 @@ namespace AzToolsFramework
|
|
|
if (commonRootEntityId.IsValid())
|
|
|
{
|
|
|
PrefabDom commonRootEntityDomAfterAddingNewPrefab;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForEntity(commonRootEntityDomAfterAddingNewPrefab,
|
|
|
+ m_instanceToTemplateInterface->GenerateEntityDomBySerializing(
|
|
|
+ commonRootEntityDomAfterAddingNewPrefab,
|
|
|
*GetEntityById(commonRootEntityId));
|
|
|
|
|
|
PrefabUndoHelpers::UpdateEntity(
|
|
@@ -413,7 +419,7 @@ namespace AzToolsFramework
|
|
|
// Generate the transform for the container entity out of the top level entities, and set it
|
|
|
// This step needs to be done before anything is parented to the container, else children position will be wrong
|
|
|
Prefab::PrefabDom containerEntityDomBefore;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForEntity(containerEntityDomBefore, *containerEntity);
|
|
|
+ m_instanceToTemplateInterface->GenerateEntityDomBySerializing(containerEntityDomBefore, *containerEntity);
|
|
|
|
|
|
// Set container entity to be child of common root
|
|
|
AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetParent, parentEntityId);
|
|
@@ -423,7 +429,7 @@ namespace AzToolsFramework
|
|
|
AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetLocalRotationQuaternion, rotation);
|
|
|
|
|
|
PrefabDom containerEntityDomAfter;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForEntity(containerEntityDomAfter, *containerEntity);
|
|
|
+ m_instanceToTemplateInterface->GenerateEntityDomBySerializing(containerEntityDomAfter, *containerEntity);
|
|
|
|
|
|
PrefabDom patch;
|
|
|
m_instanceToTemplateInterface->GeneratePatch(patch, containerEntityDomBefore, containerEntityDomAfter);
|
|
@@ -498,7 +504,7 @@ namespace AzToolsFramework
|
|
|
|
|
|
// Instantiate the Prefab
|
|
|
PrefabDom instanceToParentUnderDomBeforeCreate;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForInstance(instanceToParentUnderDomBeforeCreate, instanceToParentUnder->get());
|
|
|
+ m_instanceToTemplateInterface->GenerateInstanceDomBySerializing(instanceToParentUnderDomBeforeCreate, instanceToParentUnder->get());
|
|
|
|
|
|
auto instanceToCreate = prefabEditorEntityOwnershipInterface->InstantiatePrefab(relativePath, instanceToParentUnder);
|
|
|
|
|
@@ -514,7 +520,7 @@ namespace AzToolsFramework
|
|
|
AZ_Assert(containerEntity, "Invalid container entity detected in InstantiatePrefab.");
|
|
|
|
|
|
Prefab::PrefabDom containerEntityDomBefore;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForEntity(containerEntityDomBefore, *containerEntity);
|
|
|
+ m_instanceToTemplateInterface->GenerateEntityDomBySerializing(containerEntityDomBefore, *containerEntity);
|
|
|
|
|
|
// Capture parent entity DOM before adding the nested prefab instance
|
|
|
AZ::Entity* parentEntity = GetEntityById(parentId);
|
|
@@ -525,7 +531,7 @@ namespace AzToolsFramework
|
|
|
}
|
|
|
|
|
|
PrefabDom parentEntityDomBeforeAdding;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForEntity(parentEntityDomBeforeAdding, *parentEntity);
|
|
|
+ m_instanceToTemplateInterface->GenerateEntityDomBySerializing(parentEntityDomBeforeAdding, *parentEntity);
|
|
|
|
|
|
// Set container entity's parent
|
|
|
AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetParent, parentId);
|
|
@@ -534,7 +540,7 @@ namespace AzToolsFramework
|
|
|
AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetWorldTranslation, position);
|
|
|
|
|
|
PrefabDom containerEntityDomAfter;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForEntity(containerEntityDomAfter, *containerEntity);
|
|
|
+ m_instanceToTemplateInterface->GenerateEntityDomBySerializing(containerEntityDomAfter, *containerEntity);
|
|
|
|
|
|
// Generate patch to be stored in the link
|
|
|
PrefabDom patch;
|
|
@@ -545,7 +551,7 @@ namespace AzToolsFramework
|
|
|
|
|
|
// Update parent entity DOM
|
|
|
PrefabDom parentEntityDomAfterAdding;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForEntity(parentEntityDomAfterAdding, *parentEntity);
|
|
|
+ m_instanceToTemplateInterface->GenerateEntityDomBySerializing(parentEntityDomAfterAdding, *parentEntity);
|
|
|
PrefabUndoHelpers::UpdateEntity(parentEntityDomBeforeAdding, parentEntityDomAfterAdding, parentId, undoBatch.GetUndoBatch());
|
|
|
|
|
|
m_prefabUndoCache.UpdateCache(containerEntityId);
|
|
@@ -809,12 +815,12 @@ namespace AzToolsFramework
|
|
|
}
|
|
|
|
|
|
PrefabDom beforeState;
|
|
|
- m_instanceDomGeneratorInterface->GenerateEntityDom(beforeState, *entity);
|
|
|
+ m_instanceDomGeneratorInterface->GetEntityDomFromTemplate(beforeState, *entity);
|
|
|
AZ::EntityId beforeParentId;
|
|
|
m_prefabUndoCache.Retrieve(entityId, beforeParentId);
|
|
|
|
|
|
PrefabDom afterState;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForEntity(afterState, *entity);
|
|
|
+ m_instanceToTemplateInterface->GenerateEntityDomBySerializing(afterState, *entity);
|
|
|
AZ::EntityId afterParentId;
|
|
|
AZ::TransformBus::EventResult(afterParentId, entityId, &AZ::TransformBus::Events::GetParentId);
|
|
|
|
|
@@ -900,7 +906,7 @@ namespace AzToolsFramework
|
|
|
Internal_HandleInstanceChange(parentUndoBatch, entity, beforeParentId, afterParentId);
|
|
|
|
|
|
PrefabDom afterStateafterReparenting;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForEntity(afterStateafterReparenting, *entity);
|
|
|
+ m_instanceToTemplateInterface->GenerateEntityDomBySerializing(afterStateafterReparenting, *entity);
|
|
|
|
|
|
PrefabDom newPatch;
|
|
|
m_instanceToTemplateInterface->GeneratePatch(newPatch, afterState, afterStateafterReparenting);
|
|
@@ -1002,7 +1008,7 @@ namespace AzToolsFramework
|
|
|
|
|
|
// Get the previous state of the prior instance for undo/redo purposes
|
|
|
PrefabDom beforeInstanceDomBeforeRemoval;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForInstance(beforeInstanceDomBeforeRemoval, beforeOwningInstance->get());
|
|
|
+ m_instanceToTemplateInterface->GenerateInstanceDomBySerializing(beforeInstanceDomBeforeRemoval, beforeOwningInstance->get());
|
|
|
|
|
|
// Remove Entities
|
|
|
for (AZ::Entity* nestedEntity : entities)
|
|
@@ -1035,7 +1041,7 @@ namespace AzToolsFramework
|
|
|
|
|
|
// Get the previous state of the new instance for undo/redo purposes
|
|
|
PrefabDom afterInstanceDomBeforeAdd;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForInstance(afterInstanceDomBeforeAdd, afterOwningInstance->get());
|
|
|
+ m_instanceToTemplateInterface->GenerateInstanceDomBySerializing(afterInstanceDomBeforeAdd, afterOwningInstance->get());
|
|
|
|
|
|
// Add Entities
|
|
|
for (AZ::Entity* nestedEntity : entities)
|
|
@@ -1221,7 +1227,7 @@ namespace AzToolsFramework
|
|
|
|
|
|
// Take a snapshot of the instance DOM before we manipulate it
|
|
|
PrefabDom instanceDomBefore;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForInstance(instanceDomBefore, commonOwningInstance->get());
|
|
|
+ m_instanceToTemplateInterface->GenerateInstanceDomBySerializing(instanceDomBefore, commonOwningInstance->get());
|
|
|
|
|
|
// Make a copy of our before instance DOM where we will add our duplicated entities and/or instances
|
|
|
PrefabDom instanceDomAfter;
|
|
@@ -1525,7 +1531,7 @@ namespace AzToolsFramework
|
|
|
RemoveLink(instancePtr, parentTemplateId, undoBatch.GetUndoBatch());
|
|
|
|
|
|
Prefab::PrefabDom instanceDomBefore;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForInstance(instanceDomBefore, parentInstance);
|
|
|
+ m_instanceToTemplateInterface->GenerateInstanceDomBySerializing(instanceDomBefore, parentInstance);
|
|
|
|
|
|
AZStd::unordered_map<AZ::EntityId, AZStd::string> oldEntityAliases;
|
|
|
oldEntityAliases.emplace(containerEntityId, instancePtr->GetEntityAlias(containerEntityId)->get());
|
|
@@ -1563,7 +1569,7 @@ namespace AzToolsFramework
|
|
|
});
|
|
|
|
|
|
Prefab::PrefabDom instanceDomAfter;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForInstance(instanceDomAfter, parentInstance);
|
|
|
+ m_instanceToTemplateInterface->GenerateInstanceDomBySerializing(instanceDomAfter, parentInstance);
|
|
|
|
|
|
PrefabUndoInstance* command = aznew PrefabUndoInstance("Instance detachment");
|
|
|
command->Capture(instanceDomBefore, instanceDomAfter, parentTemplateId);
|
|
@@ -1582,7 +1588,7 @@ namespace AzToolsFramework
|
|
|
Instance& nestedInstanceUnderNewParent = parentInstance.AddInstance(AZStd::move(detachedNestedInstance));
|
|
|
|
|
|
PrefabDom nestedInstanceDomUnderNewParent;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForInstance(
|
|
|
+ m_instanceToTemplateInterface->GenerateInstanceDomBySerializing(
|
|
|
nestedInstanceDomUnderNewParent, nestedInstanceUnderNewParent);
|
|
|
PrefabDom reparentPatch;
|
|
|
m_instanceToTemplateInterface->GeneratePatch(
|
|
@@ -2054,7 +2060,7 @@ namespace AzToolsFramework
|
|
|
// Give this the outer allocator so that the memory reference will be valid when
|
|
|
// it gets used for AddMember
|
|
|
PrefabDom entityDomBefore(&domToAddDuplicatedEntitiesUnder.GetAllocator());
|
|
|
- m_instanceToTemplateInterface->GenerateDomForEntity(entityDomBefore, *entity);
|
|
|
+ m_instanceToTemplateInterface->GenerateEntityDomBySerializing(entityDomBefore, *entity);
|
|
|
|
|
|
// Keep track of the old alias <-> new alias mapping for this duplicated entity
|
|
|
// so we can fixup references later
|
|
@@ -2190,7 +2196,7 @@ namespace AzToolsFramework
|
|
|
for (auto instance : instances)
|
|
|
{
|
|
|
PrefabDom nestedInstanceDomBefore;
|
|
|
- m_instanceToTemplateInterface->GenerateDomForInstance(nestedInstanceDomBefore, *instance);
|
|
|
+ m_instanceToTemplateInterface->GenerateInstanceDomBySerializing(nestedInstanceDomBefore, *instance);
|
|
|
|
|
|
// Keep track of the old alias <-> new alias mapping for this duplicated instance
|
|
|
// so we can fixup references later
|