From c207e331425ab89863b8104fdde28e52cdd321dc Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Sat, 11 Nov 2023 00:04:25 +0700 Subject: [PATCH] docs: Fix typos, formatting, linking. --- src/editor/mod.rs | 5 ++++- src/editor/ui/inspector/mod.rs | 2 +- src/editor/ui/inspector/refl_impl.rs | 8 ++++---- src/editor/ui_registration.rs | 2 +- src/lib.rs | 4 ++-- src/prefab/component/material.rs | 4 ++-- src/prefab/component/mod.rs | 2 +- src/prefab/component/player_start.rs | 4 +++- src/prefab/component/shape.rs | 2 +- src/prefab/spawn_system.rs | 8 +++++--- 10 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/editor/mod.rs b/src/editor/mod.rs index 8a741f47..723e8f38 100644 --- a/src/editor/mod.rs +++ b/src/editor/mod.rs @@ -28,7 +28,10 @@ pub mod prelude { pub use super::ui::*; } -/// Editor UI plugin. Must be used with PrefabPlugin and EditorRegistryPlugin +/// Editor UI plugin. Must be used with [`PrefabPlugin`] and [`EditorRegistryPlugin`] +/// +/// [`PrefabPlugin`]: crate::PrefabPlugin +/// [`EditorRegistryPlugin`]: crate::editor_registry::EditorRegistryPlugin pub struct EditorPlugin; impl Plugin for EditorPlugin { diff --git a/src/editor/ui/inspector/mod.rs b/src/editor/ui/inspector/mod.rs index dcdffa4e..1d9838f1 100644 --- a/src/editor/ui/inspector/mod.rs +++ b/src/editor/ui/inspector/mod.rs @@ -76,7 +76,7 @@ fn register_custom_impls(registry: Res) { )); } -/// Function form bevy_inspector_egui to split component to data ptr and "set changed" function +/// Function form `bevy_inspector_egui` to split component to data ptr and "set changed" function pub fn mut_untyped_split(mut mut_untyped: MutUntyped<'_>) -> (PtrMut<'_>, impl FnMut() + '_) { // bypass_change_detection returns a `&mut PtrMut` which is basically useless, because all its methods take `self` let ptr = mut_untyped.bypass_change_detection(); diff --git a/src/editor/ui/inspector/refl_impl.rs b/src/editor/ui/inspector/refl_impl.rs index a7ec4e64..f3dddd99 100644 --- a/src/editor/ui/inspector/refl_impl.rs +++ b/src/editor/ui/inspector/refl_impl.rs @@ -11,7 +11,7 @@ use bevy_inspector_egui::{ use crate::prefab::component::EntityLink; -/// Method from bevy_inspector_egui to make dummy reflection ui +/// Method from `bevy_inspector_egui` to make dummy reflection ui pub fn many_unimplemented( _ui: &mut egui::Ui, _options: &dyn Any, @@ -23,7 +23,7 @@ pub fn many_unimplemented( false } -/// Custom UI for EntityLink struct +/// Custom UI for [`EntityLink`] struct pub fn setup_ref_registry(reg: ResMut) { let mut reg = reg.write(); reg.get_mut(TypeId::of::()) @@ -35,7 +35,7 @@ pub fn setup_ref_registry(reg: ResMut) { )) } -/// Custom UI for EntityLink struct +/// Custom UI for [`EntityLink`] struct pub fn entity_ref_ui( value: &mut dyn Any, ui: &mut egui::Ui, @@ -74,7 +74,7 @@ pub fn entity_ref_ui( } } -/// Custom UI for EntityLink struct +/// Custom UI for [`EntityLink`] struct pub fn entity_ref_ui_readonly( _value: &dyn Any, _ui: &mut egui::Ui, diff --git a/src/editor/ui_registration.rs b/src/editor/ui_registration.rs index c557fb33..b1f05fa0 100644 --- a/src/editor/ui_registration.rs +++ b/src/editor/ui_registration.rs @@ -54,7 +54,7 @@ impl EditorBundleUntyped { } } -/// Train to add editor_bundle(..) to App +/// Trait to add `editor_bundle(..)` to App pub trait EditorUiExt { /// Register new bundle in editor ui fn editor_bundle(&mut self, category: &str, name: &str, bundle: T); diff --git a/src/lib.rs b/src/lib.rs index a09153d3..e2edb449 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,7 +13,7 @@ pub mod prefab; /// Module contains custom registry options to store clone functions and bundles in UI pub mod editor_registry; -/// Optional editor extensions (like activate bevy_xpbd support in editor) +/// Optional editor extensions (like activate `bevy_xpbd` support in editor) pub mod optional; use bevy::{pbr::CascadeShadowConfigBuilder, prelude::*}; @@ -82,7 +82,7 @@ pub struct PrefabMarker; #[reflect(Component)] pub struct EditorCameraMarker; -/// Editor states (Editor, GamePrepare, Game) +/// Editor states (`Editor`, `GamePrepare`, `Game`) #[derive(States, Default, Debug, Clone, Hash, Eq, PartialEq)] pub enum EditorState { Editor, diff --git a/src/prefab/component/material.rs b/src/prefab/component/material.rs index f8f8805d..4d2ab31e 100644 --- a/src/prefab/component/material.rs +++ b/src/prefab/component/material.rs @@ -1,6 +1,6 @@ use crate::ext::*; -/// Prefab component that store parameters and asset paths for creating StandardMaterial +/// Prefab component that store parameters and asset paths for creating [`StandardMaterial`] #[derive(Component, Reflect, Clone)] #[reflect(Default, Component)] pub struct MaterialPrefab { @@ -67,7 +67,7 @@ fn try_image(path: &String, asset_server: &AssetServer) -> Option> } impl MaterialPrefab { - /// Convert MaterialPrefab to StandardMaterial + /// Convert [`MaterialPrefab`] to [`StandardMaterial`] pub fn to_material(&self, asset_server: &AssetServer) -> StandardMaterial { let base_color_texture = try_image(&self.base_color_texture, asset_server); let emissive_texture = try_image(&self.emissive_texture, asset_server); diff --git a/src/prefab/component/mod.rs b/src/prefab/component/mod.rs index 05438483..6de0d8c4 100644 --- a/src/prefab/component/mod.rs +++ b/src/prefab/component/mod.rs @@ -96,7 +96,7 @@ impl AutoStruct { } } -/// This component used in prefab to determine links between entities. Its need to create custom UI in bevy_inspector_egui. You must implement MapEntities trait for your component to make it work. See FollowCamera struct from examples/platformer.rs +/// This component used in prefab to determine links between entities. It is needed to create custom UI in `bevy_inspector_egui`. You must implement the [`MapEntities`](bevy::ecs::entity::MapEntities) trait for your component to make it work. See the `FollowCamera` struct from `examples/platformer.rs`. #[derive(Reflect, Clone)] #[reflect(Default)] pub struct EntityLink { diff --git a/src/prefab/component/player_start.rs b/src/prefab/component/player_start.rs index a12bf2fb..e52568c8 100644 --- a/src/prefab/component/player_start.rs +++ b/src/prefab/component/player_start.rs @@ -1,6 +1,8 @@ use crate::ext::*; -/// Entities with this component will spawn prefab on enter to EditorState::Game state +/// Entities with this component will spawn prefab on enter to [`EditorState::Game`] state +/// +/// [`EditorState::Game`]: crate::EditorState::Game #[derive(Component, Reflect, Clone)] #[reflect(Component, Default)] pub struct PlayerStart { diff --git a/src/prefab/component/shape.rs b/src/prefab/component/shape.rs index dab13a07..60bdf30d 100644 --- a/src/prefab/component/shape.rs +++ b/src/prefab/component/shape.rs @@ -28,7 +28,7 @@ impl Default for MeshPrimitivePrefab { } impl MeshPrimitivePrefab { - /// Convert MeshPrimitivePrefab to bevy Mesh + /// Convert [`MeshPrimitivePrefab`] to bevy [`Mesh`] pub fn to_mesh(&self) -> Mesh { match self { MeshPrimitivePrefab::Cube(s) => Mesh::from(shape::Cube::new(*s)), diff --git a/src/prefab/spawn_system.rs b/src/prefab/spawn_system.rs index 0f4959f3..bd8702e5 100644 --- a/src/prefab/spawn_system.rs +++ b/src/prefab/spawn_system.rs @@ -58,7 +58,7 @@ pub fn spawn_scene( } } -/// System to sync Mesh and MeshPrimitivePrefab +/// System to sync [`Mesh`] and [`MeshPrimitivePrefab`] pub fn sync_mesh( mut commands: Commands, query: Query<(Entity, &MeshPrimitivePrefab), Changed>, @@ -70,7 +70,7 @@ pub fn sync_mesh( } } -/// System to sync StandardMaterial and MaterialPrefab +/// System to sync [`StandardMaterial`] and [`MaterialPrefab`] pub fn sync_material( mut commands: Commands, query: Query<(Entity, &MaterialPrefab), Changed>, @@ -96,7 +96,9 @@ pub fn editor_remove_mesh( } } -/// Spawn system on enter to EditorState::Game state +/// Spawn system on enter to [`EditorState::Game`] state +/// +/// [`EditorState::Game`]: crate::EditorState::Game pub fn spawn_player_start( mut commands: Commands, query: Query<(Entity, &PlayerStart)>,