Merge remote-tracking branch 'origin/master' into 1.7
# Conflicts: # Source/Engine/Level/Actors/AnimatedModel.cpp
This commit is contained in:
@@ -227,7 +227,7 @@ protected:
|
||||
|
||||
bool onLoad(LoadAssetTask* task);
|
||||
void onLoaded();
|
||||
void onLoaded_MainThread();
|
||||
virtual void onLoaded_MainThread();
|
||||
virtual void onUnload_MainThread();
|
||||
#if USE_EDITOR
|
||||
virtual void onRename(const StringView& newPath) = 0;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "FlaxEngine.Gen.h"
|
||||
#include "Cache/AssetsCache.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Config/Settings.h"
|
||||
#include "Engine/Serialization/JsonTools.h"
|
||||
#include "Engine/Serialization/JsonWriters.h"
|
||||
#include "Engine/Content/Factories/JsonAssetFactory.h"
|
||||
@@ -126,8 +127,7 @@ void FindIds(ISerializable::DeserializeStream& node, Array<Guid>& output)
|
||||
}
|
||||
else if (node.IsString())
|
||||
{
|
||||
const auto length = node.GetStringLength();
|
||||
if (length == 32)
|
||||
if (node.GetStringLength() == 32)
|
||||
{
|
||||
// Try parse as Guid in format `N` (32 hex chars)
|
||||
Guid id;
|
||||
@@ -362,10 +362,25 @@ void JsonAsset::unload(bool isReloading)
|
||||
#endif
|
||||
Scripting::ScriptsUnload.Unbind<JsonAsset, &JsonAsset::DeleteInstance>(this);
|
||||
DeleteInstance();
|
||||
_isAfterReload |= isReloading;
|
||||
|
||||
JsonAssetBase::unload(isReloading);
|
||||
}
|
||||
|
||||
void JsonAsset::onLoaded_MainThread()
|
||||
{
|
||||
JsonAssetBase::onLoaded_MainThread();
|
||||
|
||||
// Special case for Settings assets to flush them after edited and saved in Editor
|
||||
const StringAsANSI<> dataTypeNameAnsi(DataTypeName.Get(), DataTypeName.Length());
|
||||
const auto typeHandle = Scripting::FindScriptingType(StringAnsiView(dataTypeNameAnsi.Get(), DataTypeName.Length()));
|
||||
if (Instance && typeHandle && typeHandle.IsSubclassOf(SettingsBase::TypeInitializer) && _isAfterReload)
|
||||
{
|
||||
_isAfterReload = false;
|
||||
((SettingsBase*)Instance)->Apply();
|
||||
}
|
||||
}
|
||||
|
||||
bool JsonAsset::CreateInstance()
|
||||
{
|
||||
ScopeLock lock(Locker);
|
||||
|
||||
@@ -118,6 +118,7 @@ API_CLASS(NoSpawn) class FLAXENGINE_API JsonAsset : public JsonAssetBase
|
||||
DECLARE_ASSET_HEADER(JsonAsset);
|
||||
private:
|
||||
ScriptingType::Dtor _dtor;
|
||||
bool _isAfterReload = false;
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
@@ -149,6 +150,7 @@ protected:
|
||||
// [JsonAssetBase]
|
||||
LoadResult loadAsset() override;
|
||||
void unload(bool isReloading) override;
|
||||
void onLoaded_MainThread() override;
|
||||
|
||||
private:
|
||||
bool CreateInstance();
|
||||
|
||||
Reference in New Issue
Block a user