File tree 4 files changed +15
-4
lines changed
4 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 5
5
rm -r assets || true
6
6
blender -b test_scenes/Cube.blend --python export.py -- --output-file=" assets/scenes/Cube.scn" --log-level=DEBUG
7
7
blender -b test_scenes/PhysicsTest.blend --python export.py -- --output-file=" assets/scenes/PhysicsTest.scn" --log-level=DEBUG
8
+ blender -b test_scenes/Heirarchy.blend --python export.py -- --output-file=" assets/scenes/Heirarchy.scn" --log-level=DEBUG
8
9
9
10
run :
10
- cargo run --example scenes
11
+ cargo run --example scenes -- scenes/PhysicsTest.scn
Original file line number Diff line number Diff line change @@ -3,6 +3,9 @@ use bevy::prelude::*;
3
3
use bevy_rapier3d:: physics:: RapierPhysicsPlugin ;
4
4
use blender_bevy_toolkit:: BlendLoadPlugin ;
5
5
6
+ use std:: env;
7
+
8
+
6
9
fn spawn_scene (
7
10
mut commands : Commands ,
8
11
asset_server : Res < AssetServer > ,
@@ -23,13 +26,20 @@ fn spawn_scene(
23
26
..Default :: default ( )
24
27
} ) ;
25
28
26
- let scene_handle: Handle < DynamicScene > = asset_server. load ( "scenes/PhysicsTest.scn" ) ;
29
+ let args: Vec < String > = env:: args ( ) . collect ( ) ;
30
+
31
+ if args. len ( ) != 2 {
32
+ println ! ( "Please specify a scene file to load. For example:\n cargo run --example scenes -- scenes/Heirarchy.scn" ) ;
33
+ std:: process:: exit ( 1 ) ;
34
+ }
35
+
36
+ println ! ( "Running scene: {}" , args[ 1 ] ) ;
37
+
38
+ let scene_handle: Handle < DynamicScene > = asset_server. load ( args[ 1 ] . as_str ( ) ) ;
27
39
scene_spawner. spawn_dynamic ( scene_handle) ;
28
40
}
29
41
30
42
fn main ( ) {
31
- println ! ( "Running example scenes" ) ;
32
-
33
43
App :: build ( )
34
44
. add_plugins ( DefaultPlugins )
35
45
. add_plugin ( RapierPhysicsPlugin )
You can’t perform that action at this time.
0 commit comments