Fix missing scripting and serialization extensions for SceneReference usage in scripts
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "Content.h"
|
||||
#include "JsonAsset.h"
|
||||
#include "SceneReference.h"
|
||||
#include "Engine/Serialization/Serialization.h"
|
||||
#include "Cache/AssetsCache.h"
|
||||
#include "Storage/ContentStorageManager.h"
|
||||
#include "Storage/JsonStorageProxy.h"
|
||||
@@ -39,6 +41,16 @@ String AssetInfo::ToString() const
|
||||
return String::Format(TEXT("ID: {0}, TypeName: {1}, Path: \'{2}\'"), ID, TypeName, Path);
|
||||
}
|
||||
|
||||
void FLAXENGINE_API Serialization::Serialize(ISerializable::SerializeStream& stream, const SceneReference& v, const void* otherObj)
|
||||
{
|
||||
Serialize(stream, v.ID, otherObj);
|
||||
}
|
||||
|
||||
void FLAXENGINE_API Serialization::Deserialize(ISerializable::DeserializeStream& stream, SceneReference& v, ISerializeModifier* modifier)
|
||||
{
|
||||
Deserialize(stream, v.ID, modifier);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
// Assets
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
|
||||
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Engine/Core/Types/Guid.h"
|
||||
#include "Engine/Core/ISerializable.h"
|
||||
|
||||
/// <summary>
|
||||
/// Represents the reference to the scene asset. Stores the unique ID of the scene to reference. Can be used to load the selected scene.
|
||||
@@ -15,4 +16,37 @@ API_STRUCT(NoDefault) struct FLAXENGINE_API SceneReference
|
||||
/// The identifier of the scene asset (and the scene object).
|
||||
/// </summary>
|
||||
API_FIELD() Guid ID;
|
||||
|
||||
FORCE_INLINE bool operator==(const SceneReference& other) const
|
||||
{
|
||||
return ID == other.ID;
|
||||
}
|
||||
|
||||
FORCE_INLINE bool operator!=(const SceneReference& other) const
|
||||
{
|
||||
return ID != other.ID;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct TIsPODType<SceneReference>
|
||||
{
|
||||
enum { Value = true };
|
||||
};
|
||||
|
||||
inline uint32 GetHash(const SceneReference& key)
|
||||
{
|
||||
return GetHash(key.ID);
|
||||
}
|
||||
|
||||
// @formatter:off
|
||||
namespace Serialization
|
||||
{
|
||||
inline bool ShouldSerialize(const SceneReference& v, const void* otherObj)
|
||||
{
|
||||
return !otherObj || v != *(SceneReference*)otherObj;
|
||||
}
|
||||
void FLAXENGINE_API Serialize(ISerializable::SerializeStream& stream, const SceneReference& v, const void* otherObj);
|
||||
void FLAXENGINE_API Deserialize(ISerializable::DeserializeStream& stream, SceneReference& v, ISerializeModifier* modifier);
|
||||
}
|
||||
// @formatter:on
|
||||
|
||||
Reference in New Issue
Block a user