Files
Blacksite/crates/editor/src/ui/component_registry.rs
T
Rbanh 2fa64106c8
CI / Format, lint, test, build (push) Waiting to run
Polish inspector add component workflow
2026-06-06 03:08:28 -04:00

246 lines
11 KiB
Rust

//! Editor-visible component registry for actor inspector palettes.
use bevy::prelude::*;
use egui_phosphor_icons::icons;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum EditorComponentCategory {
Authoring,
Rendering,
Physics,
Gameplay,
Volumes,
Editor,
}
#[derive(Debug, Clone)]
pub struct EditorComponentDescriptor {
pub type_name: &'static str,
pub display_name: &'static str,
pub category: EditorComponentCategory,
pub addable: bool,
pub removable: bool,
pub reorderable: bool,
pub hidden: bool,
pub icon: &'static str,
pub description: &'static str,
pub search_terms: &'static [&'static str],
pub recommended: &'static [&'static str],
pub conflicts_with: &'static [&'static str],
pub hydration_effect: &'static str,
}
#[derive(Resource, Debug, Clone)]
pub struct EditorComponentRegistry {
pub descriptors: Vec<EditorComponentDescriptor>,
}
impl Default for EditorComponentRegistry {
fn default() -> Self {
Self {
descriptors: vec![
EditorComponentDescriptor {
type_name: "shared::components::StaticMeshRenderer",
display_name: "Static Mesh Renderer",
category: EditorComponentCategory::Rendering,
addable: true,
removable: true,
reorderable: true,
hidden: false,
icon: icons::CUBE.as_str(),
description: "Renders one or more normalized imported mesh slots.",
search_terms: &["mesh", "renderer", "rendering", "model", "static"],
recommended: &[],
conflicts_with: &["shared::components::Primitive"],
hydration_effect:
"Hydrates into generated mesh children and material bindings.",
},
EditorComponentDescriptor {
type_name: "shared::components::MaterialDesc",
display_name: "Authoring Material",
category: EditorComponentCategory::Rendering,
addable: true,
removable: true,
reorderable: true,
hidden: false,
icon: icons::PALETTE.as_str(),
description: "Defines an authored material directly on this actor.",
search_terms: &["material", "shader", "texture"],
recommended: &[],
conflicts_with: &[],
hydration_effect: "Hydrates into Bevy material assets for renderable actors.",
},
EditorComponentDescriptor {
type_name: "shared::components::RigidBodyDesc",
display_name: "Rigid Body",
category: EditorComponentCategory::Physics,
addable: true,
removable: true,
reorderable: true,
hidden: false,
icon: icons::SPHERE.as_str(),
description: "Controls authored rigid-body behavior for physics hydration.",
search_terms: &["body", "physics", "rigidbody"],
recommended: &["shared::components::ColliderDesc"],
conflicts_with: &[],
hydration_effect: "Hydrates into runtime Avian rigid-body state.",
},
EditorComponentDescriptor {
type_name: "shared::components::ColliderDesc",
display_name: "Collider",
category: EditorComponentCategory::Physics,
addable: true,
removable: true,
reorderable: true,
hidden: false,
icon: icons::SELECTION.as_str(),
description: "Defines authored collision shape data.",
search_terms: &["collision", "trigger", "physics"],
recommended: &["shared::components::RigidBodyDesc"],
conflicts_with: &[],
hydration_effect: "Hydrates into runtime Avian collider state.",
},
EditorComponentDescriptor {
type_name: "shared::components::LightDesc",
display_name: "Light",
category: EditorComponentCategory::Rendering,
addable: true,
removable: true,
reorderable: true,
hidden: false,
icon: icons::LIGHTBULB.as_str(),
description: "Adds authored point, spot, directional, or area lighting.",
search_terms: &["light", "lamp", "illumination", "sun"],
recommended: &[],
conflicts_with: &[],
hydration_effect: "Hydrates into runtime Bevy light components.",
},
EditorComponentDescriptor {
type_name: "shared::components::Primitive",
display_name: "Primitive",
category: EditorComponentCategory::Authoring,
addable: true,
removable: true,
reorderable: true,
hidden: false,
icon: icons::CUBE.as_str(),
description: "Creates an authored built-in primitive shape.",
search_terms: &["box", "sphere", "ramp", "primitive"],
recommended: &[],
conflicts_with: &["shared::components::StaticMeshRenderer"],
hydration_effect:
"Hydrates into generated primitive render and collision data.",
},
EditorComponentDescriptor {
type_name: "shared::components::PlayerSpawn",
display_name: "Player Spawn",
category: EditorComponentCategory::Gameplay,
addable: true,
removable: true,
reorderable: true,
hidden: false,
icon: icons::PERSON_SIMPLE_RUN.as_str(),
description: "Marks where Play mode should spawn the player.",
search_terms: &["player", "spawn", "start"],
recommended: &[],
conflicts_with: &[],
hydration_effect:
"Used by PIE/session startup; no saved runtime player is created.",
},
EditorComponentDescriptor {
type_name: "shared::components::WeaponSpawn",
display_name: "Weapon Spawn",
category: EditorComponentCategory::Gameplay,
addable: true,
removable: true,
reorderable: true,
hidden: false,
icon: icons::CROSSHAIR.as_str(),
description: "Marks a gameplay weapon spawn point.",
search_terms: &["weapon", "spawn"],
recommended: &[],
conflicts_with: &[],
hydration_effect: "Hydrates into gameplay spawn metadata.",
},
EditorComponentDescriptor {
type_name: "shared::components::TriggerVolume",
display_name: "Trigger Volume",
category: EditorComponentCategory::Volumes,
addable: true,
removable: true,
reorderable: true,
hidden: false,
icon: icons::SELECTION.as_str(),
description: "Adds an authored gameplay trigger volume.",
search_terms: &["trigger", "volume", "event"],
recommended: &[],
conflicts_with: &[],
hydration_effect: "Hydrates into gameplay trigger queries and visualizers.",
},
EditorComponentDescriptor {
type_name: "shared::components::TeamSpawn",
display_name: "Team Spawn",
category: EditorComponentCategory::Gameplay,
addable: true,
removable: true,
reorderable: true,
hidden: false,
icon: icons::FLAG.as_str(),
description: "Marks a gameplay team spawn point.",
search_terms: &["team", "spawn"],
recommended: &[],
conflicts_with: &[],
hydration_effect: "Hydrates into gameplay spawn metadata.",
},
EditorComponentDescriptor {
type_name: "shared::components::ObjectiveMarker",
display_name: "Objective Marker",
category: EditorComponentCategory::Gameplay,
addable: true,
removable: true,
reorderable: true,
hidden: false,
icon: icons::FLAG.as_str(),
description: "Marks an authored gameplay objective location.",
search_terms: &["objective", "marker", "gameplay"],
recommended: &[],
conflicts_with: &[],
hydration_effect: "Hydrates into gameplay objective metadata.",
},
EditorComponentDescriptor {
type_name: "shared::components::PostProcessVolumeDesc",
display_name: "Post-Process Volume",
category: EditorComponentCategory::Volumes,
addable: true,
removable: true,
reorderable: true,
hidden: false,
icon: icons::APERTURE.as_str(),
description: "Adds a local rendering profile override volume.",
search_terms: &["post", "process", "volume", "rendering", "fx"],
recommended: &[],
conflicts_with: &[],
hydration_effect:
"Affects active camera rendering when the camera is inside the volume.",
},
EditorComponentDescriptor {
type_name: "shared::components::InspectorOrder",
display_name: "Inspector Order",
category: EditorComponentCategory::Editor,
addable: false,
removable: false,
reorderable: false,
hidden: true,
icon: icons::LIST_BULLETS.as_str(),
description: "Stores editor-only component ordering and active-state metadata.",
search_terms: &["editor", "order"],
recommended: &[],
conflicts_with: &[],
hydration_effect:
"Controls editor presentation and authoring component active state.",
},
],
}
}
}