removed redundant trait bounds

- makes the code more compact and less verbose
This commit is contained in:
Dmitry Stepanov
2025-03-09 20:07:07 +03:00
parent d2c2bf167d
commit 092d30b45c
22 changed files with 166 additions and 177 deletions
+2 -2
View File
@@ -95,7 +95,7 @@ define_set_collection_element_command!(
);
#[derive(Debug)]
pub struct RemoveBlendSpacePointCommand<N: Reflect + Debug + 'static> {
pub struct RemoveBlendSpacePointCommand<N: Reflect> {
pub scene_node_handle: Handle<N>,
pub layer_index: usize,
pub node_handle: Handle<PoseNode<Handle<N>>>,
@@ -103,7 +103,7 @@ pub struct RemoveBlendSpacePointCommand<N: Reflect + Debug + 'static> {
pub point: Option<BlendSpacePoint<Handle<N>>>,
}
impl<N: Reflect + Debug + 'static> CommandTrait for RemoveBlendSpacePointCommand<N> {
impl<N: Reflect> CommandTrait for RemoveBlendSpacePointCommand<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Remove Blend Space Point".to_string()
}
+39 -39
View File
@@ -44,7 +44,7 @@ pub mod blend;
macro_rules! define_spawn_command {
($name:ident, $ent_type:ty, $container:ident) => {
#[derive(Debug)]
pub enum $name<N: Reflect + Debug + 'static> {
pub enum $name<N: Reflect> {
Unknown,
NonExecuted {
node_handle: Handle<N>,
@@ -64,7 +64,7 @@ macro_rules! define_spawn_command {
},
}
impl<N: Reflect + Debug + 'static> $name<N> {
impl<N: Reflect> $name<N> {
pub fn new(node_handle: Handle<N>, layer_index: usize, state: $ent_type) -> Self {
Self::NonExecuted {
node_handle,
@@ -74,7 +74,7 @@ macro_rules! define_spawn_command {
}
}
impl<N: Reflect + Debug + 'static> CommandTrait for $name<N> {
impl<N: Reflect> CommandTrait for $name<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Add State".to_string()
}
@@ -155,7 +155,7 @@ macro_rules! define_spawn_command {
define_spawn_command!(AddTransitionCommand, Transition<Handle<N>>, transitions_mut);
#[derive(Debug)]
pub enum AddStateCommand<N: Reflect + Debug + 'static> {
pub enum AddStateCommand<N: Reflect> {
Unknown,
NonExecuted {
node_handle: Handle<N>,
@@ -176,7 +176,7 @@ pub enum AddStateCommand<N: Reflect + Debug + 'static> {
},
}
impl<N: Reflect + Debug + 'static> AddStateCommand<N> {
impl<N: Reflect> AddStateCommand<N> {
pub fn new(node_handle: Handle<N>, layer_index: usize, state: State<Handle<N>>) -> Self {
Self::NonExecuted {
node_handle,
@@ -186,7 +186,7 @@ impl<N: Reflect + Debug + 'static> AddStateCommand<N> {
}
}
pub fn fetch_machine<N: Reflect + Debug + 'static>(
pub fn fetch_machine<N: Reflect>(
context: &mut dyn CommandContext,
node_handle: Handle<N>,
) -> &mut Machine<Handle<N>> {
@@ -212,7 +212,7 @@ pub fn fetch_machine<N: Reflect + Debug + 'static>(
}
}
impl<N: Reflect + Debug + 'static> CommandTrait for AddStateCommand<N> {
impl<N: Reflect> CommandTrait for AddStateCommand<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Add State".to_string()
}
@@ -316,7 +316,7 @@ impl<N: Reflect + Debug + 'static> CommandTrait for AddStateCommand<N> {
}
#[derive(Debug)]
pub enum AddPoseNodeCommand<N: Reflect + Debug + 'static> {
pub enum AddPoseNodeCommand<N: Reflect> {
Unknown,
NonExecuted {
node_handle: Handle<N>,
@@ -337,7 +337,7 @@ pub enum AddPoseNodeCommand<N: Reflect + Debug + 'static> {
},
}
impl<N: Reflect + Debug + 'static> AddPoseNodeCommand<N> {
impl<N: Reflect> AddPoseNodeCommand<N> {
pub fn new(node_handle: Handle<N>, layer_index: usize, node: PoseNode<Handle<N>>) -> Self {
Self::NonExecuted {
node_handle,
@@ -347,7 +347,7 @@ impl<N: Reflect + Debug + 'static> AddPoseNodeCommand<N> {
}
}
impl<N: Reflect + Debug + 'static> CommandTrait for AddPoseNodeCommand<N> {
impl<N: Reflect> CommandTrait for AddPoseNodeCommand<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Add Pose Node".to_string()
}
@@ -451,7 +451,7 @@ impl<N: Reflect + Debug + 'static> CommandTrait for AddPoseNodeCommand<N> {
macro_rules! define_move_command {
($name:ident, $ent_type:ty, $container:ident) => {
#[derive(Debug)]
pub struct $name<N: Reflect + Debug + 'static> {
pub struct $name<N: Reflect> {
absm_node_handle: Handle<N>,
layer_index: usize,
node: Handle<$ent_type>,
@@ -459,7 +459,7 @@ macro_rules! define_move_command {
new_position: Vector2<f32>,
}
impl<N: Reflect + Debug + 'static> $name<N> {
impl<N: Reflect> $name<N> {
pub fn new(
absm_node_handle: Handle<N>,
node: Handle<$ent_type>,
@@ -488,7 +488,7 @@ macro_rules! define_move_command {
}
}
impl<N: Reflect + Debug + 'static> CommandTrait for $name<N> {
impl<N: Reflect> CommandTrait for $name<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Move Entity".to_owned()
}
@@ -512,7 +512,7 @@ define_move_command!(MovePoseNodeCommand, PoseNode<Handle<N>>, nodes_mut);
macro_rules! define_free_command {
($name:ident, $ent_type:ty, $container:ident) => {
#[derive(Debug)]
pub enum $name<N: Reflect + Debug + 'static> {
pub enum $name<N: Reflect> {
Unknown,
NonExecuted {
node_handle: Handle<N>,
@@ -532,7 +532,7 @@ macro_rules! define_free_command {
},
}
impl<N: Reflect + Debug + 'static> $name<N> {
impl<N: Reflect> $name<N> {
pub fn new(
node_handle: Handle<N>,
layer_index: usize,
@@ -546,7 +546,7 @@ macro_rules! define_free_command {
}
}
impl<N: Reflect + Debug + 'static> CommandTrait for $name<N> {
impl<N: Reflect> CommandTrait for $name<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Free Entity".to_owned()
}
@@ -632,14 +632,14 @@ define_free_command!(
macro_rules! define_push_element_to_collection_command {
($name:ident<$model_handle:ty, $value_type:ty>($self:ident, $context:ident) $get_collection:block) => {
#[derive(Debug)]
pub struct $name<N: fyrox::core::reflect::Reflect + Debug + 'static> {
pub struct $name<N: fyrox::core::reflect::Reflect> {
pub node_handle: Handle<N>,
pub handle: $model_handle,
pub layer_index: usize,
pub value: Option<$value_type>,
}
impl<N: fyrox::core::reflect::Reflect + Debug + 'static> $name<N> {
impl<N: fyrox::core::reflect::Reflect> $name<N> {
pub fn new(node_handle: Handle<N>, handle: $model_handle, layer_index: usize, value: $value_type) -> Self {
Self {
node_handle,
@@ -650,7 +650,7 @@ macro_rules! define_push_element_to_collection_command {
}
}
impl<N: fyrox::core::reflect::Reflect + Debug + 'static> CommandTrait for $name<N> {
impl<N: fyrox::core::reflect::Reflect> CommandTrait for $name<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Push Element To Collection".to_string()
}
@@ -709,7 +709,7 @@ macro_rules! define_remove_collection_element_command {
macro_rules! define_set_collection_element_command {
($name:ident<$model_handle:ty, $value_type:ty>($self:ident, $context:ident) $swap_value:block) => {
#[derive(Debug)]
pub struct $name<N: fyrox::core::reflect::Reflect + Debug + 'static> {
pub struct $name<N: fyrox::core::reflect::Reflect> {
pub node_handle: Handle<N>,
pub handle: $model_handle,
pub layer_index: usize,
@@ -717,13 +717,13 @@ macro_rules! define_set_collection_element_command {
pub value: $value_type,
}
impl<N: fyrox::core::reflect::Reflect + Debug + 'static> $name<N> {
impl<N: fyrox::core::reflect::Reflect> $name<N> {
pub fn swap(&mut $self, $context: &mut dyn CommandContext) {
$swap_value
}
}
impl<N: fyrox::core::reflect::Reflect + Debug + 'static> CommandTrait for $name<N> {
impl<N: fyrox::core::reflect::Reflect> CommandTrait for $name<N> {
fn name(&mut self,
#[allow(unused_variables)]
$context: &dyn CommandContext
@@ -743,13 +743,13 @@ macro_rules! define_set_collection_element_command {
}
#[derive(Debug)]
pub struct SetMachineEntryStateCommand<N: Reflect + Debug + 'static> {
pub struct SetMachineEntryStateCommand<N: Reflect> {
pub node_handle: Handle<N>,
pub layer: usize,
pub entry: Handle<State<Handle<N>>>,
}
impl<N: Reflect + Debug + 'static> SetMachineEntryStateCommand<N> {
impl<N: Reflect> SetMachineEntryStateCommand<N> {
fn swap(&mut self, context: &mut dyn CommandContext) {
let machine = fetch_machine(context, self.node_handle);
let layer = &mut machine.layers_mut()[self.layer];
@@ -760,7 +760,7 @@ impl<N: Reflect + Debug + 'static> SetMachineEntryStateCommand<N> {
}
}
impl<N: Reflect + Debug + 'static> CommandTrait for SetMachineEntryStateCommand<N> {
impl<N: Reflect> CommandTrait for SetMachineEntryStateCommand<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Set Entry State".to_string()
}
@@ -778,7 +778,7 @@ impl<N: Reflect + Debug + 'static> CommandTrait for SetMachineEntryStateCommand<
macro_rules! define_absm_swap_command {
($name:ident<$model_type:ty, $value_type:ty>[$($field_name:ident:$field_type:ty),*]($self:ident, $context:ident) $get_field:block) => {
#[derive(Debug)]
pub struct $name<N:Reflect + Debug + 'static> {
pub struct $name<N:Reflect> {
pub node_handle: Handle<N>,
pub handle: $model_type,
pub value: $value_type,
@@ -787,7 +787,7 @@ macro_rules! define_absm_swap_command {
)*
}
impl<N:Reflect + Debug + 'static> $name<N> {
impl<N:Reflect> $name<N> {
fn swap(&mut $self, $context: &mut dyn CommandContext) {
let field = $get_field;
@@ -795,7 +795,7 @@ macro_rules! define_absm_swap_command {
}
}
impl<N:Reflect + Debug + 'static> CommandTrait for $name<N> {
impl<N:Reflect> CommandTrait for $name<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
stringify!($name).to_string()
}
@@ -817,13 +817,13 @@ define_absm_swap_command!(SetStateRootPoseCommand<Handle<State<Handle<N>>>, Hand
});
#[derive(Debug)]
pub struct SetLayerNameCommand<N: Reflect + Debug + 'static> {
pub struct SetLayerNameCommand<N: Reflect> {
pub absm_node_handle: Handle<N>,
pub layer_index: usize,
pub name: String,
}
impl<N: Reflect + Debug + 'static> SetLayerNameCommand<N> {
impl<N: Reflect> SetLayerNameCommand<N> {
fn swap(&mut self, context: &mut dyn CommandContext) {
let layer =
&mut fetch_machine(context, self.absm_node_handle).layers_mut()[self.layer_index];
@@ -833,7 +833,7 @@ impl<N: Reflect + Debug + 'static> SetLayerNameCommand<N> {
}
}
impl<N: Reflect + Debug + 'static> CommandTrait for SetLayerNameCommand<N> {
impl<N: Reflect> CommandTrait for SetLayerNameCommand<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Set Layer Name".to_string()
}
@@ -848,12 +848,12 @@ impl<N: Reflect + Debug + 'static> CommandTrait for SetLayerNameCommand<N> {
}
#[derive(Debug)]
pub struct AddLayerCommand<N: Reflect + Debug + 'static> {
pub struct AddLayerCommand<N: Reflect> {
pub absm_node_handle: Handle<N>,
pub layer: Option<MachineLayer<Handle<N>>>,
}
impl<N: Reflect + Debug + 'static> CommandTrait for AddLayerCommand<N> {
impl<N: Reflect> CommandTrait for AddLayerCommand<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Add Layer".to_string()
}
@@ -868,13 +868,13 @@ impl<N: Reflect + Debug + 'static> CommandTrait for AddLayerCommand<N> {
}
#[derive(Debug)]
pub struct RemoveLayerCommand<N: Reflect + Debug + 'static> {
pub struct RemoveLayerCommand<N: Reflect> {
pub absm_node_handle: Handle<N>,
pub layer_index: usize,
pub layer: Option<MachineLayer<Handle<N>>>,
}
impl<N: Reflect + Debug + 'static> RemoveLayerCommand<N> {
impl<N: Reflect> RemoveLayerCommand<N> {
pub fn new(absm_node_handle: Handle<N>, layer_index: usize) -> Self {
Self {
absm_node_handle,
@@ -884,7 +884,7 @@ impl<N: Reflect + Debug + 'static> RemoveLayerCommand<N> {
}
}
impl<N: Reflect + Debug + 'static> CommandTrait for RemoveLayerCommand<N> {
impl<N: Reflect> CommandTrait for RemoveLayerCommand<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
format!("Remove {} Layer", self.layer_index)
}
@@ -901,13 +901,13 @@ impl<N: Reflect + Debug + 'static> CommandTrait for RemoveLayerCommand<N> {
}
#[derive(Debug)]
pub struct SetLayerMaskCommand<N: Reflect + Debug + 'static> {
pub struct SetLayerMaskCommand<N: Reflect> {
pub absm_node_handle: Handle<N>,
pub layer_index: usize,
pub mask: LayerMask<Handle<N>>,
}
impl<N: Reflect + Debug + 'static> SetLayerMaskCommand<N> {
impl<N: Reflect> SetLayerMaskCommand<N> {
fn swap(&mut self, context: &mut dyn CommandContext) {
let layer =
&mut fetch_machine(context, self.absm_node_handle).layers_mut()[self.layer_index];
@@ -916,7 +916,7 @@ impl<N: Reflect + Debug + 'static> SetLayerMaskCommand<N> {
}
}
impl<N: Reflect + Debug + 'static> CommandTrait for SetLayerMaskCommand<N> {
impl<N: Reflect> CommandTrait for SetLayerMaskCommand<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Set Layer Mask".to_string()
}
+3 -3
View File
@@ -60,7 +60,7 @@ use fyrox::core::some_or_return;
use fyrox::gui::dock::DockingManagerMessage;
use fyrox::gui::menu::MenuItemMessage;
use fyrox::gui::widget::WidgetMessage;
use std::{any::Any, fmt::Debug};
use std::any::Any;
mod blendspace;
mod canvas;
@@ -77,14 +77,14 @@ mod state_viewer;
mod toolbar;
mod transition;
struct PreviewModeData<N: Reflect + 'static> {
struct PreviewModeData<N: Reflect> {
machine: Machine<Handle<N>>,
nodes: Vec<(Handle<N>, N)>,
}
fn fetch_selection<N>(editor_selection: &Selection) -> AbsmSelection<N>
where
N: Reflect + Debug,
N: Reflect,
{
if let Some(selection) = editor_selection.as_absm() {
// Some selection in an animation.
+9 -9
View File
@@ -57,7 +57,7 @@ pub struct AbsmBaseNode {
#[reflect(derived_type = "UiNode")]
pub struct AbsmNode<T>
where
T: Reflect + 'static,
T: Reflect,
{
widget: Widget,
background: Handle<UiNode>,
@@ -83,7 +83,7 @@ impl<T: Reflect> Debug for AbsmNode<T> {
impl<T> Clone for AbsmNode<T>
where
T: Reflect + 'static,
T: Reflect,
{
fn clone(&self) -> Self {
Self {
@@ -105,7 +105,7 @@ where
impl<T> Deref for AbsmNode<T>
where
T: Reflect + 'static,
T: Reflect,
{
type Target = Widget;
@@ -116,7 +116,7 @@ where
impl<T> DerefMut for AbsmNode<T>
where
T: Reflect + 'static,
T: Reflect,
{
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.widget
@@ -125,7 +125,7 @@ where
impl<T> AbsmNode<T>
where
T: Reflect + 'static,
T: Reflect,
{
fn update_colors(&self, ui: &UserInterface) {
ui.send_message(WidgetMessage::background(
@@ -163,7 +163,7 @@ impl AbsmNodeMessage {
define_constructor!(AbsmNodeMessage:Edit => fn edit(), layout: false);
}
impl<T: Reflect + 'static> TypeUuidProvider for AbsmNode<T> {
impl<T: Reflect> TypeUuidProvider for AbsmNode<T> {
fn type_uuid() -> Uuid {
uuid!("15bc1a7e-a385-46e0-a65c-7e9c014b4a1d")
}
@@ -171,7 +171,7 @@ impl<T: Reflect + 'static> TypeUuidProvider for AbsmNode<T> {
impl<T> Control for AbsmNode<T>
where
T: Reflect + 'static,
T: Reflect,
{
fn handle_routed_message(&mut self, ui: &mut UserInterface, message: &mut UiMessage) {
self.widget.handle_routed_message(ui, message);
@@ -290,7 +290,7 @@ where
pub struct AbsmNodeBuilder<T>
where
T: Reflect + 'static,
T: Reflect,
{
widget_builder: WidgetBuilder,
name: String,
@@ -306,7 +306,7 @@ where
impl<T> AbsmNodeBuilder<T>
where
T: Reflect + 'static,
T: Reflect,
{
pub fn new(widget_builder: WidgetBuilder) -> Self {
Self {
+9 -9
View File
@@ -28,7 +28,7 @@ use fyrox::core::reflect::Reflect;
use std::fmt::{Debug, Formatter};
#[derive(Eq)]
pub enum SelectedEntity<N: Reflect + 'static> {
pub enum SelectedEntity<N: Reflect> {
Transition(Handle<Transition<Handle<N>>>),
State(Handle<State<Handle<N>>>),
PoseNode(Handle<PoseNode<Handle<N>>>),
@@ -36,7 +36,7 @@ pub enum SelectedEntity<N: Reflect + 'static> {
impl<N> Debug for SelectedEntity<N>
where
N: Reflect + 'static,
N: Reflect,
{
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
@@ -49,7 +49,7 @@ where
impl<N> Clone for SelectedEntity<N>
where
N: Reflect + 'static,
N: Reflect,
{
fn clone(&self) -> Self {
match self {
@@ -62,7 +62,7 @@ where
impl<N> PartialEq for SelectedEntity<N>
where
N: Reflect + 'static,
N: Reflect,
{
fn eq(&self, other: &Self) -> bool {
match (self, other) {
@@ -75,7 +75,7 @@ where
}
#[derive(Eq, Default)]
pub struct AbsmSelection<N: Reflect + 'static> {
pub struct AbsmSelection<N: Reflect> {
pub absm_node_handle: Handle<N>,
pub layer: Option<usize>,
pub entities: Vec<SelectedEntity<N>>,
@@ -83,7 +83,7 @@ pub struct AbsmSelection<N: Reflect + 'static> {
impl<N> Debug for AbsmSelection<N>
where
N: Reflect + 'static,
N: Reflect,
{
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(
@@ -96,7 +96,7 @@ where
impl<N> Clone for AbsmSelection<N>
where
N: Reflect + 'static,
N: Reflect,
{
fn clone(&self) -> Self {
Self {
@@ -109,7 +109,7 @@ where
impl<N> PartialEq for AbsmSelection<N>
where
N: Reflect + 'static,
N: Reflect,
{
fn eq(&self, other: &Self) -> bool {
self.entities == other.entities
@@ -118,7 +118,7 @@ where
}
}
impl<N: Reflect + 'static> SelectionContainer for AbsmSelection<N> {
impl<N: Reflect> SelectionContainer for AbsmSelection<N> {
fn len(&self) -> usize {
self.entities.len()
}
@@ -51,7 +51,6 @@ use crate::{
use fyrox::core::reflect::Reflect;
use fyrox::gui::menu::ContextMenuBuilder;
use std::fmt::Debug;
pub struct CanvasContextMenu {
create_state: Handle<UiNode>,
@@ -92,7 +91,7 @@ impl CanvasContextMenu {
}
}
pub fn handle_ui_message<N: Reflect + Debug + 'static>(
pub fn handle_ui_message<N: Reflect>(
&mut self,
sender: &MessageSender,
message: &UiMessage,
@@ -216,7 +215,7 @@ impl NodeContextMenu {
}
}
pub fn handle_ui_message<N: Reflect + Debug + 'static>(
pub fn handle_ui_message<N: Reflect>(
&mut self,
message: &UiMessage,
ui: &mut UserInterface,
@@ -362,7 +361,7 @@ impl TransitionContextMenu {
}
}
pub fn handle_ui_message<N: Reflect + Debug + 'static>(
pub fn handle_ui_message<N: Reflect>(
&mut self,
message: &UiMessage,
ui: &mut UserInterface,
+4 -4
View File
@@ -70,7 +70,7 @@ fn fetch_state_node_model_handle<N>(
ui: &UserInterface,
) -> Handle<State<Handle<N>>>
where
N: Reflect + 'static,
N: Reflect,
{
ui.node(handle)
.query_component::<AbsmNode<State<Handle<N>>>>()
@@ -129,7 +129,7 @@ impl StateGraphViewer {
ui: &UserInterface,
transition: Handle<Transition<Handle<N>>>,
) where
N: Reflect + 'static,
N: Reflect,
{
if let Some(view_handle) = ui.node(self.canvas).children().iter().cloned().find(|c| {
ui.node(*c)
@@ -147,7 +147,7 @@ impl StateGraphViewer {
pub fn activate_state<N>(&self, ui: &UserInterface, state: Handle<State<Handle<N>>>)
where
N: Reflect + 'static,
N: Reflect,
{
for (state_view_handle, state_view_ref) in ui
.node(self.canvas)
@@ -498,7 +498,7 @@ impl StateGraphViewer {
.model_handle
.into()
}) {
fn find_state_view<N: Reflect + 'static>(
fn find_state_view<N: Reflect>(
state_handle: Handle<State<Handle<N>>>,
states: &[Handle<UiNode>],
ui: &UserInterface,
+4 -4
View File
@@ -78,7 +78,7 @@ pub struct StateViewer {
prev_layer: Option<usize>,
}
fn create_socket<N: Reflect + 'static>(
fn create_socket<N: Reflect>(
direction: SocketDirection,
index: usize,
show_index: bool,
@@ -93,7 +93,7 @@ fn create_socket<N: Reflect + 'static>(
.build(&mut ui.build_ctx())
}
fn create_sockets<N: Reflect + 'static>(
fn create_sockets<N: Reflect>(
count: usize,
direction: SocketDirection,
parent_node: Handle<PoseNode<Handle<N>>>,
@@ -104,7 +104,7 @@ fn create_sockets<N: Reflect + 'static>(
.collect::<Vec<_>>()
}
fn fetch_pose_node_model_handle<N: Reflect + 'static>(
fn fetch_pose_node_model_handle<N: Reflect>(
handle: Handle<UiNode>,
ui: &UserInterface,
) -> Handle<PoseNode<Handle<N>>> {
@@ -114,7 +114,7 @@ fn fetch_pose_node_model_handle<N: Reflect + 'static>(
.model_handle
}
fn fetch_socket_pose_node_model_handle<N: Reflect + 'static>(
fn fetch_socket_pose_node_model_handle<N: Reflect>(
handle: Handle<UiNode>,
ui: &UserInterface,
) -> Handle<PoseNode<Handle<N>>> {
+38 -38
View File
@@ -46,7 +46,7 @@ use std::{
ops::{IndexMut, Range},
};
pub fn fetch_animations_container<N: Reflect + Debug + 'static>(
pub fn fetch_animations_container<N: Reflect>(
handle: Handle<N>,
context: &mut dyn CommandContext,
) -> &mut InheritableVariable<AnimationContainer<Handle<N>>> {
@@ -73,14 +73,14 @@ pub fn fetch_animations_container<N: Reflect + Debug + 'static>(
}
#[derive(Debug)]
pub struct AddTrackCommand<N: Reflect + Debug + 'static> {
pub struct AddTrackCommand<N: Reflect> {
animation_player: Handle<N>,
animation: Handle<Animation<Handle<N>>>,
track: Option<Track>,
binding: TrackBinding<Handle<N>>,
}
impl<N: Reflect + Debug + 'static> AddTrackCommand<N> {
impl<N: Reflect> AddTrackCommand<N> {
pub fn new(
animation_player: Handle<N>,
animation: Handle<Animation<Handle<N>>>,
@@ -96,7 +96,7 @@ impl<N: Reflect + Debug + 'static> AddTrackCommand<N> {
}
}
impl<N: Reflect + Debug + 'static> CommandTrait for AddTrackCommand<N> {
impl<N: Reflect> CommandTrait for AddTrackCommand<N> {
fn name(&mut self, _: &dyn CommandContext) -> String {
"Add Track".to_string()
}
@@ -117,7 +117,7 @@ impl<N: Reflect + Debug + 'static> CommandTrait for AddTrackCommand<N> {
}
#[derive(Debug)]
pub struct RemoveTrackCommand<N: Reflect + Debug + 'static> {
pub struct RemoveTrackCommand<N: Reflect> {
animation_player: Handle<N>,
animation: Handle<Animation<Handle<N>>>,
id: Uuid,
@@ -125,7 +125,7 @@ pub struct RemoveTrackCommand<N: Reflect + Debug + 'static> {
track: Option<(usize, (TrackBinding<Handle<N>>, Track))>,
}
impl<N: Reflect + Debug + 'static> RemoveTrackCommand<N> {
impl<N: Reflect> RemoveTrackCommand<N> {
pub fn new(
animation_player: Handle<N>,
animation: Handle<Animation<Handle<N>>>,
@@ -140,7 +140,7 @@ impl<N: Reflect + Debug + 'static> RemoveTrackCommand<N> {
}
}
impl<N: Reflect + Debug + 'static> CommandTrait for RemoveTrackCommand<N> {
impl<N: Reflect> CommandTrait for RemoveTrackCommand<N> {
fn name(&mut self, _: &dyn CommandContext) -> String {
"Remove Track".to_string()
}
@@ -169,13 +169,13 @@ impl<N: Reflect + Debug + 'static> CommandTrait for RemoveTrackCommand<N> {
}
#[derive(Debug)]
pub struct ReplaceTrackCurveCommand<N: Reflect + Debug + 'static> {
pub struct ReplaceTrackCurveCommand<N: Reflect> {
pub animation_player: Handle<N>,
pub animation: Handle<Animation<Handle<N>>>,
pub curve: Curve,
}
impl<N: Reflect + Debug + 'static> ReplaceTrackCurveCommand<N> {
impl<N: Reflect> ReplaceTrackCurveCommand<N> {
fn swap(&mut self, context: &mut dyn CommandContext) {
let animation =
&mut fetch_animations_container(self.animation_player, context)[self.animation];
@@ -196,7 +196,7 @@ impl<N: Reflect + Debug + 'static> ReplaceTrackCurveCommand<N> {
}
}
impl<N: Reflect + Debug + 'static> CommandTrait for ReplaceTrackCurveCommand<N> {
impl<N: Reflect> CommandTrait for ReplaceTrackCurveCommand<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Replace Track Curve".to_string()
}
@@ -211,7 +211,7 @@ impl<N: Reflect + Debug + 'static> CommandTrait for ReplaceTrackCurveCommand<N>
}
#[derive(Debug)]
pub enum AddAnimationCommand<N: Reflect + Debug + 'static> {
pub enum AddAnimationCommand<N: Reflect> {
Unknown,
NonExecuted {
animation_player: Handle<N>,
@@ -230,7 +230,7 @@ pub enum AddAnimationCommand<N: Reflect + Debug + 'static> {
},
}
impl<N: Reflect + Debug + 'static> AddAnimationCommand<N> {
impl<N: Reflect> AddAnimationCommand<N> {
pub fn new(animation_player: Handle<N>, animation: Animation<Handle<N>>) -> Self {
Self::NonExecuted {
animation_player,
@@ -239,7 +239,7 @@ impl<N: Reflect + Debug + 'static> AddAnimationCommand<N> {
}
}
impl<N: Reflect + Debug + 'static> CommandTrait for AddAnimationCommand<N> {
impl<N: Reflect> CommandTrait for AddAnimationCommand<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Add Animation".to_string()
}
@@ -327,7 +327,7 @@ impl<N: Reflect + Debug + 'static> CommandTrait for AddAnimationCommand<N> {
}
#[derive(Debug)]
pub enum RemoveAnimationCommand<N: Reflect + Debug + 'static> {
pub enum RemoveAnimationCommand<N: Reflect> {
Unknown,
NonExecuted {
animation_player: Handle<N>,
@@ -344,7 +344,7 @@ pub enum RemoveAnimationCommand<N: Reflect + Debug + 'static> {
},
}
impl<N: Reflect + Debug + 'static> RemoveAnimationCommand<N> {
impl<N: Reflect> RemoveAnimationCommand<N> {
pub fn new(animation_player: Handle<N>, animation: Handle<Animation<Handle<N>>>) -> Self {
Self::NonExecuted {
animation_player,
@@ -353,7 +353,7 @@ impl<N: Reflect + Debug + 'static> RemoveAnimationCommand<N> {
}
}
impl<N: Reflect + Debug + 'static> CommandTrait for RemoveAnimationCommand<N> {
impl<N: Reflect> CommandTrait for RemoveAnimationCommand<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Remove Animation".to_string()
}
@@ -413,13 +413,13 @@ impl<N: Reflect + Debug + 'static> CommandTrait for RemoveAnimationCommand<N> {
}
#[derive(Debug)]
pub struct ReplaceAnimationCommand<N: Reflect + Debug + 'static> {
pub struct ReplaceAnimationCommand<N: Reflect> {
pub animation_player: Handle<N>,
pub animation_handle: Handle<Animation<Handle<N>>>,
pub animation: Animation<Handle<N>>,
}
impl<N: Reflect + Debug + 'static> ReplaceAnimationCommand<N> {
impl<N: Reflect> ReplaceAnimationCommand<N> {
fn swap(&mut self, context: &mut dyn CommandContext) {
std::mem::swap(
fetch_animations_container(self.animation_player, context)
@@ -429,7 +429,7 @@ impl<N: Reflect + Debug + 'static> ReplaceAnimationCommand<N> {
}
}
impl<N: Reflect + Debug + 'static> CommandTrait for ReplaceAnimationCommand<N> {
impl<N: Reflect> CommandTrait for ReplaceAnimationCommand<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Replace Animation".to_string()
}
@@ -447,13 +447,13 @@ impl<N: Reflect + Debug + 'static> CommandTrait for ReplaceAnimationCommand<N> {
macro_rules! define_animation_swap_command {
($name:ident<$value_type:ty>($self:ident, $context:ident) $swap:block) => {
#[derive(Debug)]
pub struct $name<N:Reflect + Debug + 'static> {
pub struct $name<N:Reflect> {
pub node_handle: Handle<N>,
pub animation_handle: Handle<Animation<Handle<N>>>,
pub value: $value_type,
}
impl<N:Reflect + Debug + 'static> $name<N> {
impl<N:Reflect> $name<N> {
fn swap(&mut $self, $context: &mut dyn CommandContext) {
$swap
}
@@ -475,7 +475,7 @@ macro_rules! define_animation_swap_command {
};
}
fn fetch_animation<N: Reflect + Debug + 'static>(
fn fetch_animation<N: Reflect>(
animation_player: Handle<N>,
animation: Handle<Animation<Handle<N>>>,
ctx: &mut dyn CommandContext,
@@ -526,13 +526,13 @@ define_animation_swap_command!(SetAnimationRootMotionSettingsCommand<Option<Root
});
#[derive(Debug)]
pub struct AddAnimationSignal<N: Reflect + Debug + 'static> {
pub struct AddAnimationSignal<N: Reflect> {
pub animation_player_handle: Handle<N>,
pub animation_handle: Handle<Animation<Handle<N>>>,
pub signal: Option<AnimationSignal>,
}
impl<N: Reflect + Debug + 'static> CommandTrait for AddAnimationSignal<N> {
impl<N: Reflect> CommandTrait for AddAnimationSignal<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Add Animation Signal".to_string()
}
@@ -549,14 +549,14 @@ impl<N: Reflect + Debug + 'static> CommandTrait for AddAnimationSignal<N> {
}
#[derive(Debug)]
pub struct MoveAnimationSignal<N: Reflect + Debug + 'static> {
pub struct MoveAnimationSignal<N: Reflect> {
pub animation_player_handle: Handle<N>,
pub animation_handle: Handle<Animation<Handle<N>>>,
pub signal: Uuid,
pub time: f32,
}
impl<N: Reflect + Debug + 'static> MoveAnimationSignal<N> {
impl<N: Reflect> MoveAnimationSignal<N> {
fn swap(&mut self, context: &mut dyn CommandContext) {
std::mem::swap(
&mut fetch_animation(self.animation_player_handle, self.animation_handle, context)
@@ -570,7 +570,7 @@ impl<N: Reflect + Debug + 'static> MoveAnimationSignal<N> {
}
}
impl<N: Reflect + Debug + 'static> CommandTrait for MoveAnimationSignal<N> {
impl<N: Reflect> CommandTrait for MoveAnimationSignal<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Move Animation Signal".to_string()
}
@@ -585,14 +585,14 @@ impl<N: Reflect + Debug + 'static> CommandTrait for MoveAnimationSignal<N> {
}
#[derive(Debug)]
pub struct RemoveAnimationSignal<N: Reflect + Debug + 'static> {
pub struct RemoveAnimationSignal<N: Reflect> {
pub animation_player_handle: Handle<N>,
pub animation_handle: Handle<Animation<Handle<N>>>,
pub signal_index: usize,
pub signal: Option<AnimationSignal>,
}
impl<N: Reflect + Debug + 'static> CommandTrait for RemoveAnimationSignal<N> {
impl<N: Reflect> CommandTrait for RemoveAnimationSignal<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Remove Animation".to_string()
}
@@ -611,14 +611,14 @@ impl<N: Reflect + Debug + 'static> CommandTrait for RemoveAnimationSignal<N> {
}
#[derive(Debug)]
pub struct SetTrackEnabledCommand<N: Reflect + Debug + 'static> {
pub struct SetTrackEnabledCommand<N: Reflect> {
pub animation_player_handle: Handle<N>,
pub animation_handle: Handle<Animation<Handle<N>>>,
pub track: Uuid,
pub enabled: bool,
}
impl<N: Reflect + Debug + 'static> SetTrackEnabledCommand<N> {
impl<N: Reflect> SetTrackEnabledCommand<N> {
fn swap(&mut self, context: &mut dyn CommandContext) {
let track = fetch_animation(self.animation_player_handle, self.animation_handle, context)
.track_bindings_mut()
@@ -631,7 +631,7 @@ impl<N: Reflect + Debug + 'static> SetTrackEnabledCommand<N> {
}
}
impl<N: Reflect + Debug + 'static> CommandTrait for SetTrackEnabledCommand<N> {
impl<N: Reflect> CommandTrait for SetTrackEnabledCommand<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Set Track Enabled".to_string()
}
@@ -646,14 +646,14 @@ impl<N: Reflect + Debug + 'static> CommandTrait for SetTrackEnabledCommand<N> {
}
#[derive(Debug)]
pub struct SetTrackTargetCommand<N: Reflect + Debug + 'static> {
pub struct SetTrackTargetCommand<N: Reflect> {
pub animation_player_handle: Handle<N>,
pub animation_handle: Handle<Animation<Handle<N>>>,
pub track: Uuid,
pub target: Handle<N>,
}
impl<N: Reflect + Debug + 'static> SetTrackTargetCommand<N> {
impl<N: Reflect> SetTrackTargetCommand<N> {
fn swap(&mut self, context: &mut dyn CommandContext) {
let track = fetch_animation(self.animation_player_handle, self.animation_handle, context)
.track_bindings_mut()
@@ -666,7 +666,7 @@ impl<N: Reflect + Debug + 'static> SetTrackTargetCommand<N> {
}
}
impl<N: Reflect + Debug + 'static> CommandTrait for SetTrackTargetCommand<N> {
impl<N: Reflect> CommandTrait for SetTrackTargetCommand<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Set Track Target".to_string()
}
@@ -681,14 +681,14 @@ impl<N: Reflect + Debug + 'static> CommandTrait for SetTrackTargetCommand<N> {
}
#[derive(Debug)]
pub struct SetTrackValueBindingCommand<N: Reflect + Debug + 'static> {
pub struct SetTrackValueBindingCommand<N: Reflect> {
pub animation_player_handle: Handle<N>,
pub animation_handle: Handle<Animation<Handle<N>>>,
pub track: Uuid,
pub binding: ValueBinding,
}
impl<N: Reflect + Debug + 'static> SetTrackValueBindingCommand<N> {
impl<N: Reflect> SetTrackValueBindingCommand<N> {
fn swap(&mut self, context: &mut dyn CommandContext) {
let animation =
fetch_animation(self.animation_player_handle, self.animation_handle, context);
@@ -707,7 +707,7 @@ impl<N: Reflect + Debug + 'static> SetTrackValueBindingCommand<N> {
}
}
impl<N: Reflect + Debug + 'static> CommandTrait for SetTrackValueBindingCommand<N> {
impl<N: Reflect> CommandTrait for SetTrackValueBindingCommand<N> {
fn name(&mut self, _context: &dyn CommandContext) -> String {
"Set Track Binding".to_string()
}
+6 -6
View File
@@ -37,7 +37,7 @@ pub enum SelectedEntity {
#[derive(Eq)]
pub struct AnimationSelection<N>
where
N: Reflect + 'static,
N: Reflect,
{
pub animation_player: Handle<N>,
pub animation: Handle<Animation<Handle<N>>>,
@@ -46,7 +46,7 @@ where
impl<N> Debug for AnimationSelection<N>
where
N: Reflect + 'static,
N: Reflect,
{
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(
@@ -59,7 +59,7 @@ where
impl<N> Clone for AnimationSelection<N>
where
N: Reflect + 'static,
N: Reflect,
{
fn clone(&self) -> Self {
Self {
@@ -72,7 +72,7 @@ where
impl<N> PartialEq for AnimationSelection<N>
where
N: Reflect + 'static,
N: Reflect,
{
fn eq(&self, other: &Self) -> bool {
self.entities == other.entities
@@ -83,7 +83,7 @@ where
impl<N> SelectionContainer for AnimationSelection<N>
where
N: Reflect + 'static,
N: Reflect,
{
fn len(&self) -> usize {
self.entities.len()
@@ -92,7 +92,7 @@ where
impl<N> AnimationSelection<N>
where
N: Reflect + 'static,
N: Reflect,
{
pub fn first_selected_track(&self) -> Option<Uuid> {
self.entities.iter().find_map(|e| {
+14 -14
View File
@@ -63,7 +63,7 @@ use std::{
sync::Mutex,
};
pub enum HandlePropertyEditorMessage<T: Reflect + 'static> {
pub enum HandlePropertyEditorMessage<T: Reflect> {
Value(Handle<T>),
}
@@ -91,7 +91,7 @@ impl<T: Reflect> PartialEq for HandlePropertyEditorMessage<T> {
}
}
impl<T: Reflect + 'static> HandlePropertyEditorMessage<T> {
impl<T: Reflect> HandlePropertyEditorMessage<T> {
define_constructor!(HandlePropertyEditorMessage:Value => fn value(Handle<T>), layout: false);
}
@@ -104,7 +104,7 @@ pub struct HandlePropertyEditorHierarchyMessage(pub HierarchyNode);
#[derive(Visit, Reflect, TypeUuidProvider, ComponentProvider)]
#[type_uuid(id = "3ceca8c1-c365-4f03-a413-062f8f3cd685")]
#[reflect(derived_type = "UiNode")]
pub struct HandlePropertyEditor<T: Reflect + 'static> {
pub struct HandlePropertyEditor<T: Reflect> {
widget: Widget,
text: Handle<UiNode>,
locate: Handle<UiNode>,
@@ -118,13 +118,13 @@ pub struct HandlePropertyEditor<T: Reflect + 'static> {
pick: Handle<UiNode>,
}
impl<T: Reflect + 'static> Debug for HandlePropertyEditor<T> {
impl<T: Reflect> Debug for HandlePropertyEditor<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "HandlePropertyEditor")
}
}
impl<T: Reflect + 'static> Clone for HandlePropertyEditor<T> {
impl<T: Reflect> Clone for HandlePropertyEditor<T> {
fn clone(&self) -> Self {
Self {
widget: self.widget.clone(),
@@ -140,7 +140,7 @@ impl<T: Reflect + 'static> Clone for HandlePropertyEditor<T> {
}
}
impl<T: Reflect + 'static> Deref for HandlePropertyEditor<T> {
impl<T: Reflect> Deref for HandlePropertyEditor<T> {
type Target = Widget;
fn deref(&self) -> &Self::Target {
@@ -148,13 +148,13 @@ impl<T: Reflect + 'static> Deref for HandlePropertyEditor<T> {
}
}
impl<T: Reflect + 'static> DerefMut for HandlePropertyEditor<T> {
impl<T: Reflect> DerefMut for HandlePropertyEditor<T> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.widget
}
}
impl<T: Reflect + 'static> Control for HandlePropertyEditor<T> {
impl<T: Reflect> Control for HandlePropertyEditor<T> {
fn draw(&self, drawing_context: &mut DrawingContext) {
// Emit transparent geometry for the field to be able to catch mouse events without precise pointing at the
// node name letters.
@@ -341,7 +341,7 @@ impl<T: Reflect + 'static> Control for HandlePropertyEditor<T> {
}
}
struct HandlePropertyEditorBuilder<T: Reflect + 'static> {
struct HandlePropertyEditorBuilder<T: Reflect> {
widget_builder: WidgetBuilder,
value: Handle<T>,
sender: MessageSender,
@@ -359,7 +359,7 @@ fn make_icon(data: &[u8], color: Color, ctx: &mut BuildContext) -> Handle<UiNode
.build(ctx)
}
impl<T: Reflect + 'static> HandlePropertyEditorBuilder<T> {
impl<T: Reflect> HandlePropertyEditorBuilder<T> {
pub fn new(widget_builder: WidgetBuilder, sender: MessageSender) -> Self {
Self {
widget_builder,
@@ -490,19 +490,19 @@ impl<T: Reflect + 'static> HandlePropertyEditorBuilder<T> {
}
}
pub struct NodeHandlePropertyEditorDefinition<T: Reflect + 'static> {
pub struct NodeHandlePropertyEditorDefinition<T: Reflect> {
sender: Mutex<MessageSender>,
#[allow(dead_code)]
type_info: PhantomDataSendSync<T>,
}
impl<T: Reflect + 'static> Debug for NodeHandlePropertyEditorDefinition<T> {
impl<T: Reflect> Debug for NodeHandlePropertyEditorDefinition<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "Node Handle")
}
}
impl<T: Reflect + 'static> NodeHandlePropertyEditorDefinition<T> {
impl<T: Reflect> NodeHandlePropertyEditorDefinition<T> {
pub fn new(sender: MessageSender) -> Self {
Self {
sender: Mutex::new(sender),
@@ -511,7 +511,7 @@ impl<T: Reflect + 'static> NodeHandlePropertyEditorDefinition<T> {
}
}
impl<T: Reflect + 'static> PropertyEditorDefinition for NodeHandlePropertyEditorDefinition<T> {
impl<T: Reflect> PropertyEditorDefinition for NodeHandlePropertyEditorDefinition<T> {
fn value_type_id(&self) -> TypeId {
TypeId::of::<Handle<T>>()
}
+1 -1
View File
@@ -197,7 +197,7 @@ pub fn make_status_enum_editor_definition() -> EnumPropertyEditorDefinition<Stat
fn register_absm_property_editors<T>(container: &PropertyEditorDefinitionContainer)
where
T: Reflect + 'static,
T: Reflect,
{
use crate::fyrox::generic_animation::machine::{
node::{
+6 -6
View File
@@ -1417,23 +1417,23 @@ impl Selection {
is_audio_bus
);
pub fn as_absm<N: Reflect + 'static>(&self) -> Option<&AbsmSelection<N>> {
pub fn as_absm<N: Reflect>(&self) -> Option<&AbsmSelection<N>> {
self.0.as_ref().and_then(|s| s.downcast_ref())
}
pub fn as_absm_mut<N: Reflect + 'static>(&mut self) -> Option<&mut AbsmSelection<N>> {
pub fn as_absm_mut<N: Reflect>(&mut self) -> Option<&mut AbsmSelection<N>> {
self.0.as_mut().and_then(|s| s.downcast_mut())
}
pub fn is_absm<N: Reflect + 'static>(&mut self) -> bool {
pub fn is_absm<N: Reflect>(&mut self) -> bool {
self.as_absm::<N>().is_some()
}
pub fn as_animation<N: Reflect + 'static>(&self) -> Option<&AnimationSelection<N>> {
pub fn as_animation<N: Reflect>(&self) -> Option<&AnimationSelection<N>> {
self.0.as_ref().and_then(|s| s.downcast_ref())
}
pub fn as_animation_mut<N: Reflect + 'static>(&mut self) -> Option<&mut AnimationSelection<N>> {
pub fn as_animation_mut<N: Reflect>(&mut self) -> Option<&mut AnimationSelection<N>> {
self.0.as_mut().and_then(|s| s.downcast_mut())
}
pub fn is_animation<N: Reflect + 'static>(&mut self) -> bool {
pub fn is_animation<N: Reflect>(&mut self) -> bool {
self.as_animation::<N>().is_some()
}
+1 -1
View File
@@ -163,7 +163,7 @@ pub struct SelectedHandle {
pub handle: ErasedHandle,
}
impl<T: Reflect + 'static> From<Handle<T>> for SelectedHandle {
impl<T: Reflect> From<Handle<T>> for SelectedHandle {
fn from(value: Handle<T>) -> Self {
Self {
inner_type_id: TypeId::of::<T>(),
+2 -2
View File
@@ -41,9 +41,9 @@ use strum_macros::{AsRefStr, EnumString, VariantNames};
pub mod signal;
/// Trait for anything that can be used as a texture.
pub trait SpriteSheetTexture: PartialEq + Clone + Visit + Reflect + 'static {}
pub trait SpriteSheetTexture: PartialEq + Clone + Visit + Reflect {}
impl<T: PartialEq + Clone + Visit + Reflect + 'static> SpriteSheetTexture for T {}
impl<T: PartialEq + Clone + Visit + Reflect> SpriteSheetTexture for T {}
/// Animation playback status.
#[derive(Visit, Reflect, Copy, Clone, Eq, PartialEq, Debug, AsRefStr, EnumString, VariantNames)]
+1 -1
View File
@@ -83,7 +83,7 @@ impl<T: Reflect> ReflectHandle for Handle<T> {
}
}
impl<T: Reflect + 'static> Reflect for Handle<T> {
impl<T: Reflect> Reflect for Handle<T> {
fn source_path() -> &'static str {
file!()
}
+3 -7
View File
@@ -384,7 +384,7 @@ pub trait ReflectHashMap: Reflect {
fn reflect_remove(&mut self, key: &dyn Reflect, func: &mut dyn FnMut(Option<Box<dyn Reflect>>));
}
pub trait ReflectInheritableVariable: Reflect + Debug {
pub trait ReflectInheritableVariable: Reflect {
/// Tries to inherit a value from parent. It will succeed only if the current variable is
/// not marked as modified.
fn try_inherit(
@@ -1112,11 +1112,7 @@ pub fn is_path_to_array_element(path: &str) -> bool {
// Make it a trait?
impl dyn ReflectList {
pub fn get_reflect_index<T: Reflect + 'static>(
&self,
index: usize,
func: &mut dyn FnMut(Option<&T>),
) {
pub fn get_reflect_index<T: Reflect>(&self, index: usize, func: &mut dyn FnMut(Option<&T>)) {
if let Some(reflect) = self.reflect_index(index) {
reflect.downcast_ref(func)
} else {
@@ -1124,7 +1120,7 @@ impl dyn ReflectList {
}
}
pub fn get_reflect_index_mut<T: Reflect + 'static>(
pub fn get_reflect_index_mut<T: Reflect>(
&mut self,
index: usize,
func: &mut dyn FnMut(Option<&mut T>),
+7 -7
View File
@@ -118,10 +118,10 @@ impl<const N: usize, T: Reflect> ReflectArray for [T; N] {
impl_reflect! {
#[reflect(ReflectList, ReflectArray)]
pub struct Vec<T: Reflect + 'static>;
pub struct Vec<T: Reflect>;
}
impl<T: Reflect + 'static> ReflectArray for Vec<T> {
impl<T: Reflect> ReflectArray for Vec<T> {
fn reflect_index(&self, index: usize) -> Option<&dyn Reflect> {
self.get(index).map(|x| x as &dyn Reflect)
}
@@ -136,7 +136,7 @@ impl<T: Reflect + 'static> ReflectArray for Vec<T> {
}
/// REMARK: `Reflect` is implemented for `Vec<T>` where `T: Reflect` only.
impl<T: Reflect + 'static> ReflectList for Vec<T> {
impl<T: Reflect> ReflectList for Vec<T> {
fn reflect_push(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>> {
self.push(*value.downcast::<T>()?);
Ok(())
@@ -170,8 +170,8 @@ impl<T: Reflect + 'static> ReflectList for Vec<T> {
impl<K, V, S> Reflect for HashMap<K, V, S>
where
K: Reflect + Debug + Eq + Hash + 'static,
V: Reflect + Debug + 'static,
K: Reflect + Eq + Hash + 'static,
V: Reflect,
S: BuildHasher + 'static,
{
blank_reflect!();
@@ -187,8 +187,8 @@ where
impl<K, V, S> ReflectHashMap for HashMap<K, V, S>
where
K: Reflect + Debug + Eq + Hash + 'static,
V: Reflect + Debug + 'static,
K: Reflect + Eq + Hash + 'static,
V: Reflect,
S: BuildHasher + 'static,
{
fn reflect_insert(
+7 -7
View File
@@ -94,7 +94,7 @@ impl Control for ArrayEditor {
pub struct ArrayEditorBuilder<'a, T, I>
where
T: Reflect + 'static,
T: Reflect,
I: IntoIterator<Item = &'a T>,
{
widget_builder: WidgetBuilder,
@@ -158,7 +158,7 @@ fn create_items<'a, 'b, T, I>(
name_column_width: f32,
) -> Result<Vec<Item>, InspectorError>
where
T: Reflect + 'static,
T: Reflect,
I: IntoIterator<Item = &'a T>,
{
let mut items = Vec::new();
@@ -203,7 +203,7 @@ where
impl<'a, T, I> ArrayEditorBuilder<'a, T, I>
where
T: Reflect + 'static,
T: Reflect,
I: IntoIterator<Item = &'a T>,
{
pub fn new(widget_builder: WidgetBuilder) -> Self {
@@ -299,7 +299,7 @@ where
#[derive(Debug)]
pub struct ArrayPropertyEditorDefinition<T, const N: usize>
where
T: Reflect + Debug + 'static,
T: Reflect,
{
#[allow(dead_code)]
phantom: PhantomDataSendSync<T>,
@@ -307,7 +307,7 @@ where
impl<T, const N: usize> ArrayPropertyEditorDefinition<T, N>
where
T: Reflect + Debug + 'static,
T: Reflect,
{
pub fn new() -> Self {
Self::default()
@@ -316,7 +316,7 @@ where
impl<T, const N: usize> Default for ArrayPropertyEditorDefinition<T, N>
where
T: Reflect + Debug + 'static,
T: Reflect,
{
fn default() -> Self {
Self {
@@ -327,7 +327,7 @@ where
impl<T, const N: usize> PropertyEditorDefinition for ArrayPropertyEditorDefinition<T, N>
where
T: Reflect + Debug + 'static,
T: Reflect,
{
fn value_type_id(&self) -> TypeId {
TypeId::of::<[T; N]>()
+2 -8
View File
@@ -60,15 +60,9 @@ pub struct Item {
remove: Handle<UiNode>,
}
pub trait CollectionItem:
Clone + Reflect + Debug + Default + TypeUuidProvider + Send + 'static
{
}
pub trait CollectionItem: Clone + Reflect + Default + TypeUuidProvider + Send + 'static {}
impl<T> CollectionItem for T where
T: Clone + Reflect + Debug + Default + TypeUuidProvider + Send + 'static
{
}
impl<T> CollectionItem for T where T: Clone + Reflect + Default + TypeUuidProvider + Send + 'static {}
#[derive(Debug, Visit, Reflect, ComponentProvider)]
#[reflect(derived_type = "UiNode")]
@@ -48,7 +48,7 @@ use std::{
/// The layer_index for the inner inspector is increased by 1.
pub struct InspectablePropertyEditorDefinition<T>
where
T: Reflect + 'static,
T: Reflect,
{
#[allow(dead_code)]
phantom: PhantomDataSendSync<T>,
@@ -56,7 +56,7 @@ where
impl<T> InspectablePropertyEditorDefinition<T>
where
T: Reflect + 'static,
T: Reflect,
{
pub fn new() -> Self {
Self {
@@ -67,7 +67,7 @@ where
impl<T> Debug for InspectablePropertyEditorDefinition<T>
where
T: Reflect + 'static,
T: Reflect,
{
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
writeln!(f, "InspectablePropertyEditorDefinition")
@@ -76,7 +76,7 @@ where
impl<T> PropertyEditorDefinition for InspectablePropertyEditorDefinition<T>
where
T: Reflect + 'static,
T: Reflect,
{
fn value_type_id(&self) -> TypeId {
TypeId::of::<T>()
+1 -1
View File
@@ -229,7 +229,7 @@ impl PropertyAction {
}
/// Trait of values that can be edited by an Inspector through reflection.
pub trait Value: Reflect + Debug + Send {
pub trait Value: Reflect + Send {
fn clone_box(&self) -> Box<dyn Value>;
fn into_box_reflect(self: Box<Self>) -> Box<dyn Reflect>;