Don't restrict the scene viewer to loading assets from approved paths. (#18828)

The purpose of the scene viewer is to load arbitrary glTF scenes, so
it's inconvenient if they have to be moved into the Bevy assets
directory first. Thus this patch switches the scene viewer to use
`UnapprovedPathMode::Allow`.

---------

Co-authored-by: François Mockers <francois.mockers@vleue.com>
This commit is contained in:
Patrick Walton 2025-04-14 13:19:37 -07:00 committed by GitHub
parent 47f46b5bdf
commit 5e69518f10
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,6 +10,7 @@
use argh::FromArgs; use argh::FromArgs;
use bevy::{ use bevy::{
asset::UnapprovedPathMode,
core_pipeline::prepass::{DeferredPrepass, DepthPrepass}, core_pipeline::prepass::{DeferredPrepass, DepthPrepass},
pbr::DefaultOpaqueRendererMethod, pbr::DefaultOpaqueRendererMethod,
prelude::*, prelude::*,
@ -74,6 +75,8 @@ fn main() {
}) })
.set(AssetPlugin { .set(AssetPlugin {
file_path: std::env::var("CARGO_MANIFEST_DIR").unwrap_or_else(|_| ".".to_string()), file_path: std::env::var("CARGO_MANIFEST_DIR").unwrap_or_else(|_| ".".to_string()),
// Allow scenes to be loaded from anywhere on disk
unapproved_path_mode: UnapprovedPathMode::Allow,
..default() ..default()
}), }),
CameraControllerPlugin, CameraControllerPlugin,