File tree Expand file tree Collapse file tree 1 file changed +15
-22
lines changed
crates/rmf_site_editor/src/site Expand file tree Collapse file tree 1 file changed +15
-22
lines changed Original file line number Diff line number Diff line change @@ -37,28 +37,21 @@ impl Plugin for RobotPropertiesPlugin {
3737 fn build ( & self , app : & mut App ) {
3838 // Allows us to toggle Robot as a configurable property
3939 // from the model description inspector
40- app. world_mut ( ) . register_component :: < ModelProperty < Robot > > ( ) ;
41- let component_id = app
42- . world ( )
43- . components ( )
44- . component_id :: < ModelProperty < Robot > > ( )
45- . unwrap ( ) ;
46- app. init_resource :: < ModelPropertyData > ( )
47- . world_mut ( )
48- . resource_mut :: < ModelPropertyData > ( )
49- . optional
50- . insert (
51- component_id,
52- (
53- "Robot" . to_string ( ) ,
54- |mut e_cmd| {
55- e_cmd. insert ( ModelProperty :: < Robot > :: default ( ) ) ;
56- } ,
57- |mut e_cmd| {
58- e_cmd. remove :: < ModelProperty < Robot > > ( ) ;
59- } ,
60- ) ,
61- ) ;
40+ let component_id = app. world_mut ( ) . register_component :: < ModelProperty < Robot > > ( ) ;
41+ let mut model_property_data = ModelPropertyData :: from_world ( app. world_mut ( ) ) ;
42+ model_property_data. optional . insert (
43+ component_id,
44+ (
45+ "Robot" . to_string ( ) ,
46+ |mut e_cmd| {
47+ e_cmd. insert ( ModelProperty :: < Robot > :: default ( ) ) ;
48+ } ,
49+ |mut e_cmd| {
50+ e_cmd. remove :: < ModelProperty < Robot > > ( ) ;
51+ } ,
52+ ) ,
53+ ) ;
54+ app. insert_resource ( model_property_data) ;
6255 app. add_event :: < UpdateRobotPropertyKinds > ( )
6356 . add_systems ( PreUpdate , update_model_instances :: < Robot > ) ;
6457 }
You can’t perform that action at this time.
0 commit comments