@@ -9,20 +9,14 @@ use bevy::{
99} ;
1010use std:: path:: Path ;
1111
12- #[ derive( Resource ) ]
13- struct SketchNeedsReload ( bool ) ;
14-
1512/// Plugin that registers the Sketch asset type and its loader.
1613pub struct LivecodePlugin ;
1714
1815impl Plugin for LivecodePlugin {
1916 fn build ( & self , app : & mut App ) {
2017 app. init_asset :: < Sketch > ( )
2118 . init_asset_loader :: < SketchLoader > ( )
22- // TODO: this could be switched to Message
23- . insert_resource ( SketchNeedsReload ( false ) )
2419 . add_systems ( PreStartup , load_current_sketch) ;
25- // .add_systems(Update, sketch_update_handler);
2620 }
2721}
2822
@@ -33,35 +27,21 @@ pub fn sketch_update_handler(
3327) -> Option < Sketch > {
3428 for event in events. read ( ) {
3529 match event {
36- AssetEvent :: Added { id } => {
37- info ! ( "Added: {id}" )
38- }
3930 AssetEvent :: Modified { id } => {
4031 info ! ( "Modified: {id}" ) ;
41- // we want to emit some event to bevy??
42- // needs_reload.0 = true;
4332 if let Some ( sketch) = sketches. get ( * id) {
4433 let sketch = sketch. clone ( ) ;
4534 return Some ( sketch) ;
4635 }
4736 }
48- AssetEvent :: Removed { id } => {
49- info ! ( "Removed: {id}" )
50- }
51- AssetEvent :: Unused { id } => {
52- info ! ( "Unused: {id}" )
53- }
54- AssetEvent :: LoadedWithDependencies { id } => {
55- info ! ( "LoadedWithDependencies: {id}" )
56- }
37+ _ => ( ) ,
5738 }
5839 }
5940
6041 None
6142}
6243
6344fn load_current_sketch ( mut commands : Commands , asset_server : Res < AssetServer > ) {
64- info ! ( "DEBUG: calling load_current_sketch" ) ;
6545 let path = Path :: new ( "rectangle.py" ) ;
6646 let source = AssetSourceId :: from ( "sketch_directory" ) ;
6747 let asset_path = AssetPath :: from_path ( path) . with_source ( source) ;
0 commit comments