Minor codestyle tweaks for #1420
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
#pragma once
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
#include "Engine/Core/Cache.h"
|
||||
#include "Engine/Scripting/Script.h"
|
||||
@@ -13,8 +17,10 @@ API_CLASS(Attributes="HideInEditor") class FLAXENGINE_API MissingScript : public
|
||||
API_AUTO_SERIALIZATION();
|
||||
DECLARE_SCRIPTING_TYPE(MissingScript);
|
||||
|
||||
public:
|
||||
private:
|
||||
ScriptingObjectReference<Script> _referenceScript;
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Namespace and type name of missing script.
|
||||
/// </summary>
|
||||
@@ -28,8 +34,7 @@ public:
|
||||
/// <summary>
|
||||
/// Field for assigning new script to transfer data to.
|
||||
/// </summary>
|
||||
API_PROPERTY()
|
||||
FORCE_INLINE ScriptingObjectReference<Script> GetReferenceScript() const
|
||||
API_PROPERTY() ScriptingObjectReference<Script> GetReferenceScript() const
|
||||
{
|
||||
return _referenceScript;
|
||||
}
|
||||
@@ -37,29 +42,24 @@ public:
|
||||
/// <summary>
|
||||
/// Field for assigning new script to transfer data to.
|
||||
/// </summary>
|
||||
API_PROPERTY()
|
||||
void SetReferenceScript(ScriptingObjectReference<Script> value)
|
||||
API_PROPERTY() void SetReferenceScript(const ScriptingObjectReference<Script>& value)
|
||||
{
|
||||
_referenceScript = value;
|
||||
if (Data.IsEmpty())
|
||||
return;
|
||||
rapidjson_flax::Document document;
|
||||
document.Parse(Data.ToStringAnsi().GetText());
|
||||
|
||||
if(Data.IsEmpty()) return;
|
||||
|
||||
MapToReferenceScript();
|
||||
}
|
||||
|
||||
private:
|
||||
ScriptingObjectReference<Script> _referenceScript;
|
||||
|
||||
void MapToReferenceScript()
|
||||
{
|
||||
rapidjson_flax::Document doc;
|
||||
doc.Parse(Data.ToStringAnsi().GetText());
|
||||
|
||||
auto modifier = Cache::ISerializeModifier.Get();
|
||||
_referenceScript->Deserialize(doc, modifier.Value);
|
||||
_referenceScript->Deserialize(document, modifier.Value);
|
||||
|
||||
this->DeleteObject();
|
||||
DeleteObject();
|
||||
}
|
||||
};
|
||||
|
||||
inline MissingScript::MissingScript(const SpawnParams& params) : Script(params){}
|
||||
inline MissingScript::MissingScript(const SpawnParams& params)
|
||||
: Script(params)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user