We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fd89e9e commit c25be9fCopy full SHA for c25be9f
examples/tools/scene_viewer.rs
@@ -56,9 +56,19 @@ struct SceneHandle {
56
}
57
58
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
59
- let scene_path = std::env::args()
60
- .nth(1)
61
- .unwrap_or_else(|| "assets/models/FlightHelmet/FlightHelmet.gltf#Scene0".to_string());
+ let scene_path = std::env::args().nth(1).map_or_else(
+ || "assets/models/FlightHelmet/FlightHelmet.gltf#Scene0".to_string(),
+ |s| {
62
+ if let Some(index) = s.find("#Scene") {
63
+ if index + 6 < s.len() && s[index + 6..].chars().all(char::is_numeric) {
64
+ return s;
65
+ }
66
+ return format!("{}#Scene0", &s[..index]);
67
68
+ format!("{}#Scene0", s)
69
+ },
70
+ );
71
+ info!("Loading {}", scene_path);
72
commands.insert_resource(SceneHandle {
73
handle: asset_server.load(&scene_path),
74
instance_id: None,
0 commit comments