File tree 4 files changed +13
-4
lines changed
4 files changed +13
-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,7 @@ use bevy::prelude::*;
3
3
use bevy_rapier3d:: physics:: { NoUserData , RapierPhysicsPlugin } ;
4
4
use bevy_rapier3d:: prelude:: * ;
5
5
use blender_bevy_toolkit:: BlendLoadPlugin ;
6
+ use std:: env;
6
7
7
8
8
9
fn spawn_scene (
@@ -25,7 +26,16 @@ fn spawn_scene(
25
26
..Default :: default ( )
26
27
} ) ;
27
28
28
- 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 ( ) ) ;
29
39
scene_spawner. spawn_dynamic ( scene_handle) ;
30
40
}
31
41
@@ -37,8 +47,6 @@ fn setup_physics(mut physics_config: ResMut<RapierConfiguration>) {
37
47
38
48
39
49
fn main ( ) {
40
- println ! ( "Running example scenes" ) ;
41
-
42
50
App :: new ( )
43
51
. add_plugins ( DefaultPlugins )
44
52
. add_plugin ( RapierPhysicsPlugin :: < NoUserData > :: default ( ) )
You can’t perform that action at this time.
0 commit comments