Fix missing asset update when dependant asset gets saved in Editor
#1489
This commit is contained in:
@@ -150,9 +150,7 @@ void BinaryAsset::ClearDependencies()
|
||||
{
|
||||
auto asset = Cast<BinaryAsset>(Content::GetAsset(e.First));
|
||||
if (asset)
|
||||
{
|
||||
asset->_dependantAssets.Remove(this);
|
||||
}
|
||||
}
|
||||
Dependencies.Clear();
|
||||
}
|
||||
@@ -387,6 +385,16 @@ bool BinaryAsset::SaveToAsset(const StringView& path, AssetInitData& data, bool
|
||||
if (binaryAsset)
|
||||
binaryAsset->_isSaving = false;
|
||||
|
||||
if (binaryAsset)
|
||||
{
|
||||
// Inform dependant asset (use cloned version because it might be modified by assets when they got reloaded)
|
||||
auto dependantAssets = binaryAsset->_dependantAssets;
|
||||
for (auto& e : dependantAssets)
|
||||
{
|
||||
e->OnDependencyModified(binaryAsset);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -963,6 +963,7 @@ bool FlaxStorage::Create(WriteStream* stream, const AssetInitData* data, int32 d
|
||||
// Asset Dependencies
|
||||
stream->WriteInt32(header.Dependencies.Count());
|
||||
stream->WriteBytes(header.Dependencies.Get(), header.Dependencies.Count() * sizeof(Pair<Guid, DateTime>));
|
||||
static_assert(sizeof(Pair<Guid, DateTime>) == sizeof(Guid) + sizeof(DateTime), "Invalid data size.");
|
||||
}
|
||||
|
||||
#if ASSETS_LOADING_EXTRA_VERIFICATION
|
||||
|
||||
Reference in New Issue
Block a user