fixed doc provider

This commit is contained in:
Dmitry Stepanov
2026-09-20 14:36:31 +03:00
parent f05e5a96fc
commit 7eaf5defe4
8 changed files with 14 additions and 81 deletions
+7 -12
View File
@@ -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<String> {
None
}
}
-15
View File
@@ -163,21 +163,6 @@ impl SelectionContainer for AudioBusSelection {
sender.do_command_group(group);
}
fn provide_docs(&self, controller: &dyn SceneController, engine: &Engine) -> Option<String> {
let game_scene = controller.downcast_ref::<GameScene>()?;
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 {
@@ -111,17 +111,6 @@ impl SelectionContainer for NavmeshSelection {
sender.send_command(command)
}
}
fn provide_docs(&self, controller: &dyn SceneController, engine: &Engine) -> Option<String> {
let game_scene = controller.downcast_ref::<GameScene>()?;
let scene = &engine.scenes[game_scene.scene];
Some(
scene.graph[self.navmesh_node()]
.type_info_ref()
.doc_comment
.to_string(),
)
}
}
impl NavmeshSelection {
-4
View File
@@ -307,8 +307,4 @@ impl<N: Reflect> SelectionContainer for AbsmSelection<N> {
sender.do_command_group(group);
}
fn provide_docs(&self, _controller: &dyn SceneController, _engine: &Engine) -> Option<String> {
None
}
}
-21
View File
@@ -201,27 +201,6 @@ where
sender.do_command_group(group);
}
fn provide_docs(&self, controller: &dyn SceneController, engine: &Engine) -> Option<String> {
if let Some(game_scene) = controller.downcast_ref::<GameScene>() {
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::<UiScene>().map(|ui| {
ui.ui
.node(ErasedHandle::from(self.animation_player).into())
.type_info_ref()
.doc_comment
.to_string()
})
}
}
}
impl<N> AnimationSelection<N>
+7 -5
View File
@@ -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<String>;
}
impl dyn SelectionContainer {
@@ -1358,8 +1356,12 @@ impl Selection {
controller: &dyn SceneController,
engine: &Engine,
) -> Option<String> {
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
})
}
}
-6
View File
@@ -118,12 +118,6 @@ impl SelectionContainer for UiSelection {
sender.do_command_group(group);
}
fn provide_docs(&self, controller: &dyn SceneController, _engine: &Engine) -> Option<String> {
let ui_scene = controller.downcast_ref::<UiScene>()?;
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 {
-7
View File
@@ -119,13 +119,6 @@ impl SelectionContainer for GraphSelection {
sender.do_command_group(group);
}
fn provide_docs(&self, controller: &dyn SceneController, engine: &Engine) -> Option<String> {
let game_scene = controller.downcast_ref::<GameScene>()?;
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 {