Fix scene object reference serialization in C++ to use correct serializer

#3255
This commit is contained in:
Wojtek Figat
2025-08-30 23:52:54 +02:00
parent 3f7fe635d8
commit 8fdda1a71a
3 changed files with 15 additions and 10 deletions

View File

@@ -790,14 +790,14 @@ void Serialization::Deserialize(ISerializable::DeserializeStream& stream, Matrix
DESERIALIZE_HELPER(stream, "M44", v.M44, 0);
}
bool Serialization::ShouldSerialize(const SceneObject* v, const SceneObject* other)
bool Serialization::ShouldSerializeRef(const SceneObject* v, const SceneObject* other)
{
bool result = v != other;
if (result && v && other && v->HasPrefabLink() && other->HasPrefabLink())
{
// Special case when saving reference to prefab object and the objects are different but the point to the same prefab object
// In that case, skip saving reference as it's defined in prefab (will be populated via IdsMapping during deserialization)
result &= v->GetPrefabObjectID() != other->GetPrefabObjectID();
result = v->GetPrefabObjectID() != other->GetPrefabObjectID();
}
return result;
}