mirror of
https://github.com/bevyengine/bevy
synced 2024-11-21 20:23:28 +00:00
Fix intra-doc links and make CI test them (#14076)
# Objective - Bevy currently has lot of invalid intra-doc links, let's fix them! - Also make CI test them, to avoid future regressions. - Helps with #1983 (but doesn't fix it, as there could still be explicit links to docs.rs that are broken) ## Solution - Make `cargo r -p ci -- doc-check` check fail on warnings (could also be changed to just some specific lints) - Manually fix all the warnings (note that in some cases it was unclear to me what the fix should have been, I'll try to highlight them in a self-review)
This commit is contained in:
parent
2414311079
commit
d7080369a7
66 changed files with 158 additions and 117 deletions
|
@ -318,7 +318,7 @@ impl App {
|
|||
}
|
||||
|
||||
/// Initializes `T` event handling by inserting an event queue resource ([`Events::<T>`])
|
||||
/// and scheduling an [`event_update_system`] in [`First`](crate::First).
|
||||
/// and scheduling an [`event_update_system`] in [`First`].
|
||||
///
|
||||
/// See [`Events`] for information on how to define events.
|
||||
///
|
||||
|
|
|
@ -17,7 +17,7 @@ use bevy_ecs::{
|
|||
/// Then it will run:
|
||||
/// * [`First`]
|
||||
/// * [`PreUpdate`]
|
||||
/// * [`StateTransition`](bevy_state::transition::StateTransition)
|
||||
/// * [`StateTransition`]
|
||||
/// * [`RunFixedMainLoop`]
|
||||
/// * This will run [`FixedMain`] zero to many times, based on how much time has elapsed.
|
||||
/// * [`Update`]
|
||||
|
@ -32,6 +32,7 @@ use bevy_ecs::{
|
|||
///
|
||||
/// See [`RenderPlugin`] and [`PipelinedRenderingPlugin`] for more details.
|
||||
///
|
||||
/// [`StateTransition`]: https://docs.rs/bevy/latest/bevy/prelude/struct.StateTransition.html
|
||||
/// [`RenderPlugin`]: https://docs.rs/bevy/latest/bevy/render/struct.RenderPlugin.html
|
||||
/// [`PipelinedRenderingPlugin`]: https://docs.rs/bevy/latest/bevy/render/pipelined_rendering/struct.PipelinedRenderingPlugin.html
|
||||
/// [`SubApp`]: crate::SubApp
|
||||
|
|
|
@ -287,7 +287,7 @@ impl<A: Asset> AssetContainer for A {
|
|||
}
|
||||
}
|
||||
|
||||
/// An error that occurs when attempting to call [`LoadContext::load_direct`]
|
||||
/// An error that occurs when attempting to call [`DirectNestedLoader::load`](crate::DirectNestedLoader::load)
|
||||
#[derive(Error, Debug)]
|
||||
#[error("Failed to load dependency {dependency:?} {error}")]
|
||||
pub struct LoadDirectError {
|
||||
|
|
|
@ -28,7 +28,7 @@ impl ReaderRef<'_> {
|
|||
/// A builder for loading nested assets inside a `LoadContext`.
|
||||
///
|
||||
/// # Lifetimes
|
||||
/// - `ctx`: the lifetime of the associated [`AssetServer`] reference
|
||||
/// - `ctx`: the lifetime of the associated [`AssetServer`](crate::AssetServer) reference
|
||||
/// - `builder`: the lifetime of the temporary builder structs
|
||||
pub struct NestedLoader<'ctx, 'builder> {
|
||||
load_context: &'builder mut LoadContext<'ctx>,
|
||||
|
@ -107,11 +107,14 @@ impl<'ctx, 'builder> NestedLoader<'ctx, 'builder> {
|
|||
}
|
||||
|
||||
/// Retrieves a handle for the asset at the given path and adds that path as a dependency of the asset.
|
||||
/// If the current context is a normal [`AssetServer::load`], an actual asset load will be kicked off immediately, which ensures the load happens
|
||||
/// as soon as possible.
|
||||
/// "Normal loads" kicked from within a normal Bevy App will generally configure the context to kick off loads immediately.
|
||||
/// If the current context is configured to not load dependencies automatically (ex: [`AssetProcessor`](crate::processor::AssetProcessor)),
|
||||
/// a load will not be kicked off automatically. It is then the calling context's responsibility to begin a load if necessary.
|
||||
/// If the current context is a normal [`AssetServer::load`](crate::AssetServer::load), an actual asset
|
||||
/// load will be kicked off immediately, which ensures the load happens as soon as possible.
|
||||
/// "Normal loads" kicked from within a normal Bevy App will generally configure the context to kick off
|
||||
/// loads immediately.
|
||||
/// If the current context is configured to not load dependencies automatically
|
||||
/// (ex: [`AssetProcessor`](crate::processor::AssetProcessor)),
|
||||
/// a load will not be kicked off automatically. It is then the calling context's responsibility to begin
|
||||
/// a load if necessary.
|
||||
pub fn load<'c, A: Asset>(self, path: impl Into<AssetPath<'c>>) -> Handle<A> {
|
||||
let path = path.into().to_owned();
|
||||
let handle = if self.load_context.should_load_dependencies {
|
||||
|
@ -131,7 +134,7 @@ impl<'ctx, 'builder> NestedLoader<'ctx, 'builder> {
|
|||
/// A builder for loading untyped nested assets inside a [`LoadContext`].
|
||||
///
|
||||
/// # Lifetimes
|
||||
/// - `ctx`: the lifetime of the associated [`AssetServer`] reference
|
||||
/// - `ctx`: the lifetime of the associated [`AssetServer`](crate::AssetServer) reference
|
||||
/// - `builder`: the lifetime of the temporary builder structs
|
||||
pub struct UntypedNestedLoader<'ctx, 'builder> {
|
||||
base: NestedLoader<'ctx, 'builder>,
|
||||
|
@ -163,7 +166,7 @@ impl<'ctx, 'builder> UntypedNestedLoader<'ctx, 'builder> {
|
|||
/// A builder for directly loading nested assets inside a `LoadContext`.
|
||||
///
|
||||
/// # Lifetimes
|
||||
/// - `ctx`: the lifetime of the associated [`AssetServer`] reference
|
||||
/// - `ctx`: the lifetime of the associated [`AssetServer`][crate::AssetServer] reference
|
||||
/// - `builder`: the lifetime of the temporary builder structs
|
||||
/// - `reader`: the lifetime of the [`Reader`] reference used to read the asset data
|
||||
pub struct DirectNestedLoader<'ctx, 'builder, 'reader> {
|
||||
|
@ -277,7 +280,7 @@ impl<'ctx: 'reader, 'builder, 'reader> DirectNestedLoader<'ctx, 'builder, 'reade
|
|||
/// A builder for directly loading untyped nested assets inside a `LoadContext`.
|
||||
///
|
||||
/// # Lifetimes
|
||||
/// - `ctx`: the lifetime of the associated [`AssetServer`] reference
|
||||
/// - `ctx`: the lifetime of the associated [`AssetServer`](crate::AssetServer) reference
|
||||
/// - `builder`: the lifetime of the temporary builder structs
|
||||
/// - `reader`: the lifetime of the [`Reader`] reference used to read the asset data
|
||||
pub struct UntypedDirectNestedLoader<'ctx, 'builder, 'reader> {
|
||||
|
|
|
@ -74,7 +74,7 @@ impl<'a> Display for AssetPath<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// An error that occurs when parsing a string type to create an [`AssetPath`] fails, such as during [`AssetPath::parse`] or [`AssetPath::from<'static str>`].
|
||||
/// An error that occurs when parsing a string type to create an [`AssetPath`] fails, such as during [`AssetPath::parse`].
|
||||
#[derive(Error, Debug, PartialEq, Eq)]
|
||||
pub enum ParseAssetPathError {
|
||||
/// Error that occurs when the [`AssetPath::source`] section of a path string contains the [`AssetPath::label`] delimiter `#`. E.g. `bad#source://file.test`.
|
||||
|
|
|
@ -17,7 +17,7 @@ use bevy_reflect::prelude::*;
|
|||
/// # Operations
|
||||
///
|
||||
/// [`Color`] supports all the standard color operations, such as [mixing](Mix),
|
||||
/// [luminance](Luminance) and [hue](Hue) adjustment, [clamping](ClampColor),
|
||||
/// [luminance](Luminance) and [hue](Hue) adjustment,
|
||||
/// and [diffing](EuclideanDistance). These operations delegate to the concrete color space contained
|
||||
/// by [`Color`], but will convert to [`Oklch`](Oklcha) for operations which aren't supported in the
|
||||
/// current space. After performing the operation, if a conversion was required, the result will be
|
||||
|
|
|
@ -17,9 +17,8 @@ use bevy_utils::tracing::info_span;
|
|||
|
||||
use super::AlphaMask3d;
|
||||
|
||||
/// A [`bevy_render::render_graph::Node`] that runs the [`Opaque3d`]
|
||||
/// [`BinnedRenderPhase`] and [`AlphaMask3d`]
|
||||
/// [`bevy_render::render_phase::SortedRenderPhase`]s.
|
||||
/// A [`bevy_render::render_graph::Node`] that runs the [`Opaque3d`] and [`AlphaMask3d`]
|
||||
/// [`ViewBinnedRenderPhases`]s.
|
||||
#[derive(Default)]
|
||||
pub struct MainOpaquePass3dNode;
|
||||
impl ViewNode for MainOpaquePass3dNode {
|
||||
|
|
|
@ -14,7 +14,7 @@ use bevy_utils::tracing::info_span;
|
|||
use std::ops::Range;
|
||||
|
||||
/// A [`bevy_render::render_graph::Node`] that runs the [`Transmissive3d`]
|
||||
/// [`SortedRenderPhase`].
|
||||
/// [`ViewSortedRenderPhases`].
|
||||
#[derive(Default)]
|
||||
pub struct MainTransmissivePass3dNode;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ use bevy_render::{
|
|||
use bevy_utils::tracing::info_span;
|
||||
|
||||
/// A [`bevy_render::render_graph::Node`] that runs the [`Transparent3d`]
|
||||
/// [`SortedRenderPhase`].
|
||||
/// [`ViewSortedRenderPhases`].
|
||||
#[derive(Default)]
|
||||
pub struct MainTransparentPass3dNode;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
//! pinch, you can simply use the default settings (via the [`Default`] trait)
|
||||
//! for a high-quality, high-performance appearance. When using SMAA, you will
|
||||
//! likely want to turn the default MSAA off by inserting the
|
||||
//! [`bevy_render::Msaa::Off`] resource into the [`App`].
|
||||
//! [`bevy_render::view::Msaa::Off`] resource into the [`App`].
|
||||
//!
|
||||
//! Those who have used SMAA in other engines should be aware that Bevy doesn't
|
||||
//! yet support the following more advanced features of SMAA:
|
||||
|
|
|
@ -20,7 +20,7 @@ pub(crate) fn item_struct(
|
|||
user_where_clauses_with_world: Option<&WhereClause>,
|
||||
) -> proc_macro2::TokenStream {
|
||||
let item_attrs = quote!(
|
||||
#[doc = "Automatically generated [`WorldQuery`] item type for [`"]
|
||||
#[doc = "Automatically generated [`WorldQuery`](#path::query::WorldQuery) item type for [`"]
|
||||
#[doc = stringify!(#struct_name)]
|
||||
#[doc = "`], returned when iterating over query results."]
|
||||
#[automatically_derived]
|
||||
|
|
|
@ -192,9 +192,8 @@ impl<'m> SceneEntityMapper<'m> {
|
|||
}
|
||||
|
||||
/// Reserves the allocated references to dead entities within the world. This frees the temporary base
|
||||
/// [`Entity`] while reserving extra generations via [`crate::entity::Entities::reserve_generations`]. Because this
|
||||
/// renders the [`SceneEntityMapper`] unable to safely allocate any more references, this method takes ownership of
|
||||
/// `self` in order to render it unusable.
|
||||
/// [`Entity`] while reserving extra generations. Because this makes the [`SceneEntityMapper`] unable to
|
||||
/// safely allocate any more references, this method takes ownership of `self` in order to render it unusable.
|
||||
pub fn finish(self, world: &mut World) {
|
||||
// SAFETY: Entities data is kept in a valid state via `EntityMap::world_scope`
|
||||
let entities = unsafe { world.entities_mut() };
|
||||
|
|
|
@ -26,6 +26,9 @@ use std::{
|
|||
/// [`World`]: crate::world::World
|
||||
/// [`ComponentId`]: crate::component::ComponentId
|
||||
/// [`Observer`]: crate::observer::Observer
|
||||
/// [`Events<E>`]: super::Events
|
||||
/// [`EventReader`]: super::EventReader
|
||||
/// [`EventWriter`]: super::EventWriter
|
||||
#[diagnostic::on_unimplemented(
|
||||
message = "`{Self}` is not an `Event`",
|
||||
label = "invalid `Event`",
|
||||
|
|
|
@ -81,6 +81,9 @@ use std::ops::{Deref, DerefMut};
|
|||
/// [Example usage.](https://github.com/bevyengine/bevy/blob/latest/examples/ecs/event.rs)
|
||||
/// [Example usage standalone.](https://github.com/bevyengine/bevy/blob/latest/crates/bevy_ecs/examples/events.rs)
|
||||
///
|
||||
/// [`EventReader`]: super::EventReader
|
||||
/// [`EventWriter`]: super::EventWriter
|
||||
/// [`event_update_system`]: super::event_update_system
|
||||
#[derive(Debug, Resource)]
|
||||
#[cfg_attr(feature = "bevy_reflect", derive(Reflect))]
|
||||
pub struct Events<E: Event> {
|
||||
|
@ -111,8 +114,8 @@ impl<E: Event> Events<E> {
|
|||
.min(self.events_b.start_event_count)
|
||||
}
|
||||
|
||||
/// "Sends" an `event` by writing it to the current event buffer. [`EventReader`]s can then read
|
||||
/// the event.
|
||||
/// "Sends" an `event` by writing it to the current event buffer.
|
||||
/// [`EventReader`](super::EventReader)s can then read the event.
|
||||
/// This method returns the [ID](`EventId`) of the sent `event`.
|
||||
pub fn send(&mut self, event: E) -> EventId<E> {
|
||||
let event_id = EventId {
|
||||
|
@ -129,7 +132,7 @@ impl<E: Event> Events<E> {
|
|||
event_id
|
||||
}
|
||||
|
||||
/// Sends a list of `events` all at once, which can later be read by [`EventReader`]s.
|
||||
/// Sends a list of `events` all at once, which can later be read by [`EventReader`](super::EventReader)s.
|
||||
/// This is more efficient than sending each event individually.
|
||||
/// This method returns the [IDs](`EventId`) of the sent `events`.
|
||||
pub fn send_batch(&mut self, events: impl IntoIterator<Item = E>) -> SendBatchIds<E> {
|
||||
|
@ -263,6 +266,8 @@ impl<E: Event> Events<E> {
|
|||
/// between the last `update()` call and your call to `iter_current_update_events`.
|
||||
/// If events happen outside that window, they will not be handled. For example, any events that
|
||||
/// happen after this call and before the next `update()` call will be dropped.
|
||||
///
|
||||
/// [`EventReader`]: super::EventReader
|
||||
pub fn iter_current_update_events(&self) -> impl ExactSizeIterator<Item = &E> {
|
||||
self.events_b.iter().map(|i| &i.event)
|
||||
}
|
||||
|
|
|
@ -58,6 +58,9 @@ pub type ManualEventReader<E> = EventCursor<E>;
|
|||
///
|
||||
/// # bevy_ecs::system::assert_is_system(send_and_receive_events);
|
||||
/// ```
|
||||
///
|
||||
/// [`EventReader`]: super::EventReader
|
||||
/// [`EventMutator`]: super::EventMutator
|
||||
#[derive(Debug)]
|
||||
pub struct EventCursor<E: Event> {
|
||||
pub(super) last_event_count: usize,
|
||||
|
@ -84,22 +87,22 @@ impl<E: Event> Clone for EventCursor<E> {
|
|||
|
||||
#[allow(clippy::len_without_is_empty)] // Check fails since the is_empty implementation has a signature other than `(&self) -> bool`
|
||||
impl<E: Event> EventCursor<E> {
|
||||
/// See [`EventReader::read`]
|
||||
/// See [`EventReader::read`](super::EventReader::read)
|
||||
pub fn read<'a>(&'a mut self, events: &'a Events<E>) -> EventIterator<'a, E> {
|
||||
self.read_with_id(events).without_id()
|
||||
}
|
||||
|
||||
/// See [`EventMutator::read`]
|
||||
/// See [`EventMutator::read`](super::EventMutator::read)
|
||||
pub fn read_mut<'a>(&'a mut self, events: &'a mut Events<E>) -> EventMutIterator<'a, E> {
|
||||
self.read_mut_with_id(events).without_id()
|
||||
}
|
||||
|
||||
/// See [`EventReader::read_with_id`]
|
||||
/// See [`EventReader::read_with_id`](super::EventReader::read_with_id)
|
||||
pub fn read_with_id<'a>(&'a mut self, events: &'a Events<E>) -> EventIteratorWithId<'a, E> {
|
||||
EventIteratorWithId::new(self, events)
|
||||
}
|
||||
|
||||
/// See [`EventMutator::read_with_id`]
|
||||
/// See [`EventMutator::read_with_id`](super::EventMutator::read_with_id)
|
||||
pub fn read_mut_with_id<'a>(
|
||||
&'a mut self,
|
||||
events: &'a mut Events<E>,
|
||||
|
@ -107,19 +110,19 @@ impl<E: Event> EventCursor<E> {
|
|||
EventMutIteratorWithId::new(self, events)
|
||||
}
|
||||
|
||||
/// See [`EventReader::par_read`]
|
||||
/// See [`EventReader::par_read`](super::EventReader::par_read)
|
||||
#[cfg(feature = "multi_threaded")]
|
||||
pub fn par_read<'a>(&'a mut self, events: &'a Events<E>) -> EventParIter<'a, E> {
|
||||
EventParIter::new(self, events)
|
||||
}
|
||||
|
||||
/// See [`EventMutator::par_read`]
|
||||
/// See [`EventMutator::par_read`](super::EventMutator::par_read)
|
||||
#[cfg(feature = "multi_threaded")]
|
||||
pub fn par_read_mut<'a>(&'a mut self, events: &'a mut Events<E>) -> EventMutParIter<'a, E> {
|
||||
EventMutParIter::new(self, events)
|
||||
}
|
||||
|
||||
/// See [`EventReader::len`]
|
||||
/// See [`EventReader::len`](super::EventReader::len)
|
||||
pub fn len(&self, events: &Events<E>) -> usize {
|
||||
// The number of events in this reader is the difference between the most recent event
|
||||
// and the last event seen by it. This will be at most the number of events contained
|
||||
|
@ -138,12 +141,12 @@ impl<E: Event> EventCursor<E> {
|
|||
.saturating_sub(self.last_event_count)
|
||||
}
|
||||
|
||||
/// See [`EventReader::is_empty()`]
|
||||
/// See [`EventReader::is_empty()`](super::EventReader::is_empty)
|
||||
pub fn is_empty(&self, events: &Events<E>) -> bool {
|
||||
self.len(events) == 0
|
||||
}
|
||||
|
||||
/// See [`EventReader::clear()`]
|
||||
/// See [`EventReader::clear()`](super::EventReader::clear)
|
||||
pub fn clear(&mut self, events: &Events<E>) {
|
||||
self.last_event_count = events.event_count;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ use bevy_ecs::event::{Event, EventCursor, EventId, EventInstance, Events};
|
|||
use bevy_utils::detailed_trace;
|
||||
use std::{iter::Chain, slice::Iter};
|
||||
|
||||
/// An iterator that yields any unread events from an [`EventReader`] or [`EventCursor`].
|
||||
/// An iterator that yields any unread events from an [`EventReader`](super::EventReader) or [`EventCursor`].
|
||||
#[derive(Debug)]
|
||||
pub struct EventIterator<'a, E: Event> {
|
||||
iter: EventIteratorWithId<'a, E>,
|
||||
|
@ -43,7 +43,7 @@ impl<'a, E: Event> ExactSizeIterator for EventIterator<'a, E> {
|
|||
}
|
||||
}
|
||||
|
||||
/// An iterator that yields any unread events (and their IDs) from an [`EventReader`] or [`EventCursor`].
|
||||
/// An iterator that yields any unread events (and their IDs) from an [`EventReader`](super::EventReader) or [`EventCursor`].
|
||||
#[derive(Debug)]
|
||||
pub struct EventIteratorWithId<'a, E: Event> {
|
||||
reader: &'a mut EventCursor<E>,
|
||||
|
|
|
@ -6,6 +6,8 @@ use bevy_utils::detailed_trace;
|
|||
use std::{iter::Chain, slice::IterMut};
|
||||
|
||||
/// An iterator that yields any unread events from an [`EventMutator`] or [`EventCursor`].
|
||||
///
|
||||
/// [`EventMutator`]: super::EventMutator
|
||||
#[derive(Debug)]
|
||||
pub struct EventMutIterator<'a, E: Event> {
|
||||
iter: EventMutIteratorWithId<'a, E>,
|
||||
|
@ -44,6 +46,8 @@ impl<'a, E: Event> ExactSizeIterator for EventMutIterator<'a, E> {
|
|||
}
|
||||
|
||||
/// An iterator that yields any unread events (and their IDs) from an [`EventMutator`] or [`EventCursor`].
|
||||
///
|
||||
/// [`EventMutator`]: super::EventMutator
|
||||
#[derive(Debug)]
|
||||
pub struct EventMutIteratorWithId<'a, E: Event> {
|
||||
mutator: &'a mut EventCursor<E>,
|
||||
|
|
|
@ -40,6 +40,8 @@ use bevy_ecs::{
|
|||
/// Most of the time systems will want to use [`EventMutator::read()`]. This function creates an iterator over
|
||||
/// all events that haven't been read yet by this system, marking the event as read in the process.
|
||||
///
|
||||
/// [`EventReader`]: super::EventReader
|
||||
/// [`EventWriter`]: super::EventWriter
|
||||
#[derive(SystemParam, Debug)]
|
||||
pub struct EventMutator<'w, 's, E: Event> {
|
||||
pub(super) reader: Local<'s, EventCursor<E>>,
|
||||
|
@ -54,13 +56,13 @@ impl<'w, 's, E: Event> EventMutator<'w, 's, E> {
|
|||
self.reader.read_mut(&mut self.events)
|
||||
}
|
||||
|
||||
/// Like [`read`](Self::read), except also returning the [`EventId`] of the events.
|
||||
/// Like [`read`](Self::read), except also returning the [`EventId`](super::EventId) of the events.
|
||||
pub fn read_with_id(&mut self) -> EventMutIteratorWithId<'_, E> {
|
||||
self.reader.read_mut_with_id(&mut self.events)
|
||||
}
|
||||
|
||||
/// Returns a parallel iterator over the events this [`EventMutator`] has not seen yet.
|
||||
/// See also [`for_each`](EventParIter::for_each).
|
||||
/// See also [`for_each`](super::EventParIter::for_each).
|
||||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
|
|
|
@ -12,6 +12,8 @@ use bevy_ecs::{
|
|||
///
|
||||
/// Unlike [`EventWriter<T>`], systems with `EventReader<T>` param can be executed concurrently
|
||||
/// (but not concurrently with `EventWriter<T>` or `EventMutator<T>` systems for the same event type).
|
||||
///
|
||||
/// [`EventWriter<T>`]: super::EventWriter
|
||||
#[derive(SystemParam, Debug)]
|
||||
pub struct EventReader<'w, 's, E: Event> {
|
||||
pub(super) reader: Local<'s, EventCursor<E>>,
|
||||
|
@ -26,7 +28,7 @@ impl<'w, 's, E: Event> EventReader<'w, 's, E> {
|
|||
self.reader.read(&self.events)
|
||||
}
|
||||
|
||||
/// Like [`read`](Self::read), except also returning the [`EventId`] of the events.
|
||||
/// Like [`read`](Self::read), except also returning the [`EventId`](super::EventId) of the events.
|
||||
pub fn read_with_id(&mut self) -> EventIteratorWithId<'_, E> {
|
||||
self.reader.read_with_id(&self.events)
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ pub fn signal_event_update_system(signal: Option<ResMut<EventRegistry>>) {
|
|||
}
|
||||
}
|
||||
|
||||
/// A system that calls [`Events::update`] on all registered [`Events`] in the world.
|
||||
/// A system that calls [`Events::update`](super::Events::update) on all registered [`Events`][super::Events] in the world.
|
||||
pub fn event_update_system(world: &mut World, mut last_change_tick: Local<Tick>) {
|
||||
if world.contains_resource::<EventRegistry>() {
|
||||
world.resource_scope(|world, mut registry: Mut<EventRegistry>| {
|
||||
|
|
|
@ -65,7 +65,7 @@ pub struct EventWriter<'w, E: Event> {
|
|||
}
|
||||
|
||||
impl<'w, E: Event> EventWriter<'w, E> {
|
||||
/// Sends an `event`, which can later be read by [`EventReader`]s.
|
||||
/// Sends an `event`, which can later be read by [`EventReader`](super::EventReader)s.
|
||||
/// This method returns the [ID](`EventId`) of the sent `event`.
|
||||
///
|
||||
/// See [`Events`] for details.
|
||||
|
@ -73,7 +73,7 @@ impl<'w, E: Event> EventWriter<'w, E> {
|
|||
self.events.send(event)
|
||||
}
|
||||
|
||||
/// Sends a list of `events` all at once, which can later be read by [`EventReader`]s.
|
||||
/// Sends a list of `events` all at once, which can later be read by [`EventReader`](super::EventReader)s.
|
||||
/// This is more efficient than sending each event individually.
|
||||
/// This method returns the [IDs](`EventId`) of the sent `events`.
|
||||
///
|
||||
|
|
|
@ -84,7 +84,7 @@ impl Component for ObserverState {
|
|||
}
|
||||
|
||||
/// Type for function that is run when an observer is triggered.
|
||||
/// Typically refers to the default runner that runs the system stored in the associated [`ObserverSystemComponent`],
|
||||
/// Typically refers to the default runner that runs the system stored in the associated [`Observer`] component,
|
||||
/// but can be overridden for custom behaviour.
|
||||
pub type ObserverRunner = fn(DeferredWorld, ObserverTrigger, PtrMut);
|
||||
|
||||
|
@ -390,7 +390,7 @@ fn observer_system_runner<E: Event, B: Bundle>(
|
|||
// This transmute is obviously not ideal, but it is safe. Ideally we can remove the
|
||||
// static constraint from ObserverSystem, but so far we have not found a way.
|
||||
let trigger: Trigger<'static, E, B> = unsafe { std::mem::transmute(trigger) };
|
||||
// SAFETY: Observer was triggered so must have an `ObserverSystemComponent`
|
||||
// SAFETY: Observer was triggered so must have an `Observer` component.
|
||||
let system = unsafe {
|
||||
&mut observer_cell
|
||||
.get_mut::<Observer<E, B>>()
|
||||
|
|
|
@ -750,12 +750,16 @@ impl<'w, 's> Commands<'w, 's> {
|
|||
|
||||
/// Sends a "global" [`Trigger`] without any targets. This will run any [`Observer`] of the `event` that
|
||||
/// isn't scoped to specific targets.
|
||||
///
|
||||
/// [`Trigger`]: crate::observer::Trigger
|
||||
pub fn trigger(&mut self, event: impl Event) {
|
||||
self.add(TriggerEvent { event, targets: () });
|
||||
}
|
||||
|
||||
/// Sends a [`Trigger`] for the given targets. This will run any [`Observer`] of the `event` that
|
||||
/// watches those targets.
|
||||
///
|
||||
/// [`Trigger`]: crate::observer::Trigger
|
||||
pub fn trigger_targets(&mut self, event: impl Event, targets: impl TriggerTargets) {
|
||||
self.add(TriggerEvent { event, targets });
|
||||
}
|
||||
|
@ -1144,7 +1148,7 @@ impl EntityCommands<'_> {
|
|||
self.commands.reborrow()
|
||||
}
|
||||
|
||||
/// Creates an [`Observer`](crate::observer::Observer) listening for a trigger of type `T` that targets this entity.
|
||||
/// Creates an [`Observer`] listening for a trigger of type `T` that targets this entity.
|
||||
pub fn observe<E: Event, B: Bundle, M>(
|
||||
&mut self,
|
||||
system: impl IntoObserverSystem<E, B, M>,
|
||||
|
|
|
@ -8,6 +8,8 @@ use crate::{
|
|||
use super::IntoSystem;
|
||||
|
||||
/// Implemented for systems that have an [`Observer`] as the first argument.
|
||||
///
|
||||
/// [`Observer`]: crate::observer::Observer
|
||||
pub trait ObserverSystem<E: 'static, B: Bundle>:
|
||||
System<In = Trigger<'static, E, B>, Out = ()> + Send + 'static
|
||||
{
|
||||
|
|
|
@ -368,12 +368,12 @@ impl<'w> DeferredWorld<'w> {
|
|||
Observers::invoke(self.reborrow(), event, entity, components, data);
|
||||
}
|
||||
|
||||
/// Sends a "global" [`Trigger`] without any targets.
|
||||
/// Sends a "global" [`Trigger`](crate::observer::Trigger) without any targets.
|
||||
pub fn trigger<T: Event>(&mut self, trigger: impl Event) {
|
||||
self.commands().trigger(trigger);
|
||||
}
|
||||
|
||||
/// Sends a [`Trigger`] with the given `targets`.
|
||||
/// Sends a [`Trigger`](crate::observer::Trigger) with the given `targets`.
|
||||
pub fn trigger_targets(&mut self, trigger: impl Event, targets: impl TriggerTargets) {
|
||||
self.commands().trigger_targets(trigger, targets);
|
||||
}
|
||||
|
|
|
@ -1410,7 +1410,7 @@ impl<'w> EntityWorldMut<'w> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Creates an [`Observer`](crate::observer::Observer) listening for events of type `E` targeting this entity.
|
||||
/// Creates an [`Observer`] listening for events of type `E` targeting this entity.
|
||||
/// In order to trigger the callback the entity must also match the query when the event is fired.
|
||||
pub fn observe<E: Event, B: Bundle, M>(
|
||||
&mut self,
|
||||
|
|
|
@ -812,8 +812,8 @@ impl World {
|
|||
unsafe { self.get_entities_dynamic_mut_unchecked(entities.iter().copied()) }
|
||||
}
|
||||
|
||||
/// Gets mutable access to multiple entities, contained in a [`HashSet`].
|
||||
/// The uniqueness of items in a [`HashSet`] allows us to avoid checking for duplicates.
|
||||
/// Gets mutable access to multiple entities, contained in a [`EntityHashSet`].
|
||||
/// The uniqueness of items in a [`EntityHashSet`] allows us to avoid checking for duplicates.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
|
@ -2037,7 +2037,7 @@ impl World {
|
|||
}
|
||||
}
|
||||
|
||||
/// Calls both [`World::flush_entities`] and [`World::flush_commands`].
|
||||
/// Flushes queued entities and calls [`World::flush_commands`].
|
||||
#[inline]
|
||||
pub fn flush(&mut self) {
|
||||
self.flush_entities();
|
||||
|
|
|
@ -306,7 +306,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
/// Builder for configuring the drawing options of [`Sphere`].
|
||||
/// A builder returned by [`Gizmos::sphere`].
|
||||
pub struct SphereBuilder<'a, 'w, 's, Config, Clear>
|
||||
where
|
||||
Config: GizmoConfigGroup,
|
||||
|
|
|
@ -29,7 +29,7 @@ use bevy_app::{Plugin, PluginGroup, PluginGroupBuilder};
|
|||
/// * [`GilrsPlugin`](crate::gilrs::GilrsPlugin) - with feature `bevy_gilrs`
|
||||
/// * [`AnimationPlugin`](crate::animation::AnimationPlugin) - with feature `bevy_animation`
|
||||
/// * [`GizmoPlugin`](crate::gizmos::GizmoPlugin) - with feature `bevy_gizmos`
|
||||
/// * [`StatesPlugin`](crate::app::StatesPlugin) - with feature `bevy_state`
|
||||
/// * [`StatesPlugin`](crate::state::app::StatesPlugin) - with feature `bevy_state`
|
||||
/// * [`DevToolsPlugin`](crate::dev_tools::DevToolsPlugin) - with feature `bevy_dev_tools`
|
||||
/// * [`CiTestingPlugin`](crate::dev_tools::ci_testing::CiTestingPlugin) - with feature `bevy_ci_testing`
|
||||
///
|
||||
|
|
|
@ -147,8 +147,8 @@ pub struct LogPlugin {
|
|||
///
|
||||
/// Because [`BoxedLayer`] takes a `dyn Layer`, `Vec<Layer>` is also an acceptable return value.
|
||||
///
|
||||
/// Access to [`App`] is also provided to allow for communication between the [`Subscriber`]
|
||||
/// and the [`App`].
|
||||
/// Access to [`App`] is also provided to allow for communication between the
|
||||
/// [`Subscriber`](bevy_utils::tracing::Subscriber) and the [`App`].
|
||||
///
|
||||
/// Please see the `examples/log_layers.rs` for a complete example.
|
||||
pub custom_layer: fn(app: &mut App) -> Option<BoxedLayer>,
|
||||
|
|
|
@ -19,7 +19,7 @@ pub struct RayCast3d {
|
|||
}
|
||||
|
||||
impl RayCast3d {
|
||||
/// Construct a [`RayCast3d`] from an origin, [`Dir3`], and max distance.
|
||||
/// Construct a [`RayCast3d`] from an origin, [`Dir3A`], and max distance.
|
||||
pub fn new(origin: impl Into<Vec3A>, direction: impl Into<Dir3A>, max: f32) -> Self {
|
||||
let direction = direction.into();
|
||||
Self {
|
||||
|
@ -108,7 +108,7 @@ pub struct AabbCast3d {
|
|||
}
|
||||
|
||||
impl AabbCast3d {
|
||||
/// Construct an [`AabbCast3d`] from an [`Aabb3d`], origin, [`Dir3`], and max distance.
|
||||
/// Construct an [`AabbCast3d`] from an [`Aabb3d`], origin, [`Dir3A`], and max distance.
|
||||
pub fn new(
|
||||
aabb: Aabb3d,
|
||||
origin: impl Into<Vec3A>,
|
||||
|
@ -151,7 +151,7 @@ pub struct BoundingSphereCast {
|
|||
}
|
||||
|
||||
impl BoundingSphereCast {
|
||||
/// Construct a [`BoundingSphereCast`] from a [`BoundingSphere`], origin, [`Dir3`], and max distance.
|
||||
/// Construct a [`BoundingSphereCast`] from a [`BoundingSphere`], origin, [`Dir3A`], and max distance.
|
||||
pub fn new(
|
||||
sphere: BoundingSphere,
|
||||
origin: impl Into<Vec3A>,
|
||||
|
|
|
@ -5,7 +5,7 @@ use bevy_reflect::Reflect;
|
|||
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
|
||||
|
||||
/// A compass enum with 4 directions.
|
||||
/// ``` ignore
|
||||
/// ```text
|
||||
/// N (North)
|
||||
/// ▲
|
||||
/// │
|
||||
|
@ -35,7 +35,7 @@ pub enum CompassQuadrant {
|
|||
}
|
||||
|
||||
/// A compass enum with 8 directions.
|
||||
/// ``` ignore
|
||||
/// ```text
|
||||
/// N (North)
|
||||
/// ▲
|
||||
/// NW │ NE
|
||||
|
|
|
@ -16,7 +16,8 @@ pub mod wireframe;
|
|||
/// Expect bugs, missing features, compatibility issues, low performance, and/or future breaking changes.
|
||||
#[cfg(feature = "meshlet")]
|
||||
pub mod experimental {
|
||||
/// Render high-poly 3d meshes using an efficient GPU-driven method. See [`MeshletPlugin`] and [`MeshletMesh`] for details.
|
||||
/// Render high-poly 3d meshes using an efficient GPU-driven method.
|
||||
/// See [`MeshletPlugin`](meshlet::MeshletPlugin) and [`MeshletMesh`](meshlet::MeshletMesh) for details.
|
||||
pub mod meshlet {
|
||||
pub use crate::meshlet::*;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,8 @@ use crate::*;
|
|||
|
||||
/// An enum to define which UV attribute to use for a texture.
|
||||
/// It is used for every texture in the [`StandardMaterial`].
|
||||
/// It only supports two UV attributes, [`Mesh::ATTRIBUTE_UV_0`] and [`Mesh::ATTRIBUTE_UV_1`].
|
||||
/// It only supports two UV attributes, [`bevy_render::mesh::Mesh::ATTRIBUTE_UV_0`] and
|
||||
/// [`bevy_render::mesh::Mesh::ATTRIBUTE_UV_1`].
|
||||
/// The default is [`UvChannel::Uv0`].
|
||||
#[derive(Reflect, Default, Debug, Clone, PartialEq, Eq)]
|
||||
#[reflect(Default, Debug)]
|
||||
|
|
|
@ -505,11 +505,11 @@ pub enum RenderMeshInstanceGpuQueue {
|
|||
#[default]
|
||||
None,
|
||||
/// The version of [`RenderMeshInstanceGpuQueue`] that omits the
|
||||
/// [`MeshCullingDataGpuBuilder`], so that we don't waste space when GPU
|
||||
/// [`MeshCullingData`], so that we don't waste space when GPU
|
||||
/// culling is disabled.
|
||||
CpuCulling(Vec<(Entity, RenderMeshInstanceGpuBuilder)>),
|
||||
/// The version of [`RenderMeshInstanceGpuQueue`] that contains the
|
||||
/// [`MeshCullingDataGpuBuilder`], used when any view has GPU culling
|
||||
/// [`MeshCullingData`], used when any view has GPU culling
|
||||
/// enabled.
|
||||
GpuCulling(Vec<(Entity, RenderMeshInstanceGpuBuilder, MeshCullingData)>),
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ pub struct SkinIndex {
|
|||
}
|
||||
|
||||
impl SkinIndex {
|
||||
/// Index to be in address space based on [`SkinUniform`] size.
|
||||
/// Index to be in address space based on the size of a skin uniform.
|
||||
const fn new(start: usize) -> Self {
|
||||
SkinIndex {
|
||||
index: (start * std::mem::size_of::<Mat4>()) as u32,
|
||||
|
|
|
@ -84,7 +84,7 @@ pub const VOLUMETRIC_FOG_HANDLE: Handle<Shader> = Handle::weak_from_u128(1740005
|
|||
/// A plugin that implements volumetric fog.
|
||||
pub struct VolumetricFogPlugin;
|
||||
|
||||
/// Add this component to a [`DirectionalLight`] with a shadow map
|
||||
/// Add this component to a [`DirectionalLight`](crate::DirectionalLight) with a shadow map
|
||||
/// (`shadows_enabled: true`) to make volumetric fog interact with it.
|
||||
///
|
||||
/// This allows the light to generate light shafts/god rays.
|
||||
|
|
|
@ -26,6 +26,8 @@ impl PickingPluginsSettings {
|
|||
pub fn input_should_run(state: Res<Self>) -> bool {
|
||||
state.is_input_enabled && state.is_enabled
|
||||
}
|
||||
// TODO: remove this allow after focus/hover is implemented in bevy_picking
|
||||
#[allow(rustdoc::broken_intra_doc_links)]
|
||||
/// Whether or not systems updating entities' [`PickingInteraction`](focus::PickingInteraction)
|
||||
/// component should be running.
|
||||
pub fn focus_should_run(state: Res<Self>) -> bool {
|
||||
|
@ -70,6 +72,8 @@ pub struct Pickable {
|
|||
///
|
||||
/// Entities without the [`Pickable`] component will block by default.
|
||||
pub should_block_lower: bool,
|
||||
// TODO: remove this allow after focus/hover is implemented in bevy_picking
|
||||
#[allow(rustdoc::broken_intra_doc_links)]
|
||||
/// Should this entity be added to the [`HoverMap`](focus::HoverMap) and thus emit events when
|
||||
/// targeted?
|
||||
///
|
||||
|
|
|
@ -7,7 +7,7 @@ use std::any::TypeId;
|
|||
///
|
||||
/// These attributes can be created with the [`Reflect` derive macro].
|
||||
///
|
||||
/// Attributes are stored by their [`TypeId`](std::any::TypeId).
|
||||
/// Attributes are stored by their [`TypeId`].
|
||||
/// Because of this, there can only be one attribute per type.
|
||||
///
|
||||
/// # Example
|
||||
|
@ -150,6 +150,7 @@ macro_rules! impl_custom_attribute_methods {
|
|||
$self.custom_attributes().get::<T>()
|
||||
}
|
||||
|
||||
#[allow(rustdoc::redundant_explicit_links)]
|
||||
/// Gets a custom attribute by its [`TypeId`](std::any::TypeId).
|
||||
///
|
||||
/// This is the dynamic equivalent of [`get_attribute`](Self::get_attribute).
|
||||
|
|
|
@ -5,8 +5,8 @@ use crate::TypePath;
|
|||
|
||||
/// Type information for an [`Arg`] used in a [`DynamicFunction`].
|
||||
///
|
||||
/// [`Arg`]: crate::func::args::Arg
|
||||
/// [`DynamicFunction`]: super::function::DynamicFunction
|
||||
/// [`Arg`]: crate::func::Arg
|
||||
/// [`DynamicFunction`]: crate::func::DynamicFunction
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ArgInfo {
|
||||
/// The index of the argument within its function.
|
||||
|
@ -57,6 +57,7 @@ impl ArgInfo {
|
|||
/// For [`DynamicFunctions`] created using [`IntoFunction`], the name will always be `None`.
|
||||
///
|
||||
/// [`DynamicFunctions`]: crate::func::DynamicFunction
|
||||
/// [`IntoFunction`]: crate::func::IntoFunction
|
||||
pub fn name(&self) -> Option<&str> {
|
||||
self.name.as_deref()
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ impl FunctionInfo {
|
|||
/// the name will always be the full path to the function as returned by [`std::any::type_name`].
|
||||
///
|
||||
/// [`DynamicFunctions`]: crate::func::DynamicFunction
|
||||
/// [`IntoFunction`]: crate::func::IntoFunction
|
||||
pub fn name(&self) -> Option<&str> {
|
||||
self.name.as_deref()
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! Mesh generation for [primitive shapes](bevy_math::primitives).
|
||||
//!
|
||||
//! Primitives that support meshing implement the [`Meshable`] trait.
|
||||
//! Calling [`mesh`](Meshable::mesh) will return either a [`Mesh`](super::Mesh) or a builder
|
||||
//! that can be used to specify shape-specific configuration for creating the [`Mesh`](super::Mesh).
|
||||
//! Calling [`mesh`](Meshable::mesh) will return either a [`Mesh`] or a builder
|
||||
//! that can be used to specify shape-specific configuration for creating the [`Mesh`].
|
||||
//!
|
||||
//! ```
|
||||
//! # use bevy_asset::Assets;
|
||||
|
@ -30,12 +30,12 @@ pub use extrusion::*;
|
|||
|
||||
use super::Mesh;
|
||||
|
||||
/// A trait for shapes that can be turned into a [`Mesh`](super::Mesh).
|
||||
/// A trait for shapes that can be turned into a [`Mesh`].
|
||||
pub trait Meshable {
|
||||
/// The output of [`Self::mesh`]. This will be a [`MeshBuilder`] used for creating a [`Mesh`](super::Mesh).
|
||||
/// The output of [`Self::mesh`]. This will be a [`MeshBuilder`] used for creating a [`Mesh`].
|
||||
type Output: MeshBuilder;
|
||||
|
||||
/// Creates a [`Mesh`](super::Mesh) for a shape.
|
||||
/// Creates a [`Mesh`] for a shape.
|
||||
fn mesh(&self) -> Self::Output;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ pub struct RunSubGraph {
|
|||
}
|
||||
|
||||
/// The context with all graph information required to run a [`Node`](super::Node).
|
||||
/// This context is created for each node by the [`RenderGraphRunner`](crate::renderer::graph_runner::RenderGraphRunner).
|
||||
/// This context is created for each node by the render graph runner.
|
||||
///
|
||||
/// The slot input can be read from here and the outputs must be written back to the context for
|
||||
/// passing them onto the next node.
|
||||
|
|
|
@ -26,7 +26,7 @@ pub type InternedRenderSubGraph = Interned<dyn RenderSubGraph>;
|
|||
/// It is a retained and stateless (nodes themselves may have their own internal state) structure,
|
||||
/// which can not be modified while it is executed by the graph runner.
|
||||
///
|
||||
/// The [`RenderGraphRunner`](crate::renderer::graph_runner::RenderGraphRunner) is responsible for executing the entire graph each frame.
|
||||
/// The render graph runner is responsible for executing the entire graph each frame.
|
||||
/// It will execute each node in the graph in the correct order, based on the edges between the nodes.
|
||||
///
|
||||
/// It consists of three main components: [`Nodes`](Node), [`Edges`](Edge)
|
||||
|
|
|
@ -105,7 +105,7 @@ impl<T: NoUninit> RawBufferVec<T> {
|
|||
|
||||
/// Changes the debugging label of the buffer.
|
||||
///
|
||||
/// The next time the buffer is updated (via [`reserve`]), Bevy will inform
|
||||
/// The next time the buffer is updated (via [`reserve`](Self::reserve)), Bevy will inform
|
||||
/// the driver of the new label.
|
||||
pub fn set_label(&mut self, label: Option<&str>) {
|
||||
let label = label.map(str::to_string);
|
||||
|
@ -201,7 +201,7 @@ impl<T: NoUninit> Extend<T> for RawBufferVec<T> {
|
|||
/// For performance reasons, unlike [`RawBufferVec`], this type doesn't allow
|
||||
/// CPU access to the data after it's been added via [`BufferVec::push`]. If you
|
||||
/// need CPU access to the data, consider another type, such as
|
||||
/// [`StorageBuffer`].
|
||||
/// [`StorageBuffer`][super::StorageBuffer].
|
||||
pub struct BufferVec<T>
|
||||
where
|
||||
T: ShaderType + WriteInto,
|
||||
|
@ -284,7 +284,7 @@ where
|
|||
|
||||
/// Changes the debugging label of the buffer.
|
||||
///
|
||||
/// The next time the buffer is updated (via [`reserve`]), Bevy will inform
|
||||
/// The next time the buffer is updated (via [`Self::reserve`]), Bevy will inform
|
||||
/// the driver of the new label.
|
||||
pub fn set_label(&mut self, label: Option<&str>) {
|
||||
let label = label.map(str::to_string);
|
||||
|
|
|
@ -24,12 +24,12 @@ impl<T: ShaderType + ShaderSize + WriteInto + Clone> GpuArrayBufferable for T {}
|
|||
/// binding (within reasonable limits).
|
||||
///
|
||||
/// Other options for storing GPU-accessible data are:
|
||||
/// * [`StorageBuffer`]
|
||||
/// * [`StorageBuffer`](crate::render_resource::StorageBuffer)
|
||||
/// * [`DynamicStorageBuffer`](crate::render_resource::DynamicStorageBuffer)
|
||||
/// * [`UniformBuffer`](crate::render_resource::UniformBuffer)
|
||||
/// * [`DynamicUniformBuffer`](crate::render_resource::DynamicUniformBuffer)
|
||||
/// * [`RawBufferVec`](crate::render_resource::RawBufferVec)
|
||||
/// * [`BufferVec`](crate::render_resource::BufferVec)
|
||||
/// * [`BufferVec`]
|
||||
/// * [`Texture`](crate::render_resource::Texture)
|
||||
#[derive(Resource)]
|
||||
pub enum GpuArrayBuffer<T: GpuArrayBufferable> {
|
||||
|
|
|
@ -19,7 +19,7 @@ use crate::{
|
|||
/// The [`RenderGraphRunner`] is responsible for executing a [`RenderGraph`].
|
||||
///
|
||||
/// It will run all nodes in the graph sequentially in the correct order (defined by the edges).
|
||||
/// Each [`Node`](crate::render_graph::node::Node) can run any arbitrary code, but will generally
|
||||
/// Each [`Node`](crate::render_graph::Node) can run any arbitrary code, but will generally
|
||||
/// either send directly a [`CommandBuffer`] or a task that will asynchronously generate a [`CommandBuffer`]
|
||||
///
|
||||
/// After running the graph, the [`RenderGraphRunner`] will execute in parallel all the tasks to get
|
||||
|
|
|
@ -12,7 +12,7 @@ use crate::state::{
|
|||
};
|
||||
use crate::state_scoped::clear_state_scoped_entities;
|
||||
|
||||
/// State installation methods for [`App`](bevy_app::App) and [`SubApp`](bevy_app::SubApp).
|
||||
/// State installation methods for [`App`] and [`SubApp`].
|
||||
pub trait AppExtStates {
|
||||
/// Initializes a [`State`] with standard starting values.
|
||||
///
|
||||
|
@ -20,7 +20,7 @@ pub trait AppExtStates {
|
|||
///
|
||||
/// Adds [`State<S>`] and [`NextState<S>`] resources, and enables use of the [`OnEnter`](crate::state::OnEnter),
|
||||
/// [`OnTransition`](crate::state::OnTransition) and [`OnExit`](crate::state::OnExit) schedules.
|
||||
/// These schedules are triggered before [`Update`](bevy_app::main_schedule::Update) and at startup.
|
||||
/// These schedules are triggered before [`Update`](bevy_app::Update) and at startup.
|
||||
///
|
||||
/// If you would like to control how other systems run based on the current state, you can
|
||||
/// emulate this behavior using the [`in_state`](crate::condition::in_state) [`Condition`](bevy_ecs::prelude::Condition).
|
||||
|
@ -34,7 +34,7 @@ pub trait AppExtStates {
|
|||
///
|
||||
/// Adds [`State<S>`] and [`NextState<S>`] resources, and enables use of the [`OnEnter`](crate::state::OnEnter),
|
||||
/// [`OnTransition`](crate::state::OnTransition) and [`OnExit`](crate::state::OnExit) schedules.
|
||||
/// These schedules are triggered before [`Update`](bevy_app::main_schedule::Update) and at startup.
|
||||
/// These schedules are triggered before [`Update`](bevy_app::Update) and at startup.
|
||||
///
|
||||
/// If you would like to control how other systems run based on the current state, you can
|
||||
/// emulate this behavior using the [`in_state`](crate::condition::in_state) [`Condition`](bevy_ecs::prelude::Condition).
|
||||
|
|
|
@ -35,7 +35,8 @@ pub mod condition;
|
|||
/// Provides definitions for the basic traits required by the state system
|
||||
pub mod state;
|
||||
|
||||
/// Provides [`StateScoped`] and [`clear_state_scoped_entities`] for managing lifetime of entities.
|
||||
/// Provides [`StateScoped`](crate::state_scoped::StateScoped) and
|
||||
/// [`clear_state_scoped_entities`](crate::state_scoped::clear_state_scoped_entities) for managing lifetime of entities.
|
||||
pub mod state_scoped;
|
||||
|
||||
/// Most commonly used re-exported types.
|
||||
|
|
|
@ -16,9 +16,9 @@ use bevy_ecs::prelude::ReflectResource;
|
|||
///
|
||||
/// The current state value can be accessed through this resource. To *change* the state,
|
||||
/// queue a transition in the [`NextState<S>`] resource, and it will be applied during the
|
||||
/// [`StateTransition`](crate::transition::StateTransition) schedule - which by default runs after `PreUpdate`.
|
||||
/// [`StateTransition`](crate::state::StateTransition) schedule - which by default runs after `PreUpdate`.
|
||||
///
|
||||
/// You can also manually trigger the [`StateTransition`](crate::transition::StateTransition) schedule to apply the changes
|
||||
/// You can also manually trigger the [`StateTransition`](crate::state::StateTransition) schedule to apply the changes
|
||||
/// at an arbitrary time.
|
||||
///
|
||||
/// The starting state is defined via the [`Default`] implementation for `S`.
|
||||
|
@ -93,7 +93,7 @@ impl<S: States> Deref for State<S> {
|
|||
/// To queue a transition, call [`NextState::set`] or mutate the value to [`NextState::Pending`] directly.
|
||||
///
|
||||
/// Note that these transitions can be overridden by other systems:
|
||||
/// only the actual value of this resource during the [`StateTransition`](crate::transition::StateTransition) schedule matters.
|
||||
/// only the actual value of this resource during the [`StateTransition`](crate::state::StateTransition) schedule matters.
|
||||
///
|
||||
/// ```
|
||||
/// use bevy_state::prelude::*;
|
||||
|
|
|
@ -71,7 +71,8 @@ pub struct StateTransitionEvent<S: States> {
|
|||
/// These system sets are run sequentially, in the order of the enum variants.
|
||||
#[derive(SystemSet, Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub(crate) enum StateTransitionSteps {
|
||||
/// States apply their transitions from [`NextState`] and compute functions based on their parent states.
|
||||
/// States apply their transitions from [`NextState`](super::NextState)
|
||||
/// and compute functions based on their parent states.
|
||||
DependentTransitions,
|
||||
/// Exit schedules are executed in leaf to root order
|
||||
ExitSchedules,
|
||||
|
|
|
@ -21,7 +21,7 @@ use crate::{GlyphAtlasLocation, TextError};
|
|||
/// providing a trade-off between visual quality and performance.
|
||||
///
|
||||
/// A [`CacheKey`](cosmic_text::CacheKey) encodes all of the information of a subpixel-offset glyph and is used to
|
||||
/// find that glyphs raster in a [`TextureAtlas`] through its corresponding [`GlyphAtlasLocation`].
|
||||
/// find that glyphs raster in a [`TextureAtlas`](bevy_sprite::TextureAtlas) through its corresponding [`GlyphAtlasLocation`].
|
||||
pub struct FontAtlas {
|
||||
/// Used to update the [`TextureAtlasLayout`].
|
||||
pub dynamic_texture_atlas_builder: DynamicTextureAtlasBuilder,
|
||||
|
|
|
@ -3,7 +3,7 @@ use bevy_asset::{io::Reader, AssetLoader, LoadContext};
|
|||
use thiserror::Error;
|
||||
|
||||
#[derive(Default)]
|
||||
/// An [`AssetLoader`] for [`Font`]s, for use by the [`AssetServer`]
|
||||
/// An [`AssetLoader`] for [`Font`]s, for use by the [`AssetServer`](bevy_asset::AssetServer)
|
||||
pub struct FontLoader;
|
||||
|
||||
/// Possible errors that can be produced by [`FontLoader`]
|
||||
|
|
|
@ -56,11 +56,11 @@ impl PositionedGlyph {
|
|||
pub struct GlyphAtlasInfo {
|
||||
/// A handle to the [`Image`] data for the texture atlas this glyph was placed in.
|
||||
///
|
||||
/// A (weak) clone of the handle held by the [`FontAtlas`].
|
||||
/// A (weak) clone of the handle held by the [`FontAtlas`](crate::FontAtlas).
|
||||
pub texture: Handle<Image>,
|
||||
/// A handle to the [`TextureAtlasLayout`] map for the texture atlas this glyph was placed in.
|
||||
///
|
||||
/// A (weak) clone of the handle held by the [`FontAtlas`].
|
||||
/// A (weak) clone of the handle held by the [`FontAtlas`](crate::FontAtlas).
|
||||
pub texture_atlas: Handle<TextureAtlasLayout>,
|
||||
/// Location and offset of a glyph within the texture atlas.
|
||||
pub location: GlyphAtlasLocation,
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
//! Note that text measurement is only relevant in a UI context.
|
||||
//!
|
||||
//! With the actual text bounds defined, the `bevy_ui::widget::text::text_system` system (in a UI context)
|
||||
//! or [`bevy_text::text2d::update_text2d_layout`] system (in a 2d world space context)
|
||||
//! or [`text2d::update_text2d_layout`] system (in a 2d world space context)
|
||||
//! passes it into [`TextPipeline::queue_text`], which:
|
||||
//!
|
||||
//! 1. creates a [`Buffer`](cosmic_text::Buffer) from the [`TextSection`]s, generating new [`FontAtlasSet`]s if necessary.
|
||||
|
|
|
@ -358,7 +358,7 @@ fn load_font_to_fontdb(
|
|||
});
|
||||
}
|
||||
|
||||
/// Translates [`TextSection`] to [`Attrs`](cosmic_text::attrs::Attrs),
|
||||
/// Translates [`TextSection`] to [`Attrs`],
|
||||
/// loading fonts into the [`Database`](cosmic_text::fontdb::Database) if required.
|
||||
fn get_attrs<'a>(
|
||||
section: &TextSection,
|
||||
|
|
|
@ -3,7 +3,7 @@ use bevy_ecs::bundle::Bundle;
|
|||
use crate::prelude::{GlobalTransform, Transform};
|
||||
|
||||
/// A [`Bundle`] of the [`Transform`] and [`GlobalTransform`]
|
||||
/// [`Component`]s, which describe the position of an entity.
|
||||
/// [`Component`](bevy_ecs::component::Component)s, which describe the position of an entity.
|
||||
///
|
||||
/// * To place or move an entity, you should set its [`Transform`].
|
||||
/// * To get the global transform of an entity, you should get its [`GlobalTransform`].
|
||||
|
@ -18,9 +18,9 @@ use crate::prelude::{GlobalTransform, Transform};
|
|||
/// [`GlobalTransform`] is the position of an entity relative to the reference frame.
|
||||
///
|
||||
/// [`GlobalTransform`] is updated from [`Transform`] by systems in the system set
|
||||
/// [`TransformPropagate`](TransformSystem::TransformPropagate).
|
||||
/// [`TransformPropagate`](crate::TransformSystem::TransformPropagate).
|
||||
///
|
||||
/// This system runs during [`PostUpdate`]. If you
|
||||
/// This system runs during [`PostUpdate`](bevy_app::PostUpdate). If you
|
||||
/// update the [`Transform`] of an entity in this schedule or after, you will notice a 1 frame lag
|
||||
/// before the [`GlobalTransform`] is updated.
|
||||
#[derive(Clone, Copy, Debug, Default, Bundle)]
|
||||
|
@ -41,7 +41,7 @@ impl TransformBundle {
|
|||
/// Creates a new [`TransformBundle`] from a [`Transform`].
|
||||
///
|
||||
/// This initializes [`GlobalTransform`] as identity, to be updated later by the
|
||||
/// [`PostUpdate`] schedule.
|
||||
/// [`bevy_app::PostUpdate`] schedule.
|
||||
#[inline]
|
||||
pub const fn from_transform(transform: Transform) -> Self {
|
||||
TransformBundle {
|
||||
|
|
|
@ -14,7 +14,7 @@ use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
|||
/// [`Transform`] instead.
|
||||
/// * To get the global transform of an entity, you should get its [`GlobalTransform`].
|
||||
/// * For transform hierarchies to work correctly, you must have both a [`Transform`] and a [`GlobalTransform`].
|
||||
/// * You may use the [`TransformBundle`](crate::TransformBundle) to guarantee this.
|
||||
/// * You may use the [`TransformBundle`](crate::bundles::TransformBundle) to guarantee this.
|
||||
///
|
||||
/// ## [`Transform`] and [`GlobalTransform`]
|
||||
///
|
||||
|
|
|
@ -12,7 +12,7 @@ use std::ops::Mul;
|
|||
/// * To place or move an entity, you should set its [`Transform`].
|
||||
/// * To get the global transform of an entity, you should get its [`GlobalTransform`].
|
||||
/// * To be displayed, an entity must have both a [`Transform`] and a [`GlobalTransform`].
|
||||
/// * You may use the [`TransformBundle`](crate::TransformBundle) to guarantee this.
|
||||
/// * You may use the [`TransformBundle`](crate::bundles::TransformBundle) to guarantee this.
|
||||
///
|
||||
/// ## [`Transform`] and [`GlobalTransform`]
|
||||
///
|
||||
|
|
|
@ -21,6 +21,7 @@ pub mod traits;
|
|||
#[cfg(feature = "bevy-support")]
|
||||
pub mod plugins;
|
||||
|
||||
/// [`GlobalTransform`]: components::GlobalTransform
|
||||
/// Helpers related to computing global transforms
|
||||
#[cfg(feature = "bevy-support")]
|
||||
pub mod helper;
|
||||
|
|
|
@ -281,28 +281,29 @@ pub struct Window {
|
|||
/// [`wgpu::SurfaceConfiguration::desired_maximum_frame_latency`]:
|
||||
/// https://docs.rs/wgpu/latest/wgpu/type.SurfaceConfiguration.html#structfield.desired_maximum_frame_latency
|
||||
pub desired_maximum_frame_latency: Option<NonZeroU32>,
|
||||
/// Sets whether this window recognizes [`PinchGesture`]
|
||||
/// Sets whether this window recognizes [`PinchGesture`](https://docs.rs/bevy/latest/bevy/input/gestures/struct.PinchGesture.html)
|
||||
///
|
||||
/// ## Platform-specific
|
||||
///
|
||||
/// - Only used on iOS.
|
||||
/// - On macOS, they are recognized by default and can't be disabled.
|
||||
pub recognize_pinch_gesture: bool,
|
||||
/// Sets whether this window recognizes [`RotationGesture`]
|
||||
/// Sets whether this window recognizes [`RotationGesture`](https://docs.rs/bevy/latest/bevy/input/gestures/struct.RotationGesture.html)
|
||||
///
|
||||
/// ## Platform-specific
|
||||
///
|
||||
/// - Only used on iOS.
|
||||
/// - On macOS, they are recognized by default and can't be disabled.
|
||||
pub recognize_rotation_gesture: bool,
|
||||
/// Sets whether this window recognizes [`DoubleTapGesture`]
|
||||
/// Sets whether this window recognizes [`DoubleTapGesture`](https://docs.rs/bevy/latest/bevy/input/gestures/struct.DoubleTapGesture.html)
|
||||
///
|
||||
/// ## Platform-specific
|
||||
///
|
||||
/// - Only used on iOS.
|
||||
/// - On macOS, they are recognized by default and can't be disabled.
|
||||
pub recognize_doubletap_gesture: bool,
|
||||
/// Sets whether this window recognizes [`PanGesture`], with a number of fingers between the first value and the last.
|
||||
/// Sets whether this window recognizes [`PanGesture`](https://docs.rs/bevy/latest/bevy/input/gestures/struct.PanGesture.html),
|
||||
/// with a number of fingers between the first value and the last.
|
||||
///
|
||||
/// ## Platform-specific
|
||||
///
|
||||
|
|
|
@ -28,7 +28,7 @@ use bevy_window::{PrimaryWindow, Window, WindowClosed};
|
|||
#[derive(Default, Deref, DerefMut)]
|
||||
pub struct AccessKitAdapters(pub EntityHashMap<Adapter>);
|
||||
|
||||
/// Maps window entities to their respective [`WinitActionRequests`]s.
|
||||
/// Maps window entities to their respective [`ActionRequest`]s.
|
||||
#[derive(Resource, Default, Deref, DerefMut)]
|
||||
pub struct WinitActionRequestHandlers(pub EntityHashMap<Arc<Mutex<WinitActionRequestHandler>>>);
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ pub struct WinitPlugin<T: Event = WakeUp> {
|
|||
/// Allows the window (and the event loop) to be created on any thread
|
||||
/// instead of only the main thread.
|
||||
///
|
||||
/// See [`EventLoopBuilder::build`] for more information on this.
|
||||
/// See [`EventLoopBuilder::build`](winit::event_loop::EventLoopBuilder::build) for more information on this.
|
||||
///
|
||||
/// # Supported platforms
|
||||
///
|
||||
|
@ -142,7 +142,7 @@ impl<T: Event> Plugin for WinitPlugin<T> {
|
|||
#[derive(Debug, Default, Clone, Copy, Event)]
|
||||
pub struct WakeUp;
|
||||
|
||||
/// The [`winit::event_loop::EventLoopProxy`] with the specific [`winit::event::Event::UserEvent`] used in the [`winit_runner`].
|
||||
/// A re-export of [`winit::event_loop::EventLoopProxy`].
|
||||
///
|
||||
/// The `EventLoopProxy` can be used to request a redraw from outside bevy.
|
||||
///
|
||||
|
|
|
@ -54,7 +54,7 @@ struct WinitAppRunnerState<T: Event> {
|
|||
window_event_received: bool,
|
||||
/// Is `true` if a new [`DeviceEvent`] event has been received since the last update.
|
||||
device_event_received: bool,
|
||||
/// Is `true` if a new [`T`] event has been received since the last update.
|
||||
/// Is `true` if a new `T` event has been received since the last update.
|
||||
user_event_received: bool,
|
||||
/// Is `true` if the app has requested a redraw since the last update.
|
||||
redraw_requested: bool,
|
||||
|
@ -739,7 +739,7 @@ impl<T: Event> WinitAppRunnerState<T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// The default [`App::runner`] for the [`WinitPlugin`] plugin.
|
||||
/// The default [`App::runner`] for the [`WinitPlugin`](crate::WinitPlugin) plugin.
|
||||
///
|
||||
/// Overriding the app's [runner](bevy_app::App::runner) while using `WinitPlugin` will bypass the
|
||||
/// `EventLoop`.
|
||||
|
|
|
@ -14,7 +14,7 @@ impl WinitSettings {
|
|||
/// Default settings for games.
|
||||
///
|
||||
/// [`Continuous`](UpdateMode::Continuous) if windows have focus,
|
||||
/// [`ReactiveLowPower`](UpdateMode::ReactiveLowPower) otherwise.
|
||||
/// [`reactive_low_power`](UpdateMode::reactive_low_power) otherwise.
|
||||
pub fn game() -> Self {
|
||||
WinitSettings {
|
||||
focused_mode: UpdateMode::Continuous,
|
||||
|
@ -25,7 +25,7 @@ impl WinitSettings {
|
|||
/// Default settings for desktop applications.
|
||||
///
|
||||
/// [`Reactive`](UpdateMode::Reactive) if windows have focus,
|
||||
/// [`ReactiveLowPower`](UpdateMode::ReactiveLowPower) otherwise.
|
||||
/// [`reactive_low_power`](UpdateMode::reactive_low_power) otherwise.
|
||||
///
|
||||
/// Use the [`EventLoopProxy`](crate::EventLoopProxy) to request a redraw from outside bevy.
|
||||
pub fn desktop_app() -> Self {
|
||||
|
|
|
@ -12,9 +12,10 @@ impl Prepare for DocCheckCommand {
|
|||
vec![PreparedCommand::new::<Self>(
|
||||
cmd!(
|
||||
sh,
|
||||
"cargo doc --workspace --all-features --no-deps --document-private-items"
|
||||
"cargo doc --workspace --all-features --no-deps --document-private-items --keep-going"
|
||||
),
|
||||
"Please fix doc warnings in output above.",
|
||||
)]
|
||||
)
|
||||
.with_env_var("RUSTDOCFLAGS", "-D warnings")]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue