Add ScriptingObjectReference for Read/WriteStream and scripting interop as an array
This commit is contained in:
@@ -5,10 +5,6 @@
|
||||
#include "Stream.h"
|
||||
#include "Engine/Core/Templates.h"
|
||||
|
||||
struct CommonValue;
|
||||
struct Variant;
|
||||
struct VariantType;
|
||||
class ISerializable;
|
||||
extern FLAXENGINE_API class ScriptingObject* FindObject(const Guid& id, class MClass* type);
|
||||
|
||||
/// <summary>
|
||||
@@ -156,6 +152,14 @@ public:
|
||||
data = (T*)::FindObject(*(Guid*)id, T::GetStaticClass());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
FORCE_INLINE void Read(ScriptingObjectReference<T>& v)
|
||||
{
|
||||
T* ptr;
|
||||
Read(ptr);
|
||||
v = ptr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read data array
|
||||
/// </summary>
|
||||
|
||||
@@ -8,9 +8,15 @@
|
||||
#define FILESTREAM_BUFFER_SIZE 4096
|
||||
#define STREAM_MAX_STRING_LENGTH (4*1024) // 4 kB
|
||||
|
||||
// Forward declarations
|
||||
class ReadStream;
|
||||
class WriteStream;
|
||||
struct CommonValue;
|
||||
struct Variant;
|
||||
struct VariantType;
|
||||
class ISerializable;
|
||||
class ScriptingObject;
|
||||
template<typename T>
|
||||
class ScriptingObjectReference;
|
||||
|
||||
/// <summary>
|
||||
/// Base class for all data streams (memory streams, file streams etc.)
|
||||
|
||||
@@ -5,12 +5,6 @@
|
||||
#include "Stream.h"
|
||||
#include "Engine/Core/Templates.h"
|
||||
|
||||
struct CommonValue;
|
||||
struct Variant;
|
||||
struct VariantType;
|
||||
class ISerializable;
|
||||
class ScriptingObject;
|
||||
|
||||
/// <summary>
|
||||
/// Base class for all data write streams
|
||||
/// </summary>
|
||||
@@ -177,6 +171,12 @@ public:
|
||||
WriteBytes(id, sizeof(id));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
FORCE_INLINE void Write(const ScriptingObjectReference<T>& v)
|
||||
{
|
||||
Write(v.Get());
|
||||
}
|
||||
|
||||
template<typename T, typename AllocationType = HeapAllocation>
|
||||
void Write(const Array<T, AllocationType>& data)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user