diff --git a/crates/core/src/modal.rs b/crates/core/src/modal.rs index 8336788b..36944100 100644 --- a/crates/core/src/modal.rs +++ b/crates/core/src/modal.rs @@ -25,12 +25,7 @@ /// A basic trait describing a modal that edits some value. pub trait Modal: Sized { /// The output type for this modal. - type Data<'m> - where - Self: 'm; - type ResetData<'m> - where - Self: 'm; + type Data<'m>; /// Return a widget that displays a button for this modal. fn button<'m>( @@ -39,5 +34,5 @@ pub trait Modal: Sized { update_state: &'m mut crate::UpdateState<'_>, ) -> impl egui::Widget + 'm; // woah rpitit (so cool) - fn reset(&mut self, update_state: &mut crate::UpdateState<'_>, data: Self::ResetData<'_>); + fn reset(&mut self, update_state: &mut crate::UpdateState<'_>, data: Self::Data<'_>); } diff --git a/crates/modals/src/database_modal/mod.rs b/crates/modals/src/database_modal/mod.rs index c940f580..4ed09075 100644 --- a/crates/modals/src/database_modal/mod.rs +++ b/crates/modals/src/database_modal/mod.rs @@ -81,10 +81,9 @@ where impl luminol_core::Modal for Modal where - M: DatabaseModalHandler + 'static, + M: DatabaseModalHandler, { type Data<'m> = &'m mut usize; - type ResetData<'m> = &'m usize; fn button<'m>( &'m mut self, @@ -114,11 +113,7 @@ where } } - fn reset( - &mut self, - _update_state: &mut luminol_core::UpdateState<'_>, - _data: Self::ResetData<'_>, - ) { + fn reset(&mut self, _update_state: &mut luminol_core::UpdateState<'_>, _data: Self::Data<'_>) { // not much internal state, so we dont need to do much here self.state = State::Closed; } diff --git a/crates/modals/src/event_graphic_picker.rs b/crates/modals/src/event_graphic_picker.rs index eebdef32..3a722280 100644 --- a/crates/modals/src/event_graphic_picker.rs +++ b/crates/modals/src/event_graphic_picker.rs @@ -114,7 +114,6 @@ impl Modal { impl luminol_core::Modal for Modal { type Data<'m> = &'m mut luminol_data::rpg::Graphic; - type ResetData<'m> = &'m luminol_data::rpg::Graphic; fn button<'m>( &'m mut self, @@ -222,7 +221,7 @@ impl luminol_core::Modal for Modal { } } - fn reset(&mut self, update_state: &mut UpdateState<'_>, data: Self::ResetData<'_>) { + fn reset(&mut self, update_state: &mut UpdateState<'_>, data: Self::Data<'_>) { self.update_graphic(update_state, data); // we need to update the button sprite to prevent desyncs self.state = State::Closed; } diff --git a/crates/modals/src/graphic_picker/mod.rs b/crates/modals/src/graphic_picker/mod.rs index 352ead29..c9019813 100644 --- a/crates/modals/src/graphic_picker/mod.rs +++ b/crates/modals/src/graphic_picker/mod.rs @@ -111,7 +111,6 @@ impl Modal { impl luminol_core::Modal for Modal { type Data<'m> = &'m mut Option; - type ResetData<'m> = &'m Option; fn button<'m>( &'m mut self, @@ -195,11 +194,7 @@ impl luminol_core::Modal for Modal { } } - fn reset( - &mut self, - update_state: &mut luminol_core::UpdateState<'_>, - data: Self::ResetData<'_>, - ) { + fn reset(&mut self, update_state: &mut luminol_core::UpdateState<'_>, data: Self::Data<'_>) { self.update_graphic(update_state, data); // we need to update the button sprite to prevent desyncs self.state = State::Closed; } diff --git a/crates/modals/src/sound_picker.rs b/crates/modals/src/sound_picker.rs index 6d00a1fc..64e7946f 100644 --- a/crates/modals/src/sound_picker.rs +++ b/crates/modals/src/sound_picker.rs @@ -46,7 +46,6 @@ impl Modal { impl luminol_core::Modal for Modal { type Data<'m> = &'m mut luminol_data::rpg::AudioFile; - type ResetData<'m> = &'m luminol_data::rpg::AudioFile; fn button<'m>( &'m mut self, @@ -78,7 +77,7 @@ impl luminol_core::Modal for Modal { } } - fn reset(&mut self, _: &mut luminol_core::UpdateState<'_>, _data: Self::ResetData<'_>) { + fn reset(&mut self, _: &mut luminol_core::UpdateState<'_>, _data: Self::Data<'_>) { // we don't need to do much here self.state = State::Closed; } diff --git a/crates/ui/src/windows/event_edit.rs b/crates/ui/src/windows/event_edit.rs index 63512983..b74fc43a 100644 --- a/crates/ui/src/windows/event_edit.rs +++ b/crates/ui/src/windows/event_edit.rs @@ -131,7 +131,7 @@ impl luminol_core::Window for Window { let page = &mut self.event.pages[self.selected_page]; if self.selected_page != previous_page { // reset the modal if we've changed pages - self.graphic_modal.reset(update_state, &&mut page.graphic); + self.graphic_modal.reset(update_state, &mut page.graphic); } egui::SidePanel::left(id_source.with("side_panel")).show_inside(ui, |ui| { diff --git a/crates/ui/src/windows/items.rs b/crates/ui/src/windows/items.rs index 28f3ad89..f2f7ef47 100644 --- a/crates/ui/src/windows/items.rs +++ b/crates/ui/src/windows/items.rs @@ -120,8 +120,7 @@ impl luminol_core::Window for Window { .changed(); if self.previous_item != Some(item.id) { // avoid desyncs by resetting the modal if the item has changed - self.graphic_picker - .reset(update_state, &&mut item.icon_name); + self.graphic_picker.reset(update_state, &mut item.icon_name); } modified |= ui @@ -216,7 +215,7 @@ impl luminol_core::Window for Window { .changed(); if self.previous_item != Some(item.id) { // reset the modal if the item has changed (this is practically a no-op) - self.menu_se_picker.reset(update_state, &item.menu_se); + self.menu_se_picker.reset(update_state, &mut item.menu_se); } modified |= columns[1]