From cc3144926b307efe618c2239701de98bd24417bb Mon Sep 17 00:00:00 2001 From: BeastLe9enD Date: Thu, 21 Mar 2024 19:13:18 +0100 Subject: [PATCH] Make `AssetAction::Ignore` not copy assets to `imported_assets` (#12605) # Objective Lets say I have the following `.meta` file: ```RON ( meta_format_version: "1.0", asset: Ignore, ) ``` When a file is inside the `assets` directory and processing is enabled, the processor will copy the file into `imported_assets` although it should be ignored and therefore not copied. ## Solution - I added a simple check that does not copy the assets if the AssetAction is `Ignore`. ## Migration Guide - The public `ProcessResult` enum now has a `ProcessResult::Ignore` variant that must be handled. --- crates/bevy_asset/src/processor/mod.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/bevy_asset/src/processor/mod.rs b/crates/bevy_asset/src/processor/mod.rs index a507ea6547..b0724e4e17 100644 --- a/crates/bevy_asset/src/processor/mod.rs +++ b/crates/bevy_asset/src/processor/mod.rs @@ -722,9 +722,7 @@ impl AssetProcessor { (meta, Some(processor)) } AssetActionMinimal::Ignore => { - let meta: Box = - Box::new(AssetMeta::<(), ()>::deserialize(&meta_bytes)?); - (meta, None) + return Ok(ProcessResult::Ignored); } }; (meta, meta_bytes, processor) @@ -1038,6 +1036,7 @@ impl AssetProcessorData { pub enum ProcessResult { Processed(ProcessedInfo), SkippedNotChanged, + Ignored, } /// The final status of processing an asset @@ -1185,6 +1184,9 @@ impl ProcessorAssetInfos { // "block until first pass finished" mode info.update_status(ProcessStatus::Processed).await; } + Ok(ProcessResult::Ignored) => { + debug!("Skipping processing (ignored) \"{:?}\"", asset_path); + } Err(ProcessError::ExtensionRequired) => { // Skip assets without extensions }