Skip to content

Commit

Permalink
Make AssetAction::Ignore not copy assets to imported_assets (#12605)
Browse files Browse the repository at this point in the history
# 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.
  • Loading branch information
BeastLe9enD committed Mar 21, 2024
1 parent 69e78bd commit cc31449
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions crates/bevy_asset/src/processor/mod.rs
Expand Up @@ -722,9 +722,7 @@ impl AssetProcessor {
(meta, Some(processor))
}
AssetActionMinimal::Ignore => {
let meta: Box<dyn AssetMetaDyn> =
Box::new(AssetMeta::<(), ()>::deserialize(&meta_bytes)?);
(meta, None)
return Ok(ProcessResult::Ignored);
}
};
(meta, meta_bytes, processor)
Expand Down Expand Up @@ -1038,6 +1036,7 @@ impl AssetProcessorData {
pub enum ProcessResult {
Processed(ProcessedInfo),
SkippedNotChanged,
Ignored,
}

/// The final status of processing an asset
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit cc31449

Please sign in to comment.