Fixes and tweaks

This commit is contained in:
Wojtek Figat
2021-02-12 10:57:45 +01:00
parent 5a23df6478
commit 80e2aee92b
10 changed files with 11 additions and 27 deletions

View File

@@ -125,7 +125,7 @@ void AudioClip::StreamingTask::OnEnd()
{
ASSERT(_asset->_streamingTask == this);
_asset->_streamingTask = nullptr;
_asset.Unlink();
_asset = nullptr;
}
_dataLock.Release();

View File

@@ -104,7 +104,7 @@ protected:
{
ASSERT(_asset->_streamingTask == this);
_asset->_streamingTask = nullptr;
_asset.Unlink();
_asset = nullptr;
}
_dataLock.Release();

View File

@@ -97,7 +97,7 @@ protected:
{
ASSERT(_asset->_streamingTask == this);
_asset->_streamingTask = nullptr;
_asset.Unlink();
_asset = nullptr;
}
_dataLock.Release();

View File

@@ -491,7 +491,7 @@ protected:
void OnEnd() override
{
_dataLock.Release();
_asset.Unlink();
_asset = nullptr;
// Base
ContentLoadTask::OnEnd();

View File

@@ -82,7 +82,7 @@ protected:
void OnEnd() override
{
_dataLock.Release();
_asset.Unlink();
_asset = nullptr;
// Base
ContentLoadTask::OnEnd();

View File

@@ -68,7 +68,7 @@ protected:
void OnEnd() override
{
_asset.Unlink();
_asset = nullptr;
// Base
ContentLoadTask::OnEnd();

View File

@@ -66,14 +66,6 @@ public:
return _asset ? _asset->GetOrCreateManagedInstance() : nullptr;
}
/// <summary>
/// Clears the asset reference.
/// </summary>
FORCE_INLINE void Unlink()
{
OnSet(nullptr);
}
/// <summary>
/// Gets the asset property value as string.
/// </summary>
@@ -103,7 +95,8 @@ protected:
{
ASSERT(_asset == asset);
Unload();
Unlink();
asset->OnUnloaded.Unbind<WeakAssetReferenceBase, &WeakAssetReferenceBase::OnAssetUnloaded>(this);
asset = nullptr;
}
};

View File

@@ -259,13 +259,13 @@ void GameBaseImpl::OnSplashScreenEnd()
{
// Hide splash screen
SplashScreenTime = 0;
SplashScreen.Unlink();
SplashScreen = nullptr;
MainRenderTask::Instance->PostRender.Unbind(&OnPostRender);
// Load the first scene
LOG(Info, "Loading the first scene");
const auto sceneId = FirstScene ? FirstScene.GetID() : Guid::Empty;
FirstScene.Unlink();
FirstScene = nullptr;
if (Level::LoadSceneAsync(sceneId))
{
LOG(Fatal, "Cannot load the first scene.");

View File

@@ -75,12 +75,8 @@ public:
GPUResourceProperty& operator=(const GPUResourceProperty& other)
{
// Protect against invalid self-assignment
if (this != &other)
{
Set(other.Get());
}
return *this;
}
@@ -158,7 +154,6 @@ public:
/// <param name="value">Value to assign</param>
void Set(T* value)
{
// Check if value will change
if (_resource != value)
{
// Remove reference from the old one
@@ -179,7 +174,6 @@ public:
/// </summary>
void Unlink()
{
// Check if value will change
if (_resource)
{
// Remove reference from the old one
@@ -194,10 +188,7 @@ private:
{
if (_resource)
{
// Unlink
_resource = nullptr;
// Fire event
OnUnload(this);
}
}

View File

@@ -15,7 +15,7 @@
#define ENSURE_CAN_COOK \
if (Physics::GetCooking() == nullptr) \
{ \
LOG(Warning, "Physics collisions cooking is disabled at runtime. Enable Physics Settings option SupportCookingAtRuntime to use terrain generation at runtime."); \
LOG(Warning, "Physics collisions cooking is disabled at runtime. Enable Physics Settings option SupportCookingAtRuntime to use collision generation at runtime."); \
return true; \
}