Fix incorrect prefab serialization to correctly handle diff on object references to prefab objects
#3136
This commit is contained in:
@@ -441,10 +441,12 @@ namespace Serialization
|
||||
|
||||
// Scripting Object
|
||||
|
||||
FLAXENGINE_API bool ShouldSerialize(const SceneObject* v, const SceneObject* other);
|
||||
|
||||
template<typename T>
|
||||
inline typename TEnableIf<TIsBaseOf<ScriptingObject, T>::Value, bool>::Type ShouldSerialize(const T*& v, const void* otherObj)
|
||||
{
|
||||
return !otherObj || v != *(T**)otherObj;
|
||||
return !otherObj || v != *(const T**)otherObj;
|
||||
}
|
||||
template<typename T>
|
||||
inline typename TEnableIf<TIsBaseOf<ScriptingObject, T>::Value>::Type Serialize(ISerializable::SerializeStream& stream, const T*& v, const void* otherObj)
|
||||
@@ -460,12 +462,18 @@ namespace Serialization
|
||||
v = (T*)::FindObject(id, T::GetStaticClass());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline typename TEnableIf<TIsBaseOf<SceneObject, T>::Value, bool>::Type ShouldSerialize(const T*& v, const void* otherObj)
|
||||
{
|
||||
return !otherObj || ShouldSerialize((const SceneObject*)v, *(const SceneObject**)otherObj);
|
||||
}
|
||||
|
||||
// Scripting Object Reference
|
||||
|
||||
template<typename T>
|
||||
inline bool ShouldSerialize(const ScriptingObjectReference<T>& v, const void* otherObj)
|
||||
{
|
||||
return !otherObj || v.Get() != ((ScriptingObjectReference<T>*)otherObj)->Get();
|
||||
return !otherObj || ShouldSerialize(v.Get(), ((ScriptingObjectReference<T>*)otherObj)->Get());
|
||||
}
|
||||
template<typename T>
|
||||
inline void Serialize(ISerializable::SerializeStream& stream, const ScriptingObjectReference<T>& v, const void* otherObj)
|
||||
@@ -486,7 +494,7 @@ namespace Serialization
|
||||
template<typename T>
|
||||
inline bool ShouldSerialize(const SoftObjectReference<T>& v, const void* otherObj)
|
||||
{
|
||||
return !otherObj || v.Get() != ((SoftObjectReference<T>*)otherObj)->Get();
|
||||
return !otherObj || ShouldSerialize(v.Get(), ((SoftObjectReference<T>*)otherObj)->Get());
|
||||
}
|
||||
template<typename T>
|
||||
inline void Serialize(ISerializable::SerializeStream& stream, const SoftObjectReference<T>& v, const void* otherObj)
|
||||
|
||||
Reference in New Issue
Block a user