mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-12 02:02:20 +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,
|
math::Rect,
|
||||||
pool::{ErasedHandle, Handle},
|
pool::{ErasedHandle, Handle},
|
||||||
},
|
},
|
||||||
engine::Engine,
|
engine::{Engine, GraphicsContext},
|
||||||
fxhash::FxHashSet,
|
fxhash::FxHashSet,
|
||||||
graph::SceneGraph,
|
graph::SceneGraph,
|
||||||
gui::{
|
gui::{
|
||||||
brush::Brush,
|
brush::Brush,
|
||||||
draw::{CommandTexture, Draw},
|
draw::{CommandTexture, Draw},
|
||||||
message::{KeyCode, MessageDirection, MouseButton},
|
file_browser::FileType,
|
||||||
|
message::{KeyCode, MessageDirection, MouseButton, UiMessage},
|
||||||
UiNode, UiUpdateSwitches, UserInterface, UserInterfaceResourceExtension,
|
UiNode, UiUpdateSwitches, UserInterface, UserInterfaceResourceExtension,
|
||||||
},
|
},
|
||||||
|
renderer::ui_renderer::UiRenderInfo,
|
||||||
resource::texture::{TextureKind, TextureResource, TextureResourceExtension},
|
resource::texture::{TextureKind, TextureResource, TextureResourceExtension},
|
||||||
scene::SceneContainer,
|
scene::SceneContainer,
|
||||||
},
|
},
|
||||||
@@ -64,13 +66,10 @@ use crate::{
|
|||||||
clipboard::Clipboard,
|
clipboard::Clipboard,
|
||||||
commands::{graph::AddUiPrefabCommand, UiSceneContext},
|
commands::{graph::AddUiPrefabCommand, UiSceneContext},
|
||||||
selection::UiSelection,
|
selection::UiSelection,
|
||||||
|
utils::make_widget_name,
|
||||||
},
|
},
|
||||||
Message,
|
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};
|
use std::{fs::File, io::Write, path::Path};
|
||||||
|
|
||||||
pub struct PreviewInstance {
|
pub struct PreviewInstance {
|
||||||
@@ -458,7 +457,7 @@ impl SceneController for UiScene {
|
|||||||
self.ui
|
self.ui
|
||||||
.try_get_node((*handle).into())
|
.try_get_node((*handle).into())
|
||||||
.ok()
|
.ok()
|
||||||
.map(|n| n.name().to_owned()),
|
.map(|n| make_widget_name(n)),
|
||||||
))
|
))
|
||||||
.with_destination(*view)
|
.with_destination(*view)
|
||||||
.with_direction(MessageDirection::ToWidget),
|
.with_direction(MessageDirection::ToWidget),
|
||||||
|
|||||||
@@ -18,25 +18,23 @@
|
|||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
// SOFTWARE.
|
// 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::{
|
use crate::{
|
||||||
command::{Command, CommandGroup},
|
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,
|
message::MessageSender,
|
||||||
scene::{commands::ChangeSelectionCommand, Selection},
|
scene::{commands::ChangeSelectionCommand, Selection},
|
||||||
scene_item_icon,
|
scene_item_icon,
|
||||||
@@ -44,11 +42,18 @@ use crate::{
|
|||||||
commands::graph::{AddUiPrefabCommand, LinkWidgetsCommand, SetWidgetChildPosition},
|
commands::graph::{AddUiPrefabCommand, LinkWidgetsCommand, SetWidgetChildPosition},
|
||||||
selection::UiSelection,
|
selection::UiSelection,
|
||||||
},
|
},
|
||||||
world::{item::DropAnchor, WorldViewerDataProvider},
|
world::{item::DropAnchor, SceneItemIcon, WorldViewerDataProvider},
|
||||||
};
|
};
|
||||||
use fyrox::core::color::Color;
|
|
||||||
use std::{borrow::Cow, path::Path, path::PathBuf};
|
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 struct UiSceneWorldViewerDataProvider<'a> {
|
||||||
pub ui: &'a mut UserInterface,
|
pub ui: &'a mut UserInterface,
|
||||||
pub path: Option<&'a Path>,
|
pub path: Option<&'a Path>,
|
||||||
@@ -106,13 +111,10 @@ impl WorldViewerDataProvider for UiSceneWorldViewerDataProvider<'_> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn name_of(&self, node: ErasedHandle) -> Option<Cow<str>> {
|
fn name_of(&self, node: ErasedHandle) -> Option<Cow<str>> {
|
||||||
self.ui.try_get_node(node.into()).ok().map(|n| {
|
self.ui
|
||||||
Cow::Owned(format!(
|
.try_get_node(node.into())
|
||||||
"{} [{}]",
|
.ok()
|
||||||
n.name(),
|
.map(|n| Cow::Owned(make_widget_name(n)))
|
||||||
make_pretty_type_name(n.inner_ref().type_info_ref().type_name)
|
|
||||||
))
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_valid_handle(&self, node: ErasedHandle) -> bool {
|
fn is_valid_handle(&self, node: ErasedHandle) -> bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user