mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-11 22:50:08 +00:00
include widget type in its name in the handle property editor
This commit is contained in:
@@ -39,15 +39,17 @@ use crate::{
|
||||
math::Rect,
|
||||
pool::{ErasedHandle, Handle},
|
||||
},
|
||||
engine::Engine,
|
||||
engine::{Engine, GraphicsContext},
|
||||
fxhash::FxHashSet,
|
||||
graph::SceneGraph,
|
||||
gui::{
|
||||
brush::Brush,
|
||||
draw::{CommandTexture, Draw},
|
||||
message::{KeyCode, MessageDirection, MouseButton},
|
||||
file_browser::FileType,
|
||||
message::{KeyCode, MessageDirection, MouseButton, UiMessage},
|
||||
UiNode, UiUpdateSwitches, UserInterface, UserInterfaceResourceExtension,
|
||||
},
|
||||
renderer::ui_renderer::UiRenderInfo,
|
||||
resource::texture::{TextureKind, TextureResource, TextureResourceExtension},
|
||||
scene::SceneContainer,
|
||||
},
|
||||
@@ -64,13 +66,10 @@ use crate::{
|
||||
clipboard::Clipboard,
|
||||
commands::{graph::AddUiPrefabCommand, UiSceneContext},
|
||||
selection::UiSelection,
|
||||
utils::make_widget_name,
|
||||
},
|
||||
Message,
|
||||
};
|
||||
use fyrox::engine::GraphicsContext;
|
||||
use fyrox::gui::file_browser::FileType;
|
||||
use fyrox::gui::message::UiMessage;
|
||||
use fyrox::renderer::ui_renderer::UiRenderInfo;
|
||||
use std::{fs::File, io::Write, path::Path};
|
||||
|
||||
pub struct PreviewInstance {
|
||||
@@ -458,7 +457,7 @@ impl SceneController for UiScene {
|
||||
self.ui
|
||||
.try_get_node((*handle).into())
|
||||
.ok()
|
||||
.map(|n| n.name().to_owned()),
|
||||
.map(|n| make_widget_name(n)),
|
||||
))
|
||||
.with_destination(*view)
|
||||
.with_direction(MessageDirection::ToWidget),
|
||||
|
||||
@@ -18,25 +18,23 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
use crate::fyrox::graph::NodeWrapper;
|
||||
use crate::fyrox::{
|
||||
asset::manager::ResourceManager,
|
||||
core::{
|
||||
futures::executor::block_on, make_pretty_type_name, make_relative_path, pool::ErasedHandle,
|
||||
pool::Handle,
|
||||
},
|
||||
graph::SceneGraph,
|
||||
gui::{
|
||||
border::Border, button::Button, canvas::Canvas, check_box::CheckBox,
|
||||
file_browser::FileBrowser, grid::Grid, image::Image, inspector::Inspector,
|
||||
list_view::ListView, menu::Menu, messagebox::MessageBox, popup::Popup, screen::Screen,
|
||||
stack_panel::StackPanel, text::Text, window::Window, UiNode, UserInterface,
|
||||
UserInterfaceResourceExtension,
|
||||
},
|
||||
};
|
||||
use crate::world::SceneItemIcon;
|
||||
use crate::{
|
||||
command::{Command, CommandGroup},
|
||||
fyrox::{
|
||||
asset::manager::ResourceManager,
|
||||
core::{
|
||||
color::Color, futures::executor::block_on, make_pretty_type_name, make_relative_path,
|
||||
pool::ErasedHandle, pool::Handle,
|
||||
},
|
||||
graph::{NodeWrapper, SceneGraph},
|
||||
gui::{
|
||||
border::Border, button::Button, canvas::Canvas, check_box::CheckBox,
|
||||
file_browser::FileBrowser, grid::Grid, image::Image, inspector::Inspector,
|
||||
list_view::ListView, menu::Menu, messagebox::MessageBox, popup::Popup, screen::Screen,
|
||||
stack_panel::StackPanel, text::Text, window::Window, UiNode, UserInterface,
|
||||
UserInterfaceResourceExtension,
|
||||
},
|
||||
},
|
||||
message::MessageSender,
|
||||
scene::{commands::ChangeSelectionCommand, Selection},
|
||||
scene_item_icon,
|
||||
@@ -44,11 +42,18 @@ use crate::{
|
||||
commands::graph::{AddUiPrefabCommand, LinkWidgetsCommand, SetWidgetChildPosition},
|
||||
selection::UiSelection,
|
||||
},
|
||||
world::{item::DropAnchor, WorldViewerDataProvider},
|
||||
world::{item::DropAnchor, SceneItemIcon, WorldViewerDataProvider},
|
||||
};
|
||||
use fyrox::core::color::Color;
|
||||
use std::{borrow::Cow, path::Path, path::PathBuf};
|
||||
|
||||
pub fn make_widget_name(node: &UiNode) -> String {
|
||||
format!(
|
||||
"{} [{}]",
|
||||
node.name(),
|
||||
make_pretty_type_name(node.inner_ref().type_info_ref().type_name)
|
||||
)
|
||||
}
|
||||
|
||||
pub struct UiSceneWorldViewerDataProvider<'a> {
|
||||
pub ui: &'a mut UserInterface,
|
||||
pub path: Option<&'a Path>,
|
||||
@@ -106,13 +111,10 @@ impl WorldViewerDataProvider for UiSceneWorldViewerDataProvider<'_> {
|
||||
}
|
||||
|
||||
fn name_of(&self, node: ErasedHandle) -> Option<Cow<str>> {
|
||||
self.ui.try_get_node(node.into()).ok().map(|n| {
|
||||
Cow::Owned(format!(
|
||||
"{} [{}]",
|
||||
n.name(),
|
||||
make_pretty_type_name(n.inner_ref().type_info_ref().type_name)
|
||||
))
|
||||
})
|
||||
self.ui
|
||||
.try_get_node(node.into())
|
||||
.ok()
|
||||
.map(|n| Cow::Owned(make_widget_name(n)))
|
||||
}
|
||||
|
||||
fn is_valid_handle(&self, node: ErasedHandle) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user