mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
parent
2ad27ee4ee
commit
8316166622
23 changed files with 37 additions and 37 deletions
|
@ -408,7 +408,7 @@ impl AssetProcessor {
|
|||
infos.remove(&asset_path).await;
|
||||
}
|
||||
|
||||
/// Handles a renamed source asset by moving it's processed results to the new location and updating in-memory paths + metadata.
|
||||
/// Handles a renamed source asset by moving its processed results to the new location and updating in-memory paths + metadata.
|
||||
/// This will cause direct path dependencies to break.
|
||||
async fn handle_renamed_asset(&self, source: &AssetSource, old: PathBuf, new: PathBuf) {
|
||||
let mut infos = self.data.asset_infos.write().await;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//! In this example we add a counter resource and increase it's value in one system,
|
||||
//! In this example we add a counter resource and increase its value in one system,
|
||||
//! while a different system prints the current count to the console.
|
||||
|
||||
use bevy_ecs::prelude::*;
|
||||
|
|
|
@ -178,7 +178,7 @@ pub trait DynamicBundle {
|
|||
|
||||
// SAFETY:
|
||||
// - `Bundle::component_ids` calls `ids` for C's component id (and nothing else)
|
||||
// - `Bundle::get_components` is called exactly once for C and passes the component's storage type based on it's associated constant.
|
||||
// - `Bundle::get_components` is called exactly once for C and passes the component's storage type based on its associated constant.
|
||||
// - `Bundle::from_components` calls `func` exactly once for C, which is the exact value returned by `Bundle::component_ids`.
|
||||
unsafe impl<C: Component> Bundle for C {
|
||||
fn component_ids(
|
||||
|
@ -990,10 +990,10 @@ impl Bundles {
|
|||
T::component_ids(components, storages, &mut |id| component_ids.push(id));
|
||||
let id = BundleId(bundle_infos.len());
|
||||
let bundle_info =
|
||||
// SAFETY: T::component_id ensures its:
|
||||
// - info was created
|
||||
// SAFETY: T::component_id ensures:
|
||||
// - its info was created
|
||||
// - appropriate storage for it has been initialized.
|
||||
// - was created in the same order as the components in T
|
||||
// - it was created in the same order as the components in T
|
||||
unsafe { BundleInfo::new(std::any::type_name::<T>(), components, component_ids, id) };
|
||||
bundle_infos.push(bundle_info);
|
||||
id
|
||||
|
|
|
@ -154,7 +154,7 @@ pub trait Component: Send + Sync + 'static {
|
|||
/// A constant indicating the storage type used for this component.
|
||||
const STORAGE_TYPE: StorageType;
|
||||
|
||||
/// Called when registering this component, allowing mutable access to it's [`ComponentHooks`].
|
||||
/// Called when registering this component, allowing mutable access to its [`ComponentHooks`].
|
||||
fn register_component_hooks(_hooks: &mut ComponentHooks) {}
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ pub enum StorageType {
|
|||
/// The type used for [`Component`] lifecycle hooks such as `on_add`, `on_insert` or `on_remove`
|
||||
pub type ComponentHook = for<'w> fn(DeferredWorld<'w>, Entity, ComponentId);
|
||||
|
||||
/// Lifecycle hooks for a given [`Component`], stored in it's [`ComponentInfo`]
|
||||
/// Lifecycle hooks for a given [`Component`], stored in its [`ComponentInfo`]
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct ComponentHooks {
|
||||
pub(crate) on_add: Option<ComponentHook>,
|
||||
|
@ -193,7 +193,7 @@ pub struct ComponentHooks {
|
|||
impl ComponentHooks {
|
||||
/// Register a [`ComponentHook`] that will be run when this component is added to an entity.
|
||||
/// An `on_add` hook will always run before `on_insert` hooks. Spawning an entity counts as
|
||||
/// adding all of it's components.
|
||||
/// adding all of its components.
|
||||
///
|
||||
/// Will panic if the component already has an `on_add` hook
|
||||
pub fn on_add(&mut self, hook: ComponentHook) -> &mut Self {
|
||||
|
@ -212,7 +212,7 @@ impl ComponentHooks {
|
|||
}
|
||||
|
||||
/// Register a [`ComponentHook`] that will be run when this component is removed from an entity.
|
||||
/// Despawning an entity counts as removing all of it's components.
|
||||
/// Despawning an entity counts as removing all of its components.
|
||||
///
|
||||
/// Will panic if the component already has an `on_remove` hook
|
||||
pub fn on_remove(&mut self, hook: ComponentHook) -> &mut Self {
|
||||
|
|
|
@ -171,7 +171,7 @@ impl<D: QueryData, F: QueryFilter> QueryState<D, F> {
|
|||
|
||||
/// Creates a new [`QueryState`] but does not populate it with the matched results from the World yet
|
||||
///
|
||||
/// `new_archetype` and it's variants must be called on all of the World's archetypes before the
|
||||
/// `new_archetype` and its variants must be called on all of the World's archetypes before the
|
||||
/// state can return valid query results.
|
||||
fn new_uninitialized(world: &mut World) -> Self {
|
||||
let fetch_state = D::init_state(world);
|
||||
|
@ -208,7 +208,7 @@ impl<D: QueryData, F: QueryFilter> QueryState<D, F> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Creates a new [`QueryState`] from a given [`QueryBuilder`] and inherits it's [`FilteredAccess`].
|
||||
/// Creates a new [`QueryState`] from a given [`QueryBuilder`] and inherits its [`FilteredAccess`].
|
||||
pub fn from_builder(builder: &mut QueryBuilder<D, F>) -> Self {
|
||||
let mut fetch_state = D::init_state(builder.world_mut());
|
||||
let filter_state = F::init_state(builder.world_mut());
|
||||
|
|
|
@ -165,7 +165,7 @@ impl BlobVec {
|
|||
// - the layout of the ptr was `array_layout(self.item_layout, self.capacity)`
|
||||
// - `item_layout.size() > 0` and `new_capacity > 0`, so the layout size is non-zero
|
||||
// - "new_size, when rounded up to the nearest multiple of layout.align(), must not overflow (i.e., the rounded value must be less than usize::MAX)",
|
||||
// since the item size is always a multiple of its align, the rounding cannot happen
|
||||
// since the item size is always a multiple of its alignment, the rounding cannot happen
|
||||
// here and the overflow is handled in `array_layout`
|
||||
unsafe {
|
||||
std::alloc::realloc(
|
||||
|
|
|
@ -298,7 +298,7 @@ impl<const SEND: bool> Resources<SEND> {
|
|||
self.resources.get_mut(component_id)
|
||||
}
|
||||
|
||||
/// Fetches or initializes a new resource and returns back it's underlying column.
|
||||
/// Fetches or initializes a new resource and returns back its underlying column.
|
||||
///
|
||||
/// # Panics
|
||||
/// Will panic if `component_id` is not valid for the provided `components`
|
||||
|
|
|
@ -139,7 +139,7 @@ impl TableRow {
|
|||
/// Conceptually, a [`Column`] is very similar to a type-erased `Vec<T>`.
|
||||
/// It also stores the change detection ticks for its components, kept in two separate
|
||||
/// contiguous buffers internally. An element shares its data across these buffers by using the
|
||||
/// same index (i.e. the entity at row 3 has it's data at index 3 and its change detection ticks at
|
||||
/// same index (i.e. the entity at row 3 has its data at index 3 and its change detection ticks at
|
||||
/// index 3). A slice to these contiguous blocks of memory can be fetched
|
||||
/// via [`Column::get_data_slice`], [`Column::get_added_ticks_slice`], and
|
||||
/// [`Column::get_changed_ticks_slice`].
|
||||
|
|
|
@ -1366,7 +1366,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> Query<'w, 's, D, F> {
|
|||
) -> QueryLens<'_, NewD, NewF> {
|
||||
// SAFETY:
|
||||
// - We have exclusive access to the query
|
||||
// - `self` has correctly captured it's access
|
||||
// - `self` has correctly captured its access
|
||||
// - Access is checked to be a subset of the query's access when the state is created.
|
||||
let world = unsafe { self.world.world() };
|
||||
let state = self.state.transmute_filtered::<NewD, NewF>(world);
|
||||
|
|
|
@ -176,7 +176,7 @@ impl<In: 'static, Out: 'static> Debug for dyn System<In = In, Out = Out> {
|
|||
/// Trait used to run a system immediately on a [`World`].
|
||||
///
|
||||
/// # Warning
|
||||
/// This function is not an efficient method of running systems and its meant to be used as a utility
|
||||
/// This function is not an efficient method of running systems and it's meant to be used as a utility
|
||||
/// for testing and/or diagnostics.
|
||||
///
|
||||
/// Systems called through [`run_system_once`](RunSystemOnce::run_system_once) do not hold onto any state,
|
||||
|
|
|
@ -2227,7 +2227,7 @@ impl World {
|
|||
.resources
|
||||
.iter()
|
||||
.filter_map(|(component_id, data)| {
|
||||
// SAFETY: If a resource has been initialized, a corresponding ComponentInfo must exist with it's ID.
|
||||
// SAFETY: If a resource has been initialized, a corresponding ComponentInfo must exist with its ID.
|
||||
let component_info = unsafe {
|
||||
self.components
|
||||
.get_info(component_id)
|
||||
|
@ -2308,7 +2308,7 @@ impl World {
|
|||
.resources
|
||||
.iter()
|
||||
.filter_map(|(component_id, data)| {
|
||||
// SAFETY: If a resource has been initialized, a corresponding ComponentInfo must exist with it's ID.
|
||||
// SAFETY: If a resource has been initialized, a corresponding ComponentInfo must exist with its ID.
|
||||
let component_info = unsafe {
|
||||
self.components
|
||||
.get_info(component_id)
|
||||
|
|
|
@ -128,7 +128,7 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
|
|||
/// # Arguments
|
||||
/// - `angle`: sets how much of a circle circumference is passed, e.g. PI is half a circle. This
|
||||
/// value should be in the range (-2 * PI..=2 * PI)
|
||||
/// - `radius`: distance between the arc and it's center point
|
||||
/// - `radius`: distance between the arc and its center point
|
||||
/// - `position`: position of the arcs center point
|
||||
/// - `rotation`: defines orientation of the arc, by default we assume the arc is contained in a
|
||||
/// plane parallel to the XZ plane and the default starting point is (`position + Vec3::X`)
|
||||
|
|
|
@ -1249,7 +1249,7 @@ impl From<GamepadAxisChangedEvent> for GamepadEvent {
|
|||
}
|
||||
}
|
||||
|
||||
/// Splits the [`GamepadEvent`] event stream into it's component events.
|
||||
/// Splits the [`GamepadEvent`] event stream into its component events.
|
||||
pub fn gamepad_event_system(
|
||||
mut gamepad_events: EventReader<GamepadEvent>,
|
||||
mut connection_events: EventWriter<GamepadConnectionEvent>,
|
||||
|
|
|
@ -558,7 +558,7 @@ impl<P: VectorSpace> RationalGenerator<P> for CubicNurbs<P> {
|
|||
.map(|((points, weights), knots)| {
|
||||
// This is curve segment i. It uses control points P_i, P_i+2, P_i+2 and P_i+3,
|
||||
// It is associated with knot span i+3 (which is the interval between knots i+3
|
||||
// and i+4) and it's characteristic matrix uses knots i+1 through i+6 (because
|
||||
// and i+4) and its characteristic matrix uses knots i+1 through i+6 (because
|
||||
// those define the two knot spans on either side).
|
||||
let span = knots[4] - knots[3];
|
||||
let coefficient_knots = knots.try_into().expect("Knot windows are of length 6");
|
||||
|
|
|
@ -83,7 +83,7 @@ all usage patterns. `*mut ()` should only be used to carry the mutability of the
|
|||
as a `Box<T>` that does not allocate on initialization or deallocated when it's dropped, and is in fact used to implement common types like `Box<T>`, `Vec<T>`,
|
||||
etc.
|
||||
|
||||
`Shared<T>` is currently available in `core::ptr` on nightly Rust builds. It's the pointer that backs both `Rc<T>` and `Arc<T>`. It's semantics allow for
|
||||
`Shared<T>` is currently available in `core::ptr` on nightly Rust builds. It's the pointer that backs both `Rc<T>` and `Arc<T>`. Its semantics allow for
|
||||
multiple instances to collectively own the data it points to, and as a result, forbids getting a mutable borrow.
|
||||
|
||||
`bevy_ptr` does not support these types right now, but may support [polyfills] for these pointer types if the need arises.
|
||||
|
|
|
@ -38,7 +38,7 @@ impl<'a> Access<'a> {
|
|||
/// Converts this into an "owned" value.
|
||||
///
|
||||
/// If the [`Access`] is of variant [`Field`](Access::Field),
|
||||
/// the field's [`Cow<str>`] will be converted to it's owned
|
||||
/// the field's [`Cow<str>`] will be converted to its owned
|
||||
/// counterpart, which doesn't require a reference.
|
||||
pub fn into_owned(self) -> Access<'static> {
|
||||
match self {
|
||||
|
|
|
@ -69,7 +69,7 @@ impl<'a> AccessError<'a> {
|
|||
}
|
||||
|
||||
/// If the [`Access`] was created with a parser or an offset was manually provided,
|
||||
/// returns the offset of the [`Access`] in it's path string.
|
||||
/// returns the offset of the [`Access`] in its path string.
|
||||
pub const fn offset(&self) -> Option<&usize> {
|
||||
self.offset.as_ref()
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ impl TypeInfo {
|
|||
/// due to technical reasons (or by definition), but it can also be a purposeful choice.
|
||||
///
|
||||
/// For example, [`i32`] cannot be broken down any further, so it is represented by a [`ValueInfo`].
|
||||
/// And while [`String`] itself is a struct, it's fields are private, so we don't really treat
|
||||
/// And while [`String`] itself is a struct, its fields are private, so we don't really treat
|
||||
/// it _as_ a struct. It therefore makes more sense to represent it as a [`ValueInfo`].
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ValueInfo {
|
||||
|
|
|
@ -295,7 +295,7 @@ impl<T: Default> Time<T> {
|
|||
|
||||
/// Returns how much time has advanced since [`startup`](#method.startup), as [`f32`] seconds.
|
||||
///
|
||||
/// **Note:** This is a monotonically increasing value. It's precision will degrade over time.
|
||||
/// **Note:** This is a monotonically increasing value. Its precision will degrade over time.
|
||||
/// If you need an `f32` but that precision loss is unacceptable,
|
||||
/// use [`elapsed_seconds_wrapped`](#method.elapsed_seconds_wrapped).
|
||||
#[inline]
|
||||
|
|
|
@ -189,7 +189,7 @@ impl Val {
|
|||
/// Resolves a [`Val`] to its value in logical pixels and returns this as an [`f32`].
|
||||
/// Returns a [`ValArithmeticError::NonEvaluateable`] if the [`Val`] is impossible to resolve into a concrete value.
|
||||
///
|
||||
/// **Note:** If a [`Val::Px`] is resolved, it's inner value is returned unchanged.
|
||||
/// **Note:** If a [`Val::Px`] is resolved, its inner value is returned unchanged.
|
||||
pub fn resolve(self, parent_size: f32, viewport_size: Vec2) -> Result<f32, ValArithmeticError> {
|
||||
match self {
|
||||
Val::Percent(value) => Ok(parent_size * value / 100.0),
|
||||
|
|
|
@ -27,7 +27,7 @@ use bevy_transform::prelude::{GlobalTransform, Transform};
|
|||
pub struct NodeBundle {
|
||||
/// Describes the logical size of the node
|
||||
pub node: Node,
|
||||
/// Styles which control the layout (size and position) of the node and it's children
|
||||
/// Styles which control the layout (size and position) of the node and its children
|
||||
/// In some cases these styles also affect how the node drawn/painted.
|
||||
pub style: Style,
|
||||
/// The background color, which serves as a "fill" for this node
|
||||
|
@ -89,7 +89,7 @@ impl Default for NodeBundle {
|
|||
pub struct ImageBundle {
|
||||
/// Describes the logical size of the node
|
||||
pub node: Node,
|
||||
/// Styles which control the layout (size and position) of the node and it's children
|
||||
/// Styles which control the layout (size and position) of the node and its children
|
||||
/// In some cases these styles also affect how the node drawn/painted.
|
||||
pub style: Style,
|
||||
/// The calculated size based on the given image
|
||||
|
@ -137,7 +137,7 @@ pub struct ImageBundle {
|
|||
pub struct AtlasImageBundle {
|
||||
/// Describes the logical size of the node
|
||||
pub node: Node,
|
||||
/// Styles which control the layout (size and position) of the node and it's children
|
||||
/// Styles which control the layout (size and position) of the node and its children
|
||||
/// In some cases these styles also affect how the node drawn/painted.
|
||||
pub style: Style,
|
||||
/// The calculated size based on the given image
|
||||
|
@ -180,7 +180,7 @@ pub struct AtlasImageBundle {
|
|||
pub struct TextBundle {
|
||||
/// Describes the logical size of the node
|
||||
pub node: Node,
|
||||
/// Styles which control the layout (size and position) of the node and it's children
|
||||
/// Styles which control the layout (size and position) of the node and its children
|
||||
/// In some cases these styles also affect how the node drawn/painted.
|
||||
pub style: Style,
|
||||
/// Contains the text of the node
|
||||
|
@ -308,7 +308,7 @@ pub struct ButtonBundle {
|
|||
pub node: Node,
|
||||
/// Marker component that signals this node is a button
|
||||
pub button: Button,
|
||||
/// Styles which control the layout (size and position) of the node and it's children
|
||||
/// Styles which control the layout (size and position) of the node and its children
|
||||
/// In some cases these styles also affect how the node drawn/painted.
|
||||
pub style: Style,
|
||||
/// Describes whether and how the button has been interacted with by the input
|
||||
|
@ -369,7 +369,7 @@ impl Default for ButtonBundle {
|
|||
pub struct MaterialNodeBundle<M: UiMaterial> {
|
||||
/// Describes the logical size of the node
|
||||
pub node: Node,
|
||||
/// Styles which control the layout (size and position) of the node and it's children
|
||||
/// Styles which control the layout (size and position) of the node and its children
|
||||
/// In some cases these styles also affect how the node drawn/painted.
|
||||
pub style: Style,
|
||||
/// The [`UiMaterial`] used to render the node.
|
||||
|
|
|
@ -24,7 +24,7 @@ impl<T: Send> Parallel<T> {
|
|||
impl<T: Default + Send> Parallel<T> {
|
||||
/// Retrieves the thread-local value for the current thread and runs `f` on it.
|
||||
///
|
||||
/// If there is no thread-local value, it will be initialized to it's default.
|
||||
/// If there is no thread-local value, it will be initialized to its default.
|
||||
pub fn scope<R>(&self, f: impl FnOnce(&mut T) -> R) -> R {
|
||||
let cell = self.locals.get_or_default();
|
||||
let mut value = cell.take();
|
||||
|
|
|
@ -278,7 +278,7 @@ pub struct WindowOccluded {
|
|||
reflect(Serialize, Deserialize)
|
||||
)]
|
||||
pub struct WindowScaleFactorChanged {
|
||||
/// Window that had it's scale factor changed.
|
||||
/// Window that had its scale factor changed.
|
||||
pub window: Entity,
|
||||
/// The new scale factor.
|
||||
pub scale_factor: f64,
|
||||
|
@ -293,7 +293,7 @@ pub struct WindowScaleFactorChanged {
|
|||
reflect(Serialize, Deserialize)
|
||||
)]
|
||||
pub struct WindowBackendScaleFactorChanged {
|
||||
/// Window that had it's scale factor changed by the backend.
|
||||
/// Window that had its scale factor changed by the backend.
|
||||
pub window: Entity,
|
||||
/// The new scale factor.
|
||||
pub scale_factor: f64,
|
||||
|
|
Loading…
Reference in a new issue