Fix tonemapping example when using a local image (#19061)

# Objective

- The tonemapping example allows using a local image to try out
different color grading. However, using a local file stopped working
when we added the `UnapprovedPathMode` setting to the assets plugin.

## Solution

- Set `unapproved_path_mode: UnapprovedPathMode::Allow` in the example

## Testing

- I tried out the example with local images, previously it would fail
saying it's an untrusted path.
This commit is contained in:
Marius Cobzarenco 2025-05-05 18:39:32 +01:00 committed by GitHub
parent 54856d088d
commit 20b2b5e6b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,7 @@
//! This examples compares Tonemapping options
use bevy::{
asset::UnapprovedPathMode,
core_pipeline::tonemapping::Tonemapping,
pbr::CascadeShadowConfigBuilder,
platform::collections::HashMap,
@ -19,7 +20,12 @@ const SHADER_ASSET_PATH: &str = "shaders/tonemapping_test_patterns.wgsl";
fn main() {
App::new()
.add_plugins((
DefaultPlugins,
DefaultPlugins.set(AssetPlugin {
// We enable loading assets from arbitrary filesystem paths as this example allows
// drag and dropping a local image for color grading
unapproved_path_mode: UnapprovedPathMode::Allow,
..default()
}),
MaterialPlugin::<ColorGradientMaterial>::default(),
))
.insert_resource(CameraTransform(