Skip to main content

AssetBrowserPanel

Struct AssetBrowserPanel 

Source
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: String

Edit 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: String

Edit buffer for the folder inline-rename field.

§rename_focus_pending: bool

true 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: ScrollState

How far the tile grid is scrolled.

Implementations§

Source§

impl AssetBrowserPanel

Source

pub fn new(state: Arc<Mutex<EditorState>>, theme: UiTheme) -> Self

Source

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.

Source

fn rescan_if_needed(&mut self)

Source

fn build_folder_tree(&self) -> FolderNode

Source

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.

Source

fn absolute_path_for(&self, asset: &FlatAsset) -> Option<String>

Source

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.

Source

fn reveal_project(&self)

Opens the project root in the OS file explorer.

Source

fn queue_new_folder(&self, parent: &str)

Queues creation of a uniquely-named “New Folder” under parent ("" = assets root), disambiguating against known directories.

Source

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.

Source

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.

Source

fn activate_asset(&self, asset: &FlatAsset)

Source

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.

Source

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]>, )

Source

fn render_breadcrumb( &mut self, ui: &mut dyn UiBuilder, origin_x: f32, origin_y: f32, max_w: f32, theme: &UiTheme, project_folder: &str, )

Render the navigable breadcrumb (project › assets › subfolder ›). Each segment is clickable — sets current_folder.

Trait Implementations§

Source§

impl EditorPanel for AssetBrowserPanel

Source§

fn id(&self) -> &str

Unique identifier (used for dock serialization and lookup).
Source§

fn title(&self) -> &str

Human-readable title shown in the tab / panel header.
Source§

fn ui(&mut self, ui: &mut dyn UiBuilder)

Build the panel contents for the current frame.
§

fn preferred_size(&self) -> Option<f32>

Preferred size hint, in logical points. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AppLifecycle for T
where T: ?Sized,

§

fn on_start(&mut self, ctx: &mut dyn AppContext)

Called once after the backend is up but before the first update. Apps install their theme / fonts here.
§

fn on_exit(&mut self)

Called once when the window is closing. Persist state here.
§

impl<T> AsAny for T
where T: Any,

§

fn as_any(&self) -> &(dyn Any + 'static)

Returns a reference to the inner value as &dyn Any.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: 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.
§

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.
§

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.
§

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.
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

Converts 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)

Converts &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)

Converts &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
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 F
where T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(value: T, _simd: S) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,