From 66b828ae9208767ea3e0bcf26bb387c7d3412af6 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 8 May 2024 15:54:37 +0200 Subject: [PATCH] Refactor `Asset::GetReferences` to support file path references --- .../Editor/Cooker/Steps/CollectAssetsStep.cpp | 57 ++++++++----------- .../Editor/Cooker/Steps/CollectAssetsStep.h | 8 --- Source/Engine/AI/BehaviorTree.cpp | 8 +-- Source/Engine/AI/BehaviorTree.h | 2 +- .../SceneAnimations/SceneAnimation.cpp | 6 +- .../SceneAnimations/SceneAnimation.h | 2 +- Source/Engine/Content/Asset.cpp | 11 +++- Source/Engine/Content/Asset.h | 11 ++-- .../Engine/Content/Assets/AnimationGraph.cpp | 8 +-- Source/Engine/Content/Assets/AnimationGraph.h | 2 +- Source/Engine/Content/Assets/MaterialBase.cpp | 10 ++++ Source/Engine/Content/Assets/MaterialBase.h | 10 +--- .../Content/Assets/MaterialInstance.cpp | 8 +-- .../Engine/Content/Assets/MaterialInstance.h | 2 +- Source/Engine/Content/Assets/Model.cpp | 8 +-- Source/Engine/Content/Assets/Model.h | 2 +- Source/Engine/Content/Assets/SkeletonMask.h | 8 +-- Source/Engine/Content/Assets/SkinnedModel.cpp | 8 +-- Source/Engine/Content/Assets/SkinnedModel.h | 2 +- Source/Engine/Content/Assets/VisualScript.h | 8 +-- Source/Engine/Content/JsonAsset.cpp | 15 ++--- Source/Engine/Content/JsonAsset.h | 6 +- .../Graphics/Materials/MaterialParams.cpp | 4 +- .../Graphics/Materials/MaterialParams.h | 6 +- Source/Engine/Level/Scene/Scene.cpp | 3 +- Source/Engine/Particles/ParticleEmitter.h | 8 +-- Source/Engine/Particles/ParticleSystem.cpp | 8 +-- Source/Engine/Particles/ParticleSystem.h | 17 +++--- Source/Engine/Visject/Graph.h | 8 +-- 29 files changed, 121 insertions(+), 135 deletions(-) diff --git a/Source/Editor/Cooker/Steps/CollectAssetsStep.cpp b/Source/Editor/Cooker/Steps/CollectAssetsStep.cpp index 960be87ad..4787339e6 100644 --- a/Source/Editor/Cooker/Steps/CollectAssetsStep.cpp +++ b/Source/Editor/Cooker/Steps/CollectAssetsStep.cpp @@ -10,47 +10,26 @@ #include "Engine/Content/Assets/Shader.h" #include "Engine/Content/Cache/AssetsCache.h" -bool CollectAssetsStep::Process(CookingData& data, Asset* asset) -{ - // Skip virtual/temporary assets - if (asset->IsVirtual()) - return false; - - // Keep reference to the asset - AssetReference ref(asset); - - // Asset should have loaded data - if (asset->WaitForLoaded()) - return false; - - // Gather asset references - _references.Clear(); - asset->Locker.Lock(); - asset->GetReferences(_references); - asset->Locker.Unlock(); - _assetsQueue.Add(_references); - - return false; -} - bool CollectAssetsStep::Perform(CookingData& data) { LOG(Info, "Searching for assets to include in a build. Using {0} root assets.", data.RootAssets.Count()); data.StepProgress(TEXT("Collecting assets"), 0); // Initialize assets queue - _assetsQueue.Clear(); - _assetsQueue.EnsureCapacity(1024); + Array assetsQueue; + assetsQueue.Clear(); + assetsQueue.EnsureCapacity(1024); for (auto i = data.RootAssets.Begin(); i.IsNotEnd(); ++i) - _assetsQueue.Add(i->Item); + assetsQueue.Add(i->Item); // Iterate through the assets graph AssetInfo assetInfo; - while (_assetsQueue.HasItems()) + Array references; + Array files; + while (assetsQueue.HasItems()) { BUILD_STEP_CANCEL_CHECK; - - const auto assetId = _assetsQueue.Dequeue(); + const auto assetId = assetsQueue.Dequeue(); // Skip already processed or invalid assets if (!assetId.IsValid() @@ -69,14 +48,26 @@ bool CollectAssetsStep::Perform(CookingData& data) } // Load asset - const auto asset = Content::LoadAsync(assetId); + AssetReference asset = Content::LoadAsync(assetId); if (asset == nullptr) continue; - - // Process that asset LOG_STR(Info, asset->GetPath()); data.Assets.Add(assetId); - Process(data, asset); + + // Skip virtual/temporary assets + if (asset->IsVirtual()) + continue; + + // Asset should have loaded data + if (asset->WaitForLoaded()) + continue; + + // Gather asset references + references.Clear(); + asset->Locker.Lock(); + asset->GetReferences(references, files); + asset->Locker.Unlock(); + assetsQueue.Add(references); } data.Stats.TotalAssets = data.Assets.Count(); diff --git a/Source/Editor/Cooker/Steps/CollectAssetsStep.h b/Source/Editor/Cooker/Steps/CollectAssetsStep.h index 15e7f04e9..03df52528 100644 --- a/Source/Editor/Cooker/Steps/CollectAssetsStep.h +++ b/Source/Editor/Cooker/Steps/CollectAssetsStep.h @@ -12,15 +12,7 @@ class Asset; /// class CollectAssetsStep : public GameCooker::BuildStep { -private: - - Array _assetsQueue; - Array _references; - - bool Process(CookingData& data, Asset* asset); - public: - // [BuildStep] bool Perform(CookingData& data) override; }; diff --git a/Source/Engine/AI/BehaviorTree.cpp b/Source/Engine/AI/BehaviorTree.cpp index e0407ede9..8cbb9f608 100644 --- a/Source/Engine/AI/BehaviorTree.cpp +++ b/Source/Engine/AI/BehaviorTree.cpp @@ -232,12 +232,12 @@ void BehaviorTree::OnScriptsReloadEnd() Graph.Setup(this); } -void BehaviorTree::GetReferences(Array& output) const +void BehaviorTree::GetReferences(Array& assets, Array& files) const { // Base - BinaryAsset::GetReferences(output); + BinaryAsset::GetReferences(assets, files); - Graph.GetReferences(output); + Graph.GetReferences(assets); // Extract refs from serialized nodes data for (const BehaviorTreeGraphNode& n : Graph.Nodes) @@ -246,7 +246,7 @@ void BehaviorTree::GetReferences(Array& output) const continue; const Variant& data = n.Values[1]; if (data.Type == VariantType::Blob) - JsonAssetBase::GetReferences(StringAnsiView((char*)data.AsBlob.Data, data.AsBlob.Length), output); + JsonAssetBase::GetReferences(StringAnsiView((char*)data.AsBlob.Data, data.AsBlob.Length), assets); } } diff --git a/Source/Engine/AI/BehaviorTree.h b/Source/Engine/AI/BehaviorTree.h index a31b58da8..1463cd9a5 100644 --- a/Source/Engine/AI/BehaviorTree.h +++ b/Source/Engine/AI/BehaviorTree.h @@ -98,7 +98,7 @@ public: // [BinaryAsset] void OnScriptingDispose() override; #if USE_EDITOR - void GetReferences(Array& output) const override; + void GetReferences(Array& assets, Array& files) const override; #endif protected: diff --git a/Source/Engine/Animations/SceneAnimations/SceneAnimation.cpp b/Source/Engine/Animations/SceneAnimations/SceneAnimation.cpp index b3e7a6e27..71cc8f1f4 100644 --- a/Source/Engine/Animations/SceneAnimations/SceneAnimation.cpp +++ b/Source/Engine/Animations/SceneAnimations/SceneAnimation.cpp @@ -75,16 +75,16 @@ bool SceneAnimation::SaveTimeline(const BytesContainer& data) #if USE_EDITOR -void SceneAnimation::GetReferences(Array& output) const +void SceneAnimation::GetReferences(Array& assets, Array& files) const { // Base - BinaryAsset::GetReferences(output); + BinaryAsset::GetReferences(assets, files); for (int32 i = 0; i < Tracks.Count(); i++) { const auto& track = Tracks[i]; if (track.Asset) - output.Add(track.Asset->GetID()); + assets.Add(track.Asset->GetID()); } } diff --git a/Source/Engine/Animations/SceneAnimations/SceneAnimation.h b/Source/Engine/Animations/SceneAnimations/SceneAnimation.h index e08f0c38c..9232589b5 100644 --- a/Source/Engine/Animations/SceneAnimations/SceneAnimation.h +++ b/Source/Engine/Animations/SceneAnimations/SceneAnimation.h @@ -464,7 +464,7 @@ public: public: // [BinaryAsset] #if USE_EDITOR - void GetReferences(Array& output) const override; + void GetReferences(Array& assets, Array& files) const override; #endif protected: diff --git a/Source/Engine/Content/Asset.cpp b/Source/Engine/Content/Asset.cpp index ddff7fc8a..b63abcc24 100644 --- a/Source/Engine/Content/Asset.cpp +++ b/Source/Engine/Content/Asset.cpp @@ -536,6 +536,14 @@ void Asset::CancelStreaming() #if USE_EDITOR +void Asset::GetReferences(Array& assets, Array& files) const +{ + // Fallback to the old API +PRAGMA_DISABLE_DEPRECATION_WARNINGS; + GetReferences(assets); +PRAGMA_ENABLE_DEPRECATION_WARNINGS; +} + void Asset::GetReferences(Array& output) const { // No refs by default @@ -544,7 +552,8 @@ void Asset::GetReferences(Array& output) const Array Asset::GetReferences() const { Array result; - GetReferences(result); + Array files; + GetReferences(result, files); return result; } diff --git a/Source/Engine/Content/Asset.h b/Source/Engine/Content/Asset.h index d1256b7c7..15c5cae6f 100644 --- a/Source/Engine/Content/Asset.h +++ b/Source/Engine/Content/Asset.h @@ -179,10 +179,13 @@ public: /// For some asset types (e.g. scene or prefab) it may contain invalid asset ids due to not perfect gather method, /// which is optimized to perform scan very quickly. Before using those ids perform simple validation via Content cache API. /// The result collection contains only 1-level-deep references (only direct ones) and is invalid if asset is not loaded. - /// Also the output data may have duplicated asset ids or even invalid ids (Guid::Empty). + /// Also, the output data may have duplicated asset ids or even invalid ids (Guid::Empty). /// - /// The output collection of the asset ids referenced by this asset. - virtual void GetReferences(Array& output) const; + /// The output collection of the asset ids referenced by this asset. + /// The output list of file paths referenced by this asset. Files might come from project Content folder (relative path is preserved in cooked game), or external location (copied into Content root folder of cooked game). + virtual void GetReferences(Array& assets, Array& files) const; + // [Deprecated in v1.9] + DEPRECATED virtual void GetReferences(Array& output) const; /// /// Gets the asset references. Supported only in Editor. @@ -191,7 +194,7 @@ public: /// For some asset types (e.g. scene or prefab) it may contain invalid asset ids due to not perfect gather method, /// which is optimized to perform scan very quickly. Before using those ids perform simple validation via Content cache API. /// The result collection contains only 1-level-deep references (only direct ones) and is invalid if asset is not loaded. - /// Also the output data may have duplicated asset ids or even invalid ids (Guid::Empty). + /// Also, the output data may have duplicated asset ids or even invalid ids (Guid::Empty). /// /// The collection of the asset ids referenced by this asset. API_FUNCTION() Array GetReferences() const; diff --git a/Source/Engine/Content/Assets/AnimationGraph.cpp b/Source/Engine/Content/Assets/AnimationGraph.cpp index d33aa6125..f5d3a8073 100644 --- a/Source/Engine/Content/Assets/AnimationGraph.cpp +++ b/Source/Engine/Content/Assets/AnimationGraph.cpp @@ -222,12 +222,10 @@ void AnimationGraph::FindDependencies(AnimGraphBase* graph) } } -void AnimationGraph::GetReferences(Array& output) const +void AnimationGraph::GetReferences(Array& assets, Array& files) const { - // Base - BinaryAsset::GetReferences(output); - - Graph.GetReferences(output); + BinaryAsset::GetReferences(assets, files); + Graph.GetReferences(assets); } #endif diff --git a/Source/Engine/Content/Assets/AnimationGraph.h b/Source/Engine/Content/Assets/AnimationGraph.h index fd208aa7f..77468e448 100644 --- a/Source/Engine/Content/Assets/AnimationGraph.h +++ b/Source/Engine/Content/Assets/AnimationGraph.h @@ -64,7 +64,7 @@ private: public: // [BinaryAsset] #if USE_EDITOR - void GetReferences(Array& output) const override; + void GetReferences(Array& assets, Array& files) const override; #endif protected: diff --git a/Source/Engine/Content/Assets/MaterialBase.cpp b/Source/Engine/Content/Assets/MaterialBase.cpp index 433463059..d537a5746 100644 --- a/Source/Engine/Content/Assets/MaterialBase.cpp +++ b/Source/Engine/Content/Assets/MaterialBase.cpp @@ -45,3 +45,13 @@ MaterialInstance* MaterialBase::CreateVirtualInstance() instance->SetBaseMaterial(this); return instance; } + +#if USE_EDITOR + +void MaterialBase::GetReferences(Array& assets, Array& files) const +{ + BinaryAsset::GetReferences(assets, files); + Params.GetReferences(assets); +} + +#endif diff --git a/Source/Engine/Content/Assets/MaterialBase.h b/Source/Engine/Content/Assets/MaterialBase.h index 3d1a624a4..81316b106 100644 --- a/Source/Engine/Content/Assets/MaterialBase.h +++ b/Source/Engine/Content/Assets/MaterialBase.h @@ -25,7 +25,7 @@ public: Action ParamsChanged; /// - /// Returns true if material is an material instance. + /// Returns true if material is a material instance. /// virtual bool IsMaterialInstance() const = 0; @@ -77,12 +77,6 @@ public: public: // [BinaryAsset] #if USE_EDITOR - void GetReferences(Array& output) const override - { - // Base - BinaryAsset::GetReferences(output); - - Params.GetReferences(output); - } + void GetReferences(Array& assets, Array& files) const override; #endif }; diff --git a/Source/Engine/Content/Assets/MaterialInstance.cpp b/Source/Engine/Content/Assets/MaterialInstance.cpp index 2c436f396..4afcde7b9 100644 --- a/Source/Engine/Content/Assets/MaterialInstance.cpp +++ b/Source/Engine/Content/Assets/MaterialInstance.cpp @@ -123,13 +123,11 @@ bool MaterialInstance::IsMaterialInstance() const #if USE_EDITOR -void MaterialInstance::GetReferences(Array& output) const +void MaterialInstance::GetReferences(Array& assets, Array& files) const { - // Base - MaterialBase::GetReferences(output); - + MaterialBase::GetReferences(assets, files); if (_baseMaterial) - output.Add(_baseMaterial->GetID()); + assets.Add(_baseMaterial->GetID()); } #endif diff --git a/Source/Engine/Content/Assets/MaterialInstance.h b/Source/Engine/Content/Assets/MaterialInstance.h index 5a99cdb41..3e9f2ec2a 100644 --- a/Source/Engine/Content/Assets/MaterialInstance.h +++ b/Source/Engine/Content/Assets/MaterialInstance.h @@ -50,7 +50,7 @@ public: // [MaterialBase] bool IsMaterialInstance() const override; #if USE_EDITOR - void GetReferences(Array& output) const override; + void GetReferences(Array& assets, Array& files) const override; #endif // [IMaterial] diff --git a/Source/Engine/Content/Assets/Model.cpp b/Source/Engine/Content/Assets/Model.cpp index 9143e3247..3bcaf4330 100644 --- a/Source/Engine/Content/Assets/Model.cpp +++ b/Source/Engine/Content/Assets/Model.cpp @@ -788,15 +788,13 @@ void Model::CancelStreaming() #if USE_EDITOR -void Model::GetReferences(Array& output) const +void Model::GetReferences(Array& assets, Array& files) const { // Base - BinaryAsset::GetReferences(output); + BinaryAsset::GetReferences(assets, files); for (int32 i = 0; i < MaterialSlots.Count(); i++) - { - output.Add(MaterialSlots[i].Material.GetID()); - } + assets.Add(MaterialSlots[i].Material.GetID()); } #endif diff --git a/Source/Engine/Content/Assets/Model.h b/Source/Engine/Content/Assets/Model.h index 16c4d45f4..c02a3bdcf 100644 --- a/Source/Engine/Content/Assets/Model.h +++ b/Source/Engine/Content/Assets/Model.h @@ -251,7 +251,7 @@ public: void InitAsVirtual() override; void CancelStreaming() override; #if USE_EDITOR - void GetReferences(Array& output) const override; + void GetReferences(Array& assets, Array& files) const override; #endif // [StreamableResource] diff --git a/Source/Engine/Content/Assets/SkeletonMask.h b/Source/Engine/Content/Assets/SkeletonMask.h index 5ecc0e384..f14975b37 100644 --- a/Source/Engine/Content/Assets/SkeletonMask.h +++ b/Source/Engine/Content/Assets/SkeletonMask.h @@ -68,12 +68,10 @@ private: public: // [BinaryAsset] #if USE_EDITOR - void GetReferences(Array& output) const override + void GetReferences(Array& assets, Array& files) const override { - // Base - BinaryAsset::GetReferences(output); - - output.Add(Skeleton.GetID()); + BinaryAsset::GetReferences(assets, files); + assets.Add(Skeleton.GetID()); } #endif diff --git a/Source/Engine/Content/Assets/SkinnedModel.cpp b/Source/Engine/Content/Assets/SkinnedModel.cpp index 15be02616..d70c9fb35 100644 --- a/Source/Engine/Content/Assets/SkinnedModel.cpp +++ b/Source/Engine/Content/Assets/SkinnedModel.cpp @@ -974,15 +974,13 @@ void SkinnedModel::CancelStreaming() #if USE_EDITOR -void SkinnedModel::GetReferences(Array& output) const +void SkinnedModel::GetReferences(Array& assets, Array& files) const { // Base - BinaryAsset::GetReferences(output); + BinaryAsset::GetReferences(assets, files); for (int32 i = 0; i < MaterialSlots.Count(); i++) - { - output.Add(MaterialSlots[i].Material.GetID()); - } + assets.Add(MaterialSlots[i].Material.GetID()); } #endif diff --git a/Source/Engine/Content/Assets/SkinnedModel.h b/Source/Engine/Content/Assets/SkinnedModel.h index 53feb4080..1461844a1 100644 --- a/Source/Engine/Content/Assets/SkinnedModel.h +++ b/Source/Engine/Content/Assets/SkinnedModel.h @@ -323,7 +323,7 @@ public: void InitAsVirtual() override; void CancelStreaming() override; #if USE_EDITOR - void GetReferences(Array& output) const override; + void GetReferences(Array& assets, Array& files) const override; #endif // [StreamableResource] diff --git a/Source/Engine/Content/Assets/VisualScript.h b/Source/Engine/Content/Assets/VisualScript.h index dc63609a6..b6bda5ffb 100644 --- a/Source/Engine/Content/Assets/VisualScript.h +++ b/Source/Engine/Content/Assets/VisualScript.h @@ -277,12 +277,10 @@ public: public: // [BinaryAsset] #if USE_EDITOR - void GetReferences(Array& output) const override + void GetReferences(Array& assets, Array& files) const override { - // Base - BinaryAsset::GetReferences(output); - - Graph.GetReferences(output); + BinaryAsset::GetReferences(assets, files); + Graph.GetReferences(assets); } #endif diff --git a/Source/Engine/Content/JsonAsset.cpp b/Source/Engine/Content/JsonAsset.cpp index 854c06001..e9960d424 100644 --- a/Source/Engine/Content/JsonAsset.cpp +++ b/Source/Engine/Content/JsonAsset.cpp @@ -109,20 +109,20 @@ uint64 JsonAssetBase::GetMemoryUsage() const #if USE_EDITOR -void FindIds(ISerializable::DeserializeStream& node, Array& output) +void FindIds(ISerializable::DeserializeStream& node, Array& output, Array& files) { if (node.IsObject()) { for (auto i = node.MemberBegin(); i != node.MemberEnd(); ++i) { - FindIds(i->value, output); + FindIds(i->value, output, files); } } else if (node.IsArray()) { for (rapidjson::SizeType i = 0; i < node.Size(); i++) { - FindIds(node[i], output); + FindIds(node[i], output, files); } } else if (node.IsString()) @@ -137,13 +137,14 @@ void FindIds(ISerializable::DeserializeStream& node, Array& output) } } -void JsonAssetBase::GetReferences(const StringAnsiView& json, Array& output) +void JsonAssetBase::GetReferences(const StringAnsiView& json, Array& assets) { ISerializable::SerializeDocument document; document.Parse(json.Get(), json.Length()); if (document.HasParseError()) return; - FindIds(document, output); + Array files; + FindIds(document, assets, files); } bool JsonAssetBase::Save(const StringView& path) const @@ -207,7 +208,7 @@ bool JsonAssetBase::Save(JsonWriter& writer) const return false; } -void JsonAssetBase::GetReferences(Array& output) const +void JsonAssetBase::GetReferences(Array& assets, Array& files) const { if (Data == nullptr) return; @@ -219,7 +220,7 @@ void JsonAssetBase::GetReferences(Array& output) const // It produces many invalid ids (like refs to scene objects). // But it's super fast, super low-memory and doesn't involve any advanced systems integration. - FindIds(*Data, output); + FindIds(*Data, assets, files); } #endif diff --git a/Source/Engine/Content/JsonAsset.h b/Source/Engine/Content/JsonAsset.h index 8eca7f610..b974f3087 100644 --- a/Source/Engine/Content/JsonAsset.h +++ b/Source/Engine/Content/JsonAsset.h @@ -70,8 +70,8 @@ public: /// Parses Json string to find any object references inside it. It can produce list of references to assets and/or scene objects. Supported only in Editor. /// /// The Json string. - /// The output list of object IDs references by the asset (appended, not cleared). - API_FUNCTION() static void GetReferences(const StringAnsiView& json, API_PARAM(Out) Array& output); + /// The output list of object IDs references by the asset (appended, not cleared). + API_FUNCTION() static void GetReferences(const StringAnsiView& json, API_PARAM(Out) Array& assets); /// /// Saves this asset to the file. Supported only in Editor. @@ -97,7 +97,7 @@ public: const String& GetPath() const override; uint64 GetMemoryUsage() const override; #if USE_EDITOR - void GetReferences(Array& output) const override; + void GetReferences(Array& assets, Array& files) const override; #endif protected: diff --git a/Source/Engine/Graphics/Materials/MaterialParams.cpp b/Source/Engine/Graphics/Materials/MaterialParams.cpp index 1904f9565..f54d90601 100644 --- a/Source/Engine/Graphics/Materials/MaterialParams.cpp +++ b/Source/Engine/Graphics/Materials/MaterialParams.cpp @@ -1042,12 +1042,12 @@ void MaterialParams::Save(BytesContainer& data, const Array& output) const +void MaterialParams::GetReferences(Array& assets) const { for (int32 i = 0; i < Count(); i++) { if (At(i)._asAsset) - output.Add(At(i)._asAsset->GetID()); + assets.Add(At(i)._asAsset->GetID()); } } diff --git a/Source/Engine/Graphics/Materials/MaterialParams.h b/Source/Engine/Graphics/Materials/MaterialParams.h index 68326d544..2092c5c49 100644 --- a/Source/Engine/Graphics/Materials/MaterialParams.h +++ b/Source/Engine/Graphics/Materials/MaterialParams.h @@ -417,13 +417,11 @@ public: public: #if USE_EDITOR - /// /// Gets the asset references (see Asset.GetReferences for more info). /// - /// The output. - void GetReferences(Array& output) const; - + /// The output assets. + void GetReferences(Array& assets) const; #endif bool HasContentLoaded() const; diff --git a/Source/Engine/Level/Scene/Scene.cpp b/Source/Engine/Level/Scene/Scene.cpp index 0a2bdd387..eae239a8c 100644 --- a/Source/Engine/Level/Scene/Scene.cpp +++ b/Source/Engine/Level/Scene/Scene.cpp @@ -127,7 +127,8 @@ Array Scene::GetAssetReferences() const const auto asset = Content::Load(GetID()); if (asset) { - asset->GetReferences(result); + Array files; + asset->GetReferences(result, files); } else { diff --git a/Source/Engine/Particles/ParticleEmitter.h b/Source/Engine/Particles/ParticleEmitter.h index 082396ba9..d07ffc108 100644 --- a/Source/Engine/Particles/ParticleEmitter.h +++ b/Source/Engine/Particles/ParticleEmitter.h @@ -172,12 +172,10 @@ public: public: // [BinaryAsset] #if USE_EDITOR - void GetReferences(Array& output) const override + void GetReferences(Array& assets, Array& files) const override { - // Base - BinaryAsset::GetReferences(output); - - Graph.GetReferences(output); + BinaryAsset::GetReferences(assets, files); + Graph.GetReferences(assets); } #endif diff --git a/Source/Engine/Particles/ParticleSystem.cpp b/Source/Engine/Particles/ParticleSystem.cpp index 419e8da74..4c0fcc076 100644 --- a/Source/Engine/Particles/ParticleSystem.cpp +++ b/Source/Engine/Particles/ParticleSystem.cpp @@ -181,19 +181,19 @@ void ParticleSystem::InitAsVirtual() #if USE_EDITOR -void ParticleSystem::GetReferences(Array& output) const +void ParticleSystem::GetReferences(Array& assets, Array& files) const { // Base - BinaryAsset::GetReferences(output); + BinaryAsset::GetReferences(assets, files); for (int32 i = 0; i < Emitters.Count(); i++) - output.Add(Emitters[i].GetID()); + assets.Add(Emitters[i].GetID()); for (auto i = EmittersParametersOverrides.Begin(); i.IsNotEnd(); ++i) { const auto id = (Guid)i->Value; if (id.IsValid()) - output.Add(id); + assets.Add(id); } } diff --git a/Source/Engine/Particles/ParticleSystem.h b/Source/Engine/Particles/ParticleSystem.h index 82365790f..cd472b49f 100644 --- a/Source/Engine/Particles/ParticleSystem.h +++ b/Source/Engine/Particles/ParticleSystem.h @@ -13,6 +13,7 @@ API_CLASS(NoSpawn) class FLAXENGINE_API ParticleSystem : public BinaryAsset { DECLARE_BINARY_ASSET_HEADER(ParticleSystem, 1); + public: /// /// The particle system timeline track data. @@ -173,7 +174,7 @@ public: /// Spawns the particles at the given location. /// /// The spawn position. - /// If set to true effect be be auto-destroyed after duration. + /// If set to true effect be auto-destroyed after duration. /// The spawned effect. API_FUNCTION() ParticleEffect* Spawn(const Vector3& position, bool autoDestroy = false) { @@ -185,7 +186,7 @@ public: /// /// The spawn position. /// The spawn rotation. - /// If set to true effect be be auto-destroyed after duration. + /// If set to true effect be auto-destroyed after duration. /// The spawned effect. API_FUNCTION() ParticleEffect* Spawn(const Vector3& position, const Quaternion& rotation, bool autoDestroy = false) { @@ -196,9 +197,9 @@ public: /// Spawns the particles at the given location. /// /// The spawn transform. - /// If set to true effect be be auto-destroyed after duration. + /// If set to true effect be auto-destroyed after duration. /// The spawned effect. - API_FUNCTION() ParticleEffect* Spawn(Transform transform, bool autoDestroy = false) + API_FUNCTION() ParticleEffect* Spawn(const Transform& transform, bool autoDestroy = false) { return Spawn(nullptr, transform, autoDestroy); } @@ -208,7 +209,7 @@ public: /// /// The parent actor (can be null to link it to the first loaded scene). /// The spawn position. - /// If set to true effect be be auto-destroyed after duration. + /// If set to true effect be auto-destroyed after duration. /// The spawned effect. API_FUNCTION() ParticleEffect* Spawn(Actor* parent, const Vector3& position, bool autoDestroy = false) { @@ -221,7 +222,7 @@ public: /// The parent actor (can be null to link it to the first loaded scene). /// The spawn position. /// The spawn rotation. - /// If set to true effect be be auto-destroyed after duration. + /// If set to true effect be auto-destroyed after duration. /// The spawned effect. API_FUNCTION() ParticleEffect* Spawn(Actor* parent, Vector3 position, Quaternion rotation, bool autoDestroy = false) { @@ -233,7 +234,7 @@ public: /// /// The parent actor (can be null to link it to the first loaded scene). /// The spawn transform. - /// If set to true effect be be auto-destroyed after duration. + /// If set to true effect be auto-destroyed after duration. /// The spawned effect. API_FUNCTION() ParticleEffect* Spawn(Actor* parent, const Transform& transform, bool autoDestroy = false); @@ -241,7 +242,7 @@ public: // [BinaryAsset] void InitAsVirtual() override; #if USE_EDITOR - void GetReferences(Array& output) const override; + void GetReferences(Array& assets, Array& files) const override; #endif protected: diff --git a/Source/Engine/Visject/Graph.h b/Source/Engine/Visject/Graph.h index f2a475567..c0ef06455 100644 --- a/Source/Engine/Visject/Graph.h +++ b/Source/Engine/Visject/Graph.h @@ -529,15 +529,15 @@ public: /// Gets the asset references. /// /// - /// The output collection of the asset ids referenced by this object. - virtual void GetReferences(Array& output) const + /// The output collection of the asset ids referenced by this object. + virtual void GetReferences(Array& assets) const { for (int32 i = 0; i < Parameters.Count(); i++) { const auto& p = Parameters[i]; const Guid id = (Guid)p.Value; if (id.IsValid()) - output.Add(id); + assets.Add(id); } for (int32 i = 0; i < Nodes.Count(); i++) @@ -547,7 +547,7 @@ public: { const Guid id = (Guid)n.Values[j]; if (id.IsValid()) - output.Add(id); + assets.Add(id); } } }