mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-04 11:35:06 +03:00
Added validation for serialization
This commit is contained in:
@@ -5,15 +5,5 @@
|
||||
|
||||
struct NativeScriptComponent
|
||||
{
|
||||
//ScriptableEntity* Instance = nullptr;
|
||||
//
|
||||
//ScriptableEntity *(*InstantiateScript)();
|
||||
//void (*DestroyScript)(NativeScriptComponent*);
|
||||
//
|
||||
//template<typename T>
|
||||
//void Bind()
|
||||
//{
|
||||
// InstantiateScript = []() { return static_cast<ScriptableEntity*>(new T()); };
|
||||
// DestroyScript = [](NativeScriptComponent* nsc) { delete nsc->Instance; nsc->Instance = nullptr; };
|
||||
//}
|
||||
|
||||
};
|
||||
@@ -14,7 +14,10 @@ namespace Nuake
|
||||
SERIALIZE_VAL(GravityRandom);
|
||||
SERIALIZE_VAL(Radius);
|
||||
SERIALIZE_VAL(GlobalSpace);
|
||||
SERIALIZE_OBJECT(ParticleMaterial);
|
||||
if (ParticleMaterial)
|
||||
{
|
||||
SERIALIZE_OBJECT(ParticleMaterial);
|
||||
}
|
||||
SERIALIZE_VAL(LifeRandomness);
|
||||
SERIALIZE_VAL(ScaleRandomness);
|
||||
END_SERIALIZE();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "src/Scripting/WrenScript.h"
|
||||
#include "src/Resource/Serializable.h"
|
||||
#include "src/Core/FileSystem.h"
|
||||
#include "src/Core/Logger.h"
|
||||
|
||||
namespace Nuake
|
||||
{
|
||||
@@ -17,6 +18,13 @@ namespace Nuake
|
||||
{
|
||||
Script = path;
|
||||
Ref<Nuake::File> nuakeFile = Nuake::FileSystem::GetFile(path);
|
||||
|
||||
if (!nuakeFile)
|
||||
{
|
||||
Logger::Log("Failed to load script: " + path, "script", CRITICAL);
|
||||
return;
|
||||
}
|
||||
|
||||
mWrenScript = CreateRef<Nuake::WrenScript>(nuakeFile, true);
|
||||
auto modules = mWrenScript->GetModules();
|
||||
if (modules.size() > 0)
|
||||
|
||||
Reference in New Issue
Block a user