Skip to content

Commit 813de25

Browse files
committed
make all editor plugin methods optional
1 parent 691b517 commit 813de25

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

editor/src/plugin.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,43 @@ use fyrox::gui::message::UiMessage;
2222
/// pattern that encapsulates an action. Command pattern is used for undo/redo functionality.
2323
pub trait EditorPlugin {
2424
/// This method is called right after the editor was fully initialized. It is guaranteed to be called only once.
25-
fn on_start(&mut self, editor: &mut Editor);
25+
fn on_start(&mut self, #[allow(unused_variables)] editor: &mut Editor) {}
2626

2727
/// This method is called when the editor is about to close. It is guaranteed to be called only once.
28-
fn on_exit(&mut self, editor: &mut Editor);
28+
fn on_exit(&mut self, #[allow(unused_variables)] editor: &mut Editor) {}
2929

3030
/// This method is called either when there was some action via command, or a syncing request is performed. It should
3131
/// be used to synchronize the state of your widgets with the actual data model.
32-
fn on_sync_to_model(&mut self, editor: &mut Editor);
32+
fn on_sync_to_model(&mut self, #[allow(unused_variables)] editor: &mut Editor) {}
3333

3434
/// This method is called when the editor switches to another mode. For example, if a user clicks the "Play" button,
3535
/// the mode will be changed from [`crate::Mode::Edit`] to [`crate::Mode::Build`], and if the build was successful,
3636
/// it will then be changed to [`crate::Mode::Play`]. When the game was closed, the mode will be changed back to
3737
/// [`crate::Mode::Edit`].
38-
fn on_mode_changed(&mut self, editor: &mut Editor);
38+
fn on_mode_changed(&mut self, #[allow(unused_variables)] editor: &mut Editor) {}
3939

4040
/// This method is called when a UI message was extracted from the message queue. It should be used to react to user
4141
/// changes, for example a user could click a button, then a [`fyrox::gui::button::ButtonMessage::Click`] will be
4242
/// passed to this method. It then can be used to perform some other action.
43-
fn on_ui_message(&mut self, message: &mut UiMessage, editor: &mut Editor);
43+
fn on_ui_message(
44+
&mut self,
45+
#[allow(unused_variables)] message: &mut UiMessage,
46+
#[allow(unused_variables)] editor: &mut Editor,
47+
) {
48+
}
4449

4550
/// This method is called every frame at stable update rate of 60 FPS. It could be used to perform any contiguous
4651
/// actions.
47-
fn on_update(&mut self, editor: &mut Editor);
52+
fn on_update(&mut self, #[allow(unused_variables)] editor: &mut Editor) {}
4853

4954
/// This method is called when the editor receives a control message. It could be used to catch and react to specific
5055
/// actions in the editor (such as: scene loading, command execution, undo, redo, etc.).
51-
fn on_message(&mut self, message: &Message, editor: &mut Editor);
56+
fn on_message(
57+
&mut self,
58+
#[allow(unused_variables)] message: &Message,
59+
#[allow(unused_variables)] editor: &mut Editor,
60+
) {
61+
}
5262
}
5363

5464
#[macro_export]

0 commit comments

Comments
 (0)