diff --git a/editor/src/asset/selection.rs b/editor/src/asset/selection.rs index 71c282372..b095989e2 100644 --- a/editor/src/asset/selection.rs +++ b/editor/src/asset/selection.rs @@ -18,22 +18,21 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -use crate::command::{CommandContext, CommandTrait}; -use crate::scene::EntityInfo; use crate::{ - command::{make_command, Command, SetPropertyCommand}, + command::{make_command, Command, CommandContext, CommandTrait, SetPropertyCommand}, fyrox::{ - asset::{manager::ResourceManager, options::BaseImportOptions, ResourceData}, - core::{futures::executor::block_on, reflect::Reflect, SafeLock}, + asset::{ + manager::ResourceManager, options::BaseImportOptions, untyped::UntypedResource, + ResourceData, + }, + core::{futures::executor::block_on, log::Log, reflect::Reflect, SafeLock}, engine::Engine, gui::inspector::PropertyChanged, scene::SceneContainer, }, message::MessageSender, - scene::{controller::SceneController, SelectionContainer}, + scene::{controller::SceneController, EntityInfo, SelectionContainer}, }; -use fyrox::asset::untyped::UntypedResource; -use fyrox::core::log::Log; use std::{ cell::{RefCell, RefMut}, path::{Path, PathBuf}, @@ -297,8 +296,4 @@ impl SelectionContainer for AssetSelection { sender.do_command_group(group); } - - fn provide_docs(&self, _controller: &dyn SceneController, _engine: &Engine) -> Option { - None - } } diff --git a/editor/src/audio/mod.rs b/editor/src/audio/mod.rs index e67829e33..124f2a33a 100644 --- a/editor/src/audio/mod.rs +++ b/editor/src/audio/mod.rs @@ -163,21 +163,6 @@ impl SelectionContainer for AudioBusSelection { sender.do_command_group(group); } - - fn provide_docs(&self, controller: &dyn SceneController, engine: &Engine) -> Option { - let game_scene = controller.downcast_ref::()?; - let scene = &engine.scenes[game_scene.scene]; - self.buses.first().and_then(|h| { - scene - .graph - .sound_context - .state() - .bus_graph_ref() - .try_get_bus_ref(*h) - .ok() - .map(|bus| bus.type_info_ref().doc_comment.to_string()) - }) - } } pub struct AudioPanel { diff --git a/editor/src/interaction/navmesh/selection.rs b/editor/src/interaction/navmesh/selection.rs index 8af481c02..02f8597a3 100644 --- a/editor/src/interaction/navmesh/selection.rs +++ b/editor/src/interaction/navmesh/selection.rs @@ -111,17 +111,6 @@ impl SelectionContainer for NavmeshSelection { sender.send_command(command) } } - - fn provide_docs(&self, controller: &dyn SceneController, engine: &Engine) -> Option { - let game_scene = controller.downcast_ref::()?; - let scene = &engine.scenes[game_scene.scene]; - Some( - scene.graph[self.navmesh_node()] - .type_info_ref() - .doc_comment - .to_string(), - ) - } } impl NavmeshSelection { diff --git a/editor/src/plugins/absm/selection.rs b/editor/src/plugins/absm/selection.rs index c9bca2899..e958bde69 100644 --- a/editor/src/plugins/absm/selection.rs +++ b/editor/src/plugins/absm/selection.rs @@ -307,8 +307,4 @@ impl SelectionContainer for AbsmSelection { sender.do_command_group(group); } - - fn provide_docs(&self, _controller: &dyn SceneController, _engine: &Engine) -> Option { - None - } } diff --git a/editor/src/plugins/animation/selection.rs b/editor/src/plugins/animation/selection.rs index 6aa25a54e..16ee362ef 100644 --- a/editor/src/plugins/animation/selection.rs +++ b/editor/src/plugins/animation/selection.rs @@ -201,27 +201,6 @@ where sender.do_command_group(group); } - - fn provide_docs(&self, controller: &dyn SceneController, engine: &Engine) -> Option { - if let Some(game_scene) = controller.downcast_ref::() { - Some( - engine.scenes[game_scene.scene] - .graph - .node(ErasedHandle::from(self.animation_player).into()) - .type_info_ref() - .doc_comment - .to_string(), - ) - } else { - controller.downcast_ref::().map(|ui| { - ui.ui - .node(ErasedHandle::from(self.animation_player).into()) - .type_info_ref() - .doc_comment - .to_string() - }) - } - } } impl AnimationSelection diff --git a/editor/src/scene/mod.rs b/editor/src/scene/mod.rs index d0ff93aad..821f75c25 100644 --- a/editor/src/scene/mod.rs +++ b/editor/src/scene/mod.rs @@ -1200,8 +1200,6 @@ pub trait SelectionContainer: BaseSelectionContainer { ); fn paste_property(&mut self, path: &str, value: &dyn Reflect, sender: &MessageSender); - - fn provide_docs(&self, controller: &dyn SceneController, engine: &Engine) -> Option; } impl dyn SelectionContainer { @@ -1358,8 +1356,12 @@ impl Selection { controller: &dyn SceneController, engine: &Engine, ) -> Option { - self.0 - .as_ref() - .and_then(|c| c.provide_docs(controller, engine)) + self.0.as_ref().map(|c| { + let mut doc_comment = String::default(); + c.first_selected_entity(controller, &engine.scenes, &mut |e| { + doc_comment = e.entity.type_info_ref().doc_comment.to_string(); + }); + doc_comment + }) } } diff --git a/editor/src/ui_scene/selection.rs b/editor/src/ui_scene/selection.rs index a9b32ffbc..e91b3a0cc 100644 --- a/editor/src/ui_scene/selection.rs +++ b/editor/src/ui_scene/selection.rs @@ -118,12 +118,6 @@ impl SelectionContainer for UiSelection { sender.do_command_group(group); } - - fn provide_docs(&self, controller: &dyn SceneController, _engine: &Engine) -> Option { - let ui_scene = controller.downcast_ref::()?; - let widget = ui_scene.ui.try_get_node(*self.widgets.first()?).ok()?; - Some(widget.inner_ref().type_info_ref().doc_comment.to_string()) - } } impl UiSelection { diff --git a/editor/src/world/selection.rs b/editor/src/world/selection.rs index dfcf29426..5d41b77fd 100644 --- a/editor/src/world/selection.rs +++ b/editor/src/world/selection.rs @@ -119,13 +119,6 @@ impl SelectionContainer for GraphSelection { sender.do_command_group(group); } - - fn provide_docs(&self, controller: &dyn SceneController, engine: &Engine) -> Option { - let game_scene = controller.downcast_ref::()?; - let scene = &engine.scenes[game_scene.scene]; - let node = scene.graph.try_get(*self.nodes.first()?).ok()?; - Some(node.inner_ref().type_info_ref().doc_comment.to_string()) - } } impl PartialEq for GraphSelection {