mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-12 02:02:20 +00:00
use separate struct for args for InspectorContext::from_object func
- improves readability
This commit is contained in:
@@ -39,6 +39,7 @@ use crate::fyrox::{
|
||||
};
|
||||
use crate::plugins::inspector::editors::make_property_editors_container;
|
||||
use crate::{message::MessageSender, MSG_SYNC_FLAG};
|
||||
use fyrox::gui::inspector::InspectorContextArgs;
|
||||
use std::ffi::OsStr;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::Arc;
|
||||
@@ -127,20 +128,20 @@ impl AssetInspector {
|
||||
) {
|
||||
if let Some(import_options) = load_import_options_or_default(path, resource_manager) {
|
||||
import_options.as_reflect(&mut |reflect| {
|
||||
let context = InspectorContext::from_object(
|
||||
reflect,
|
||||
&mut ui.build_ctx(),
|
||||
Arc::new(make_property_editors_container(
|
||||
let context = InspectorContext::from_object(InspectorContextArgs {
|
||||
object: reflect,
|
||||
ctx: &mut ui.build_ctx(),
|
||||
definition_container: Arc::new(make_property_editors_container(
|
||||
sender.clone(),
|
||||
resource_manager.clone(),
|
||||
)),
|
||||
None,
|
||||
MSG_SYNC_FLAG,
|
||||
0,
|
||||
true,
|
||||
Default::default(),
|
||||
150.0,
|
||||
);
|
||||
environment: None,
|
||||
sync_flag: MSG_SYNC_FLAG,
|
||||
layer_index: 0,
|
||||
generate_property_string_values: true,
|
||||
filter: Default::default(),
|
||||
name_column_width: 150.0,
|
||||
});
|
||||
ui.send_message(InspectorMessage::context(
|
||||
self.inspector,
|
||||
MessageDirection::ToWidget,
|
||||
|
||||
+13
-10
@@ -63,6 +63,7 @@ use crate::{
|
||||
};
|
||||
use cargo_metadata::camino::Utf8Path;
|
||||
use fyrox::asset::manager::ResourceManager;
|
||||
use fyrox::gui::inspector::InspectorContextArgs;
|
||||
use std::{
|
||||
io::{BufRead, BufReader},
|
||||
path::PathBuf,
|
||||
@@ -400,17 +401,19 @@ impl ExportWindow {
|
||||
WidgetBuilder::new().with_margin(Thickness::uniform(2.0)),
|
||||
)
|
||||
.with_content({
|
||||
let context = InspectorContext::from_object(
|
||||
&export_options,
|
||||
let context = InspectorContext::from_object(InspectorContextArgs {
|
||||
object: &export_options,
|
||||
ctx,
|
||||
Arc::new(PropertyEditorDefinitionContainer::with_default_editors()),
|
||||
None,
|
||||
1,
|
||||
0,
|
||||
true,
|
||||
Default::default(),
|
||||
150.0,
|
||||
);
|
||||
definition_container: Arc::new(
|
||||
PropertyEditorDefinitionContainer::with_default_editors(),
|
||||
),
|
||||
environment: None,
|
||||
sync_flag: 1,
|
||||
layer_index: 0,
|
||||
generate_property_string_values: true,
|
||||
filter: Default::default(),
|
||||
name_column_width: 150.0,
|
||||
});
|
||||
|
||||
inspector = InspectorBuilder::new(WidgetBuilder::new())
|
||||
.with_context(context)
|
||||
|
||||
@@ -77,6 +77,7 @@ use crate::{
|
||||
MSG_SYNC_FLAG,
|
||||
};
|
||||
|
||||
use fyrox::gui::inspector::InspectorContextArgs;
|
||||
use std::sync::mpsc::channel;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -639,17 +640,17 @@ impl BrushPanel {
|
||||
property_editors.insert(make_brush_target_enum_property_editor_definition());
|
||||
property_editors.insert(make_brush_shape_enum_property_editor_definition());
|
||||
|
||||
let context = InspectorContext::from_object(
|
||||
brush,
|
||||
let context = InspectorContext::from_object(InspectorContextArgs {
|
||||
object: brush,
|
||||
ctx,
|
||||
Arc::new(property_editors),
|
||||
None,
|
||||
MSG_SYNC_FLAG,
|
||||
0,
|
||||
true,
|
||||
Default::default(),
|
||||
150.0,
|
||||
);
|
||||
definition_container: Arc::new(property_editors),
|
||||
environment: None,
|
||||
sync_flag: MSG_SYNC_FLAG,
|
||||
layer_index: 0,
|
||||
generate_property_string_values: true,
|
||||
filter: Default::default(),
|
||||
name_column_width: 150.0,
|
||||
});
|
||||
|
||||
let inspector;
|
||||
let window = WindowBuilder::new(WidgetBuilder::new().with_width(300.0).with_height(250.0))
|
||||
|
||||
+11
-10
@@ -40,6 +40,7 @@ use crate::fyrox::{
|
||||
};
|
||||
use crate::plugins::inspector::editors::make_property_editors_container;
|
||||
use crate::{message::MessageSender, scene::GameScene, Engine, MSG_SYNC_FLAG};
|
||||
use fyrox::gui::inspector::InspectorContextArgs;
|
||||
use std::{
|
||||
path::PathBuf,
|
||||
sync::mpsc::{Receiver, Sender},
|
||||
@@ -244,17 +245,17 @@ impl LightPanel {
|
||||
inspector = InspectorBuilder::new(
|
||||
WidgetBuilder::new().with_margin(Thickness::uniform(1.0)),
|
||||
)
|
||||
.with_context(InspectorContext::from_object(
|
||||
&settings,
|
||||
.with_context(InspectorContext::from_object(InspectorContextArgs {
|
||||
object: &settings,
|
||||
ctx,
|
||||
container,
|
||||
None,
|
||||
MSG_SYNC_FLAG,
|
||||
0,
|
||||
true,
|
||||
Default::default(),
|
||||
150.0,
|
||||
))
|
||||
definition_container: container,
|
||||
environment: None,
|
||||
sync_flag: MSG_SYNC_FLAG,
|
||||
layer_index: 0,
|
||||
generate_property_string_values: true,
|
||||
filter: Default::default(),
|
||||
name_column_width: 150.0,
|
||||
}))
|
||||
.build(ctx);
|
||||
inspector
|
||||
})
|
||||
|
||||
@@ -45,6 +45,7 @@ use crate::{
|
||||
command::make_command, message::MessageSender, Message, MessageDirection, MSG_SYNC_FLAG,
|
||||
};
|
||||
use fyrox::asset::manager::ResourceManager;
|
||||
use fyrox::gui::inspector::InspectorContextArgs;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct ParameterPanel {
|
||||
@@ -94,17 +95,17 @@ impl ParameterPanel {
|
||||
) {
|
||||
let inspector_context = parameters
|
||||
.map(|parameters| {
|
||||
InspectorContext::from_object(
|
||||
parameters,
|
||||
&mut ui.build_ctx(),
|
||||
self.property_editors.clone(),
|
||||
None,
|
||||
MSG_SYNC_FLAG,
|
||||
0,
|
||||
true,
|
||||
Default::default(),
|
||||
150.0,
|
||||
)
|
||||
InspectorContext::from_object(InspectorContextArgs {
|
||||
object: parameters,
|
||||
ctx: &mut ui.build_ctx(),
|
||||
definition_container: self.property_editors.clone(),
|
||||
environment: None,
|
||||
sync_flag: MSG_SYNC_FLAG,
|
||||
layer_index: 0,
|
||||
generate_property_string_values: true,
|
||||
filter: Default::default(),
|
||||
name_column_width: 150.0,
|
||||
})
|
||||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ use crate::{
|
||||
DropdownListBuilder, MSG_SYNC_FLAG,
|
||||
};
|
||||
|
||||
use fyrox::gui::inspector::InspectorContextArgs;
|
||||
use fyrox::gui::utils::make_dropdown_list_option;
|
||||
use std::{
|
||||
any::TypeId,
|
||||
@@ -246,8 +247,8 @@ impl ScriptPropertyEditorBuilder {
|
||||
ctx: &mut BuildContext,
|
||||
) -> Handle<UiNode> {
|
||||
let context = script.as_ref().map(|script| {
|
||||
InspectorContext::from_object(
|
||||
script,
|
||||
InspectorContext::from_object(InspectorContextArgs {
|
||||
object: script,
|
||||
ctx,
|
||||
definition_container,
|
||||
environment,
|
||||
@@ -256,7 +257,7 @@ impl ScriptPropertyEditorBuilder {
|
||||
generate_property_string_values,
|
||||
filter,
|
||||
name_column_width,
|
||||
)
|
||||
})
|
||||
});
|
||||
|
||||
let inspector = InspectorBuilder::new(WidgetBuilder::new())
|
||||
@@ -473,17 +474,17 @@ impl PropertyEditorDefinition for ScriptPropertyEditorDefinition {
|
||||
let context = value
|
||||
.as_ref()
|
||||
.map(|script| {
|
||||
InspectorContext::from_object(
|
||||
script,
|
||||
&mut ctx.ui.build_ctx(),
|
||||
ctx.definition_container.clone(),
|
||||
ctx.environment.clone(),
|
||||
ctx.sync_flag,
|
||||
ctx.layer_index + 1,
|
||||
ctx.generate_property_string_values,
|
||||
ctx.filter,
|
||||
ctx.name_column_width,
|
||||
)
|
||||
InspectorContext::from_object(InspectorContextArgs {
|
||||
object: script,
|
||||
ctx: &mut ctx.ui.build_ctx(),
|
||||
definition_container: ctx.definition_container.clone(),
|
||||
environment: ctx.environment.clone(),
|
||||
sync_flag: ctx.sync_flag,
|
||||
layer_index: ctx.layer_index + 1,
|
||||
generate_property_string_values: ctx.generate_property_string_values,
|
||||
filter: ctx.filter,
|
||||
name_column_width: ctx.name_column_width,
|
||||
})
|
||||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ use crate::{
|
||||
utils::window_content,
|
||||
Editor, Message, WidgetMessage, WrapMode, MSG_SYNC_FLAG,
|
||||
};
|
||||
use fyrox::gui::inspector::InspectorContextArgs;
|
||||
use fyrox::gui::stack_panel::StackPanelBuilder;
|
||||
use fyrox::gui::style::resource::StyleResourceExt;
|
||||
use fyrox::gui::style::Style;
|
||||
@@ -301,17 +302,17 @@ impl InspectorPlugin {
|
||||
sender: sender.clone(),
|
||||
});
|
||||
|
||||
let context = InspectorContext::from_object(
|
||||
obj,
|
||||
&mut ui.build_ctx(),
|
||||
self.property_editors.clone(),
|
||||
Some(environment),
|
||||
MSG_SYNC_FLAG,
|
||||
0,
|
||||
true,
|
||||
Default::default(),
|
||||
150.0,
|
||||
);
|
||||
let context = InspectorContext::from_object(InspectorContextArgs {
|
||||
object: obj,
|
||||
ctx: &mut ui.build_ctx(),
|
||||
definition_container: self.property_editors.clone(),
|
||||
environment: Some(environment),
|
||||
sync_flag: MSG_SYNC_FLAG,
|
||||
layer_index: 0,
|
||||
generate_property_string_values: true,
|
||||
filter: Default::default(),
|
||||
name_column_width: 150.0,
|
||||
});
|
||||
|
||||
ui.send_message(InspectorMessage::context(
|
||||
self.inspector,
|
||||
|
||||
@@ -66,6 +66,7 @@ use crate::{
|
||||
Editor, MSG_SYNC_FLAG,
|
||||
};
|
||||
use fyrox::asset::manager::ResourceManager;
|
||||
use fyrox::gui::inspector::InspectorContextArgs;
|
||||
use std::{ops::Range, sync::Arc};
|
||||
|
||||
#[derive(Reflect, Debug)]
|
||||
@@ -1053,17 +1054,17 @@ impl RagdollWizard {
|
||||
inspector = InspectorBuilder::new(
|
||||
WidgetBuilder::new().with_margin(Thickness::uniform(1.0)),
|
||||
)
|
||||
.with_context(InspectorContext::from_object(
|
||||
&preset,
|
||||
.with_context(InspectorContext::from_object(InspectorContextArgs {
|
||||
object: &preset,
|
||||
ctx,
|
||||
container,
|
||||
None,
|
||||
MSG_SYNC_FLAG,
|
||||
0,
|
||||
true,
|
||||
Default::default(),
|
||||
150.0,
|
||||
))
|
||||
definition_container: container,
|
||||
environment: None,
|
||||
sync_flag: MSG_SYNC_FLAG,
|
||||
layer_index: 0,
|
||||
generate_property_string_values: true,
|
||||
filter: Default::default(),
|
||||
name_column_width: 150.0,
|
||||
}))
|
||||
.build(ctx);
|
||||
inspector
|
||||
})
|
||||
|
||||
@@ -69,6 +69,7 @@ use crate::{
|
||||
Editor, MSG_SYNC_FLAG,
|
||||
};
|
||||
use fyrox::asset::manager::ResourceManager;
|
||||
use fyrox::gui::inspector::InspectorContextArgs;
|
||||
use fyrox_build_tools::{BuildProfile, CommandDescriptor, EnvironmentVariable};
|
||||
use rust_fuzzy_search::fuzzy_compare;
|
||||
use std::sync::Arc;
|
||||
@@ -256,17 +257,17 @@ impl SettingsWindow {
|
||||
resource_manager: ResourceManager,
|
||||
) {
|
||||
let ctx = &mut ui.build_ctx();
|
||||
let context = InspectorContext::from_object(
|
||||
&**settings,
|
||||
let context = InspectorContext::from_object(InspectorContextArgs {
|
||||
object: &**settings,
|
||||
ctx,
|
||||
make_property_editors_container(sender.clone(), resource_manager),
|
||||
None,
|
||||
MSG_SYNC_FLAG,
|
||||
0,
|
||||
true,
|
||||
Default::default(),
|
||||
150.0,
|
||||
);
|
||||
definition_container: make_property_editors_container(sender.clone(), resource_manager),
|
||||
environment: None,
|
||||
sync_flag: MSG_SYNC_FLAG,
|
||||
layer_index: 0,
|
||||
generate_property_string_values: true,
|
||||
filter: Default::default(),
|
||||
name_column_width: 150.0,
|
||||
});
|
||||
let groups =
|
||||
context
|
||||
.entries
|
||||
|
||||
@@ -53,6 +53,7 @@ use crate::{
|
||||
GameScene, Message, MessageDirection, MSG_SYNC_FLAG,
|
||||
};
|
||||
use fyrox::asset::manager::ResourceManager;
|
||||
use fyrox::gui::inspector::InspectorContextArgs;
|
||||
use fyrox::{graph::SceneGraph, gui::window::Window};
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -128,15 +129,15 @@ impl SceneSettingsWindow {
|
||||
|
||||
let scene = &engine.scenes[game_scene.scene];
|
||||
|
||||
let context = InspectorContext::from_object(
|
||||
scene,
|
||||
&mut ui.build_ctx(),
|
||||
self.property_definitions.clone(),
|
||||
None,
|
||||
MSG_SYNC_FLAG,
|
||||
0,
|
||||
false,
|
||||
PropertyFilter::new(|property| {
|
||||
let context = InspectorContext::from_object(InspectorContextArgs {
|
||||
object: scene,
|
||||
ctx: &mut ui.build_ctx(),
|
||||
definition_container: self.property_definitions.clone(),
|
||||
environment: None,
|
||||
sync_flag: MSG_SYNC_FLAG,
|
||||
layer_index: 0,
|
||||
generate_property_string_values: false,
|
||||
filter: PropertyFilter::new(|property| {
|
||||
let mut pass = true;
|
||||
|
||||
property.downcast_ref::<NodePool>(&mut |v| {
|
||||
@@ -159,8 +160,8 @@ impl SceneSettingsWindow {
|
||||
|
||||
pass
|
||||
}),
|
||||
150.0,
|
||||
);
|
||||
name_column_width: 150.0,
|
||||
});
|
||||
|
||||
ui.send_message(InspectorMessage::context(
|
||||
self.inspector,
|
||||
|
||||
@@ -48,6 +48,7 @@ use crate::{
|
||||
VerticalAlignment,
|
||||
};
|
||||
|
||||
use crate::inspector::InspectorContextArgs;
|
||||
use fyrox_core::ComponentProvider;
|
||||
use fyrox_graph::BaseSceneGraph;
|
||||
use std::{
|
||||
@@ -170,17 +171,17 @@ impl<T: InspectableEnum> Control for EnumPropertyEditor<T> {
|
||||
{
|
||||
let variant = (self.definition.variant_generator)(*variant);
|
||||
|
||||
let ctx = InspectorContext::from_object(
|
||||
&variant,
|
||||
&mut ui.build_ctx(),
|
||||
self.definition_container.clone(),
|
||||
self.environment.clone(),
|
||||
self.sync_flag,
|
||||
self.layer_index,
|
||||
self.generate_property_string_values,
|
||||
self.filter.clone(),
|
||||
self.name_column_width,
|
||||
);
|
||||
let ctx = InspectorContext::from_object(InspectorContextArgs {
|
||||
object: &variant,
|
||||
ctx: &mut ui.build_ctx(),
|
||||
definition_container: self.definition_container.clone(),
|
||||
environment: self.environment.clone(),
|
||||
sync_flag: self.sync_flag,
|
||||
layer_index: self.layer_index,
|
||||
generate_property_string_values: self.generate_property_string_values,
|
||||
filter: self.filter.clone(),
|
||||
name_column_width: self.name_column_width,
|
||||
});
|
||||
|
||||
ui.send_message(InspectorMessage::context(
|
||||
self.inspector,
|
||||
@@ -300,17 +301,17 @@ impl EnumPropertyEditorBuilder {
|
||||
.definition_container
|
||||
.unwrap_or_else(|| Arc::new(PropertyEditorDefinitionContainer::with_default_editors()));
|
||||
|
||||
let context = InspectorContext::from_object(
|
||||
value,
|
||||
let context = InspectorContext::from_object(InspectorContextArgs {
|
||||
object: value,
|
||||
ctx,
|
||||
definition_container.clone(),
|
||||
self.environment.clone(),
|
||||
self.sync_flag,
|
||||
self.layer_index,
|
||||
self.generate_property_string_values,
|
||||
self.filter.clone(),
|
||||
definition_container: definition_container.clone(),
|
||||
environment: self.environment.clone(),
|
||||
sync_flag: self.sync_flag,
|
||||
layer_index: self.layer_index,
|
||||
generate_property_string_values: self.generate_property_string_values,
|
||||
filter: self.filter.clone(),
|
||||
name_column_width,
|
||||
);
|
||||
});
|
||||
|
||||
let inspector = InspectorBuilder::new(WidgetBuilder::new())
|
||||
.with_context(context)
|
||||
@@ -507,17 +508,17 @@ where
|
||||
|
||||
let inspector = instance_ref.inspector;
|
||||
|
||||
let context = InspectorContext::from_object(
|
||||
value,
|
||||
&mut ctx.ui.build_ctx(),
|
||||
ctx.definition_container.clone(),
|
||||
let context = InspectorContext::from_object(InspectorContextArgs {
|
||||
object: value,
|
||||
ctx: &mut ctx.ui.build_ctx(),
|
||||
definition_container: ctx.definition_container.clone(),
|
||||
environment,
|
||||
ctx.sync_flag,
|
||||
ctx.layer_index + 1,
|
||||
ctx.generate_property_string_values,
|
||||
ctx.filter,
|
||||
ctx.name_column_width,
|
||||
);
|
||||
sync_flag: ctx.sync_flag,
|
||||
layer_index: ctx.layer_index + 1,
|
||||
generate_property_string_values: ctx.generate_property_string_values,
|
||||
filter: ctx.filter,
|
||||
name_column_width: ctx.name_column_width,
|
||||
});
|
||||
|
||||
Ok(Some(InspectorMessage::context(
|
||||
inspector,
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
//! A general-purpose property editor definition that creates
|
||||
//! a nested inspector within an [Expander](crate::expander::Expander) widget.
|
||||
use crate::inspector::InspectorContextArgs;
|
||||
use crate::{
|
||||
core::reflect::prelude::*,
|
||||
inspector::{
|
||||
@@ -88,17 +89,17 @@ where
|
||||
) -> Result<PropertyEditorInstance, InspectorError> {
|
||||
let value = ctx.property_info.cast_value::<T>()?;
|
||||
|
||||
let inspector_context = InspectorContext::from_object(
|
||||
value,
|
||||
ctx.build_context,
|
||||
ctx.definition_container.clone(),
|
||||
ctx.environment.clone(),
|
||||
ctx.sync_flag,
|
||||
ctx.layer_index + 1,
|
||||
ctx.generate_property_string_values,
|
||||
ctx.filter,
|
||||
ctx.name_column_width,
|
||||
);
|
||||
let inspector_context = InspectorContext::from_object(InspectorContextArgs {
|
||||
object: value,
|
||||
ctx: ctx.build_context,
|
||||
definition_container: ctx.definition_container.clone(),
|
||||
environment: ctx.environment.clone(),
|
||||
sync_flag: ctx.sync_flag,
|
||||
layer_index: ctx.layer_index + 1,
|
||||
generate_property_string_values: ctx.generate_property_string_values,
|
||||
filter: ctx.filter,
|
||||
name_column_width: ctx.name_column_width,
|
||||
});
|
||||
|
||||
let editor;
|
||||
let container = make_expander_container(
|
||||
|
||||
@@ -422,6 +422,7 @@ pub trait InspectorEnvironment: Any + Send + Sync {
|
||||
/// # use std::sync::Arc;
|
||||
/// # use strum_macros::{AsRefStr, EnumString, VariantNames};
|
||||
/// # use fyrox_core::uuid_provider;
|
||||
/// # use fyrox_ui::inspector::InspectorContextArgs;
|
||||
///
|
||||
/// #[derive(Reflect, Debug, Clone)]
|
||||
/// struct MyObject {
|
||||
@@ -460,17 +461,17 @@ pub trait InspectorEnvironment: Any + Send + Sync {
|
||||
///
|
||||
/// // Generate a new inspector context - its visual representation, that will be used
|
||||
/// // by the inspector.
|
||||
/// let context = InspectorContext::from_object(
|
||||
/// &my_object,
|
||||
/// let context = InspectorContext::from_object(InspectorContextArgs{
|
||||
/// object: &my_object,
|
||||
/// ctx,
|
||||
/// Arc::new(definition_container),
|
||||
/// None,
|
||||
/// 1,
|
||||
/// 0,
|
||||
/// true,
|
||||
/// Default::default(),
|
||||
/// 150.0
|
||||
/// );
|
||||
/// definition_container: Arc::new(definition_container),
|
||||
/// environment: None,
|
||||
/// sync_flag: 1,
|
||||
/// layer_index: 0,
|
||||
/// generate_property_string_values: true,
|
||||
/// filter: Default::default(),
|
||||
/// name_column_width: 150.0
|
||||
/// });
|
||||
///
|
||||
/// InspectorBuilder::new(WidgetBuilder::new())
|
||||
/// .with_context(context)
|
||||
@@ -814,6 +815,18 @@ fn assign_tab_indices(container: Handle<UiNode>, ui: &mut UserInterface) {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct InspectorContextArgs<'a, 'b, 'c> {
|
||||
pub object: &'a dyn Reflect,
|
||||
pub ctx: &'b mut BuildContext<'c>,
|
||||
pub definition_container: Arc<PropertyEditorDefinitionContainer>,
|
||||
pub environment: Option<Arc<dyn InspectorEnvironment>>,
|
||||
pub sync_flag: u64,
|
||||
pub layer_index: usize,
|
||||
pub generate_property_string_values: bool,
|
||||
pub filter: PropertyFilter,
|
||||
pub name_column_width: f32,
|
||||
}
|
||||
|
||||
impl InspectorContext {
|
||||
/// Build the widgets for an Inspector to represent the given object by accessing
|
||||
/// the object's fields through reflection.
|
||||
@@ -831,17 +844,19 @@ impl InspectorContext {
|
||||
/// * generate_property_string_values: Should we use `format!("{:?}", field)` to construct string representations
|
||||
/// for each property?
|
||||
/// * filter: A filter function that controls whether each field will be included in the inspector.
|
||||
pub fn from_object(
|
||||
object: &dyn Reflect,
|
||||
ctx: &mut BuildContext,
|
||||
definition_container: Arc<PropertyEditorDefinitionContainer>,
|
||||
environment: Option<Arc<dyn InspectorEnvironment>>,
|
||||
sync_flag: u64,
|
||||
layer_index: usize,
|
||||
generate_property_string_values: bool,
|
||||
filter: PropertyFilter,
|
||||
name_column_width: f32,
|
||||
) -> Self {
|
||||
pub fn from_object(context: InspectorContextArgs) -> Self {
|
||||
let InspectorContextArgs {
|
||||
object,
|
||||
ctx,
|
||||
definition_container,
|
||||
environment,
|
||||
sync_flag,
|
||||
layer_index,
|
||||
generate_property_string_values,
|
||||
filter,
|
||||
name_column_width,
|
||||
} = context;
|
||||
|
||||
let mut entries = Vec::new();
|
||||
|
||||
let mut editors = Vec::new();
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
// SOFTWARE.
|
||||
|
||||
use directories::ProjectDirs;
|
||||
use fyrox::gui::inspector::InspectorContextArgs;
|
||||
use fyrox::{
|
||||
core::{log::Log, pool::Handle, reflect::prelude::*},
|
||||
fxhash::FxHashSet,
|
||||
@@ -222,17 +223,17 @@ impl SettingsWindow {
|
||||
.insert(VecCollectionPropertyEditorDefinition::<EnvironmentVariable>::new());
|
||||
property_editors.insert(InspectablePropertyEditorDefinition::<EnvironmentVariable>::new());
|
||||
let property_editors = Arc::new(property_editors);
|
||||
let context = InspectorContext::from_object(
|
||||
settings.deref(),
|
||||
let context = InspectorContext::from_object(InspectorContextArgs {
|
||||
object: settings.deref(),
|
||||
ctx,
|
||||
property_editors,
|
||||
None,
|
||||
1,
|
||||
0,
|
||||
true,
|
||||
Default::default(),
|
||||
170.0,
|
||||
);
|
||||
definition_container: property_editors,
|
||||
environment: None,
|
||||
sync_flag: 1,
|
||||
layer_index: 0,
|
||||
generate_property_string_values: true,
|
||||
filter: Default::default(),
|
||||
name_column_width: 170.0,
|
||||
});
|
||||
let inspector = InspectorBuilder::new(WidgetBuilder::new())
|
||||
.with_context(context)
|
||||
.build(ctx);
|
||||
|
||||
Reference in New Issue
Block a user