Skip to content

Commit

Permalink
(docs: Fix typos, formatting, linking) Merge pull request #58 from wa…
Browse files Browse the repository at this point in the history
…ywardmonkeys/doc-improvements

docs: Fix typos, formatting, linking.
  • Loading branch information
rewin123 authored Nov 11, 2023
2 parents 50b9d32 + c207e33 commit 37dc8c9
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 17 deletions.
5 changes: 4 additions & 1 deletion src/editor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/editor/ui/inspector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn register_custom_impls(registry: Res<AppTypeRegistry>) {
));
}

/// 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();
Expand Down
8 changes: 4 additions & 4 deletions src/editor/ui/inspector/refl_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: Any>(
_ui: &mut egui::Ui,
_options: &dyn Any,
Expand All @@ -23,7 +23,7 @@ pub fn many_unimplemented<T: Any>(
false
}

/// Custom UI for EntityLink struct
/// Custom UI for [`EntityLink`] struct
pub fn setup_ref_registry(reg: ResMut<AppTypeRegistry>) {
let mut reg = reg.write();
reg.get_mut(TypeId::of::<EntityLink>())
Expand All @@ -35,7 +35,7 @@ pub fn setup_ref_registry(reg: ResMut<AppTypeRegistry>) {
))
}

/// Custom UI for EntityLink struct
/// Custom UI for [`EntityLink`] struct
pub fn entity_ref_ui(
value: &mut dyn Any,
ui: &mut egui::Ui,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/editor/ui_registration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: Bundle + Clone>(&mut self, category: &str, name: &str, bundle: T);
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*};
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/prefab/component/material.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -67,7 +67,7 @@ fn try_image(path: &String, asset_server: &AssetServer) -> Option<Handle<Image>>
}

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);
Expand Down
2 changes: 1 addition & 1 deletion src/prefab/component/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl<T: Reflect + FromReflect + Default + Clone> AutoStruct<T> {
}
}

/// 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 {
Expand Down
4 changes: 3 additions & 1 deletion src/prefab/component/player_start.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/prefab/component/shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
8 changes: 5 additions & 3 deletions src/prefab/spawn_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<MeshPrimitivePrefab>>,
Expand All @@ -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<MaterialPrefab>>,
Expand All @@ -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)>,
Expand Down

0 comments on commit 37dc8c9

Please sign in to comment.