pub struct AssetBrowserPanel {Show 17 fields
state: Arc<Mutex<EditorState>>,
theme: UiTheme,
search_filter: String,
flat: Vec<FlatAsset>,
asset_dirs: Vec<String>,
last_epoch: Option<u64>,
selected_filter: Option<AssetTileKind>,
selected_index: Option<usize>,
renaming_index: Option<usize>,
rename_buffer: String,
renaming_folder: Option<String>,
folder_rename_buffer: String,
rename_focus_pending: bool,
current_folder: Option<String>,
expanded_folders: HashMap<String, bool>,
confirm_delete: Option<(String, bool)>,
grid_scroll: ScrollState,
}Fields§
§state: Arc<Mutex<EditorState>>§theme: UiTheme§search_filter: String§flat: Vec<FlatAsset>§asset_dirs: Vec<String>Every real directory under assets/ (forward-slash, relative), mirrored
from EditorState::asset_dirs so empty / freshly-created folders show up
in the tree even though the file-only VFS never lists them.
last_epoch: Option<u64>Last EditorState::asset_epoch we rebuilt flat for; a mismatch drives
the rescan (an in-place edit that doesn’t change the entry count used to
be missed by the old (folder, len) key).
selected_filter: Option<AssetTileKind>§selected_index: Option<usize>§renaming_index: Option<usize>flat index of the tile currently being inline-renamed, if any.
rename_buffer: StringEdit buffer backing both the tile and folder inline-rename fields.
renaming_folder: Option<String>Forward-slash path of the folder currently being inline-renamed, if any.
folder_rename_buffer: StringEdit buffer for the folder inline-rename field.
rename_focus_pending: booltrue on the frame a rename starts, so the inline field grabs keyboard
focus once (not every frame, which would trap focus).
current_folder: Option<String>Forward-slash folder path (relative to assets/) currently
selected in the tree. "" = root, None initially.
expanded_folders: HashMap<String, bool>Per-folder expand/collapse state. Keys are full paths; missing = collapsed (root is special-cased to start expanded).
confirm_delete: Option<(String, bool)>Path awaiting the delete confirmation, and whether it names a folder.
Every delete route parks its target here instead of writing
EditorState::pending_delete_asset directly, so the recycle-bin call
only happens once the user has answered the dialog.
grid_scroll: ScrollStateHow far the tile grid is scrolled.
Implementations§
Source§impl AssetBrowserPanel
impl AssetBrowserPanel
pub fn new(state: Arc<Mutex<EditorState>>, theme: UiTheme) -> Self
Sourcefn render_delete_confirmation(
&mut self,
ui: &mut dyn UiBuilder,
panel_rect: [f32; 4],
theme: &UiTheme,
)
fn render_delete_confirmation( &mut self, ui: &mut dyn UiBuilder, panel_rect: [f32; 4], theme: &UiTheme, )
Asks before sending anything to the recycle bin, and only then queues
the deletion for commands::process_pending_asset_file_ops.
Deleting a file is the one action here the editor cannot undo — there is no undo history, and the file leaves the project. A folder takes everything under it, so its wording says so.
fn rescan_if_needed(&mut self)
fn build_folder_tree(&self) -> FolderNode
Sourcefn absolute_rel_path(&self, rel: &str) -> Option<String>
fn absolute_rel_path(&self, rel: &str) -> Option<String>
Resolves a forward-slash path under assets/ to an absolute OS path,
or None when no project is open.
fn absolute_path_for(&self, asset: &FlatAsset) -> Option<String>
Sourcefn reveal_in_explorer(&self, rel: &str, is_dir: bool)
fn reveal_in_explorer(&self, rel: &str, is_dir: bool)
Opens the OS file explorer at rel. For a file we reveal its containing
folder; for a directory we open the directory itself.
Sourcefn reveal_project(&self)
fn reveal_project(&self)
Opens the project root in the OS file explorer.
Sourcefn queue_new_folder(&self, parent: &str)
fn queue_new_folder(&self, parent: &str)
Queues creation of a uniquely-named “New Folder” under parent
("" = assets root), disambiguating against known directories.
Sourcefn paint_drag_ghost(
&self,
ui: &mut dyn UiBuilder,
cursor: [f32; 2],
name: &str,
kind: AssetTileKind,
theme: &UiTheme,
)
fn paint_drag_ghost( &self, ui: &mut dyn UiBuilder, cursor: [f32; 2], name: &str, kind: AssetTileKind, theme: &UiTheme, )
Paints a small chip that follows the cursor while a tile is being dragged, so it’s obvious the user is carrying an asset. Drawn on top of the grid, offset from the pointer so the cursor stays visible.
Sourcefn queue_save_entity_as_prefab(&self, entity: EntityId)
fn queue_save_entity_as_prefab(&self, entity: EntityId)
Queues saving entity’s subtree as a .kprefab in the current folder,
using the entity’s display name as the file stem. Shared by the
grid-wide drop target and the per-tile entity-drop handler.
fn activate_asset(&self, asset: &FlatAsset)
Sourcefn render_folder_tree(
&mut self,
ui: &mut dyn UiBuilder,
origin_x: f32,
origin_y: f32,
sidebar_w: f32,
theme: &UiTheme,
) -> f32
fn render_folder_tree( &mut self, ui: &mut dyn UiBuilder, origin_x: f32, origin_y: f32, sidebar_w: f32, theme: &UiTheme, ) -> f32
Render the recursive folder tree in the sidebar’s lower panel. Returns the y coordinate after the last rendered row.
fn render_folder_node( &self, ui: &mut dyn UiBuilder, node: &FolderNode, depth: u32, origin_x: f32, y: &mut f32, sidebar_w: f32, theme: &UiTheme, current: &mut Option<String>, new_expanded: &mut Vec<(String, bool)>, actions: &mut Vec<FolderAction>, rename_rect: &mut Option<[f32; 4]>, )
Render the navigable breadcrumb (project › assets › subfolder ›).
Each segment is clickable — sets current_folder.
Trait Implementations§
Source§impl EditorPanel for AssetBrowserPanel
impl EditorPanel for AssetBrowserPanel
§fn preferred_size(&self) -> Option<f32>
fn preferred_size(&self) -> Option<f32>
Auto Trait Implementations§
impl Freeze for AssetBrowserPanel
impl RefUnwindSafe for AssetBrowserPanel
impl Send for AssetBrowserPanel
impl Sync for AssetBrowserPanel
impl Unpin for AssetBrowserPanel
impl UnsafeUnpin for AssetBrowserPanel
impl UnwindSafe for AssetBrowserPanel
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.