pub struct EditorState {Show 16 fields
pub mode: EditorMode,
pub config: EditorConfig,
pub camera: EditorCamera,
pub selection: SelectionSet,
pub undo_history: UndoHistory,
pub layout: EditorLayout,
pub shortcuts: ShortcutRegistry,
pub stats: EditorStats,
pub grid: GridRenderer,
pub entity_positions: HashMap<EntityId, Vec3>,
pub entity_names: HashMap<EntityId, String>,
pub entity_properties: HashMap<EntityId, HashMap<String, String>>,
pub entity_groups: HashMap<EntityId, Vec<EntityId>>,
pub dirty: bool,
pub scene_path: Option<String>,
pub next_entity_id: u32,
}Expand description
The top-level editor state. Owns everything the editor needs to function.
Fields§
§mode: EditorMode§config: EditorConfig§camera: EditorCamera§selection: SelectionSet§undo_history: UndoHistory§layout: EditorLayout§shortcuts: ShortcutRegistry§stats: EditorStats§grid: GridRenderer§entity_positions: HashMap<EntityId, Vec3>§entity_names: HashMap<EntityId, String>§entity_properties: HashMap<EntityId, HashMap<String, String>>§entity_groups: HashMap<EntityId, Vec<EntityId>>§dirty: bool§scene_path: Option<String>§next_entity_id: u32Implementations§
Source§impl EditorState
impl EditorState
pub fn new(config: EditorConfig) -> Self
Sourcepub fn alloc_entity_id(&mut self) -> EntityId
pub fn alloc_entity_id(&mut self) -> EntityId
Allocate a fresh EntityId.
Sourcepub fn set_mode(&mut self, mode: EditorMode)
pub fn set_mode(&mut self, mode: EditorMode)
Switch the editor mode.
Sourcepub fn do_command(&mut self, cmd: Box<dyn EditorCommand>)
pub fn do_command(&mut self, cmd: Box<dyn EditorCommand>)
Execute an undoable command.
pub fn undo(&mut self) -> bool
pub fn redo(&mut self) -> bool
Sourcepub fn handle_shortcut(&mut self, shortcut: &Shortcut) -> Option<EditorAction>
pub fn handle_shortcut(&mut self, shortcut: &Shortcut) -> Option<EditorAction>
Process a keyboard shortcut.
Sourcepub fn snap_position(&self, pos: Vec3) -> Vec3
pub fn snap_position(&self, pos: Vec3) -> Vec3
Snap a world-space position to the snap grid.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EditorState
impl !RefUnwindSafe for EditorState
impl Send for EditorState
impl Sync for EditorState
impl Unpin for EditorState
impl UnsafeUnpin for EditorState
impl !UnwindSafe for EditorState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.