@ -256,7 +256,7 @@ namespace AzToolsFramework
return ;
return ;
}
}
PrefabDom Reference sourceDom = sourceTemplate - > get ( ) . GetPrefabDom ( ) ;
PrefabDom & sourceDom = sourceTemplate - > get ( ) . GetPrefabDom ( ) ;
//use instance pointer to reach position
//use instance pointer to reach position
PrefabDomValueReference instanceDomRef = link - > get ( ) . GetLinkedInstanceDom ( ) ;
PrefabDomValueReference instanceDomRef = link - > get ( ) . GetLinkedInstanceDom ( ) ;
@ -274,16 +274,14 @@ namespace AzToolsFramework
( result . GetOutcome ( ) ! = AZ : : JsonSerializationResult : : Outcomes : : PartialSkip ) ,
( result . GetOutcome ( ) ! = AZ : : JsonSerializationResult : : Outcomes : : PartialSkip ) ,
" Some of the patches are not successfully applied. " ) ;
" Some of the patches are not successfully applied. " ) ;
//remove the link id placed into the instance
// Remove the link ids if present in the doms. We don't want any overrides to be created on top of linkIds because
auto linkIdIter = instanceDom . FindMember ( PrefabDomUtils : : LinkIdName ) ;
// linkIds are not persistent and will be created dynamically when prefabs are loaded into the editor.
if ( linkIdIter ! = instanceDom . MemberEnd ( ) )
instanceDom . RemoveMember ( PrefabDomUtils : : LinkIdName ) ;
{
sourceDom . RemoveMember ( PrefabDomUtils : : LinkIdName ) ;
instanceDom . RemoveMember ( PrefabDomUtils : : LinkIdName ) ;
}
//we use this to diff our copy against the vanilla template (source template)
//we use this to diff our copy against the vanilla template (source template)
PrefabDom patchLink ;
PrefabDom patchLink ;
m_instanceToTemplateInterface - > GeneratePatch ( patchLink , sourceDom - > get ( ) , instanceDom ) ;
m_instanceToTemplateInterface - > GeneratePatch ( patchLink , sourceDom , instanceDom ) ;
// Create a copy of patchLink by providing the allocator of m_linkDomNext so that the patch doesn't become invalid when
// Create a copy of patchLink by providing the allocator of m_linkDomNext so that the patch doesn't become invalid when
// the patch goes out of scope in this function.
// the patch goes out of scope in this function.