From 6ffc26b2749bddd3b9e4f701a519e30297f8691b Mon Sep 17 00:00:00 2001 From: Dmitry Stepanov Date: Tue, 2 Jun 2026 21:49:02 +0300 Subject: [PATCH] more precise naming --- fyrox-impl/src/scene/base.rs | 16 ++++++------ fyrox-impl/src/scene/graph/mod.rs | 42 +++++++++++++++---------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/fyrox-impl/src/scene/base.rs b/fyrox-impl/src/scene/base.rs index 691cc7cb0..66454696c 100644 --- a/fyrox-impl/src/scene/base.rs +++ b/fyrox-impl/src/scene/base.rs @@ -992,11 +992,11 @@ impl Base { .filter_map(|e| e.script.as_mut().and_then(|s| s.cast_mut::())) } - /// Tries find a component of the given type `C` across **all** available scripts of the node. - /// If you want to search a component `C` in a particular script, then use [`Self::try_get_script`] - /// and then search for component in it. + /// Tries find a field of the given type `C` across **all** available scripts of the node. + /// If you want to search a field `C` in a particular script, then use [`Self::try_get_script`] + /// and then search for field in it. #[inline] - pub fn try_get_script_component(&self) -> Option<&C> + pub fn try_get_script_field(&self) -> Option<&C> where C: Reflect, { @@ -1005,11 +1005,11 @@ impl Base { .find_map(|s| s.as_ref().and_then(|s| s.self_or_field_ref::())) } - /// Tries find a component of the given type `C` across **all** available scripts of the node. - /// If you want to search a component `C` in a particular script, then use [`Self::try_get_script`] - /// and then search for component in it. + /// Tries find a field of the given type `C` across **all** available scripts of the node. + /// If you want to search a field `C` in a particular script, then use [`Self::try_get_script`] + /// and then search for field in it. #[inline] - pub fn try_get_script_component_mut(&mut self) -> Option<&mut C> + pub fn try_get_script_field_mut(&mut self) -> Option<&mut C> where C: Reflect, { diff --git a/fyrox-impl/src/scene/graph/mod.rs b/fyrox-impl/src/scene/graph/mod.rs index b0f5ca64b..f3cca7556 100644 --- a/fyrox-impl/src/scene/graph/mod.rs +++ b/fyrox-impl/src/scene/graph/mod.rs @@ -342,12 +342,12 @@ pub enum GraphError { /// Type name of the script. script_type_name: &'static str, }, - /// There's no script component of the requested type. - NoScriptComponent { + /// There's no script field of the requested type. + NoScriptField { /// Handle of the node. handle: Handle, - /// Type name of the script component. - component_type_name: &'static str, + /// Type name of the script field. + field_type_name: &'static str, }, /// There's no scene node with the given id. UnknownId(SceneNodeId), @@ -366,13 +366,13 @@ impl Display for GraphError { "There's no script {script_type_name} on the scene node {handle}" ) } - GraphError::NoScriptComponent { + GraphError::NoScriptField { handle, - component_type_name, + field_type_name, } => { write!( f, - "There's no script component {component_type_name} on the scene node {handle}" + "There's no script field {field_type_name} on the scene node {handle}" ) } GraphError::UnknownId(id) => { @@ -1905,11 +1905,11 @@ impl Graph { Ok(node.try_get_scripts_mut()) } - /// Tries to borrow a node and find a component of the given type `C` across **all** available - /// scripts of the node. If you want to search a component `C` in a particular script, then use - /// [`Self::try_get_script_of`] and then search for component in it. + /// Tries to borrow a node and find a field of the given type `C` across **all** available + /// scripts of the node. If you want to search a field `C` in a particular script, then use + /// [`Self::try_get_script_of`] and then search for field in it. #[inline] - pub fn try_get_script_component_of( + pub fn try_get_script_field_of( &self, handle: Handle>, ) -> Result<&C, GraphError> @@ -1918,18 +1918,18 @@ impl Graph { { let handle = handle.to_base(); let node = self.try_get_node(handle)?; - node.try_get_script_component() - .ok_or_else(|| GraphError::NoScriptComponent { + node.try_get_script_field() + .ok_or_else(|| GraphError::NoScriptField { handle, - component_type_name: std::any::type_name::(), + field_type_name: std::any::type_name::(), }) } - /// Tries to borrow a node and find a component of the given type `C` across **all** available - /// scripts of the node. If you want to search a component `C` in a particular script, then use - /// [`Self::try_get_script_of_mut`] and then search for component in it. + /// Tries to borrow a node and find a field of the given type `C` across **all** available + /// scripts of the node. If you want to search a field `C` in a particular script, then use + /// [`Self::try_get_script_of_mut`] and then search for field in it. #[inline] - pub fn try_get_script_component_of_mut( + pub fn try_get_script_field_of_mut( &mut self, handle: Handle>, ) -> Result<&mut C, GraphError> @@ -1938,10 +1938,10 @@ impl Graph { { let handle = handle.to_base(); let node = self.try_get_node_mut(handle)?; - node.try_get_script_component_mut() - .ok_or_else(|| GraphError::NoScriptComponent { + node.try_get_script_field_mut() + .ok_or_else(|| GraphError::NoScriptField { handle, - component_type_name: std::any::type_name::(), + field_type_name: std::any::type_name::(), }) }