This commit is contained in:
commit
f29712d158
259 files changed
+52069
No files matched your search
@@ -0,0 +1,62 @@
|
||||
//! Asset browser UI state and view enums.
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
||||
use bevy::prelude::*;
|
||||
|
||||
use crate::assets::{ASSETS_ROOT, BUILTINS_FOLDER};
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub(crate) enum AssetBrowserView {
|
||||
Grid,
|
||||
List,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub(crate) enum AssetSort {
|
||||
Name,
|
||||
Kind,
|
||||
Modified,
|
||||
Size,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub(crate) enum AssetKindFilter {
|
||||
All,
|
||||
Model,
|
||||
Texture,
|
||||
Material,
|
||||
Level,
|
||||
Prefab,
|
||||
Builtin,
|
||||
}
|
||||
|
||||
#[derive(Resource, Debug)]
|
||||
pub struct AssetBrowserUiState {
|
||||
pub(crate) search: String,
|
||||
pub(crate) view: AssetBrowserView,
|
||||
pub(crate) sort: AssetSort,
|
||||
pub(crate) kind_filter: AssetKindFilter,
|
||||
pub(crate) thumbnail_size: f32,
|
||||
pub(crate) recursive: bool,
|
||||
pub(crate) show_details: bool,
|
||||
pub(crate) expanded_folders: HashSet<String>,
|
||||
}
|
||||
|
||||
impl Default for AssetBrowserUiState {
|
||||
fn default() -> Self {
|
||||
let mut expanded_folders = HashSet::new();
|
||||
expanded_folders.insert(ASSETS_ROOT.to_string());
|
||||
expanded_folders.insert(BUILTINS_FOLDER.to_string());
|
||||
Self {
|
||||
search: String::new(),
|
||||
view: AssetBrowserView::Grid,
|
||||
sort: AssetSort::Name,
|
||||
kind_filter: AssetKindFilter::All,
|
||||
thumbnail_size: 72.0,
|
||||
recursive: false,
|
||||
show_details: true,
|
||||
expanded_folders,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user