shell of the beginnings of new-asset and update to load-asset. work still to be done
This commit is contained in:
parent
019d5b655d
commit
20f554b8d5
|
@ -56,9 +56,6 @@ pub struct EditWindowUIState {
|
||||||
pub selection: Selection,
|
pub selection: Selection,
|
||||||
pub struct_element_selections: HashMap<String, String>,
|
pub struct_element_selections: HashMap<String, String>,
|
||||||
}
|
}
|
||||||
// SELECTION REWORK:
|
|
||||||
// hashmap keeps track of what the selected element was per-structure
|
|
||||||
// Option (Enum(Grid OR Structure)) < early fail out support
|
|
||||||
|
|
||||||
#[derive(Default, Clone, PartialEq)]
|
#[derive(Default, Clone, PartialEq)]
|
||||||
pub enum Selection {
|
pub enum Selection {
|
||||||
|
@ -118,6 +115,7 @@ pub enum PopupWindowMode {
|
||||||
EditStructureElement(String, String, String), // structure subject, rename from and to, otherwise second string is unused
|
EditStructureElement(String, String, String), // structure subject, rename from and to, otherwise second string is unused
|
||||||
CreateStructureElement(String, String, String), // structure subject, node name, parent node
|
CreateStructureElement(String, String, String), // structure subject, node name, parent node
|
||||||
LoadFile(String, i32, Vec<String>), // string is current selection from list discovered from disk, number is a timer for refreshing asset list via disk scan, last is aforementioned list
|
LoadFile(String, i32, Vec<String>), // string is current selection from list discovered from disk, number is a timer for refreshing asset list via disk scan, last is aforementioned list
|
||||||
|
NewAsset(String, bool), //name being edited to become new asset, bool: true = structure
|
||||||
}
|
}
|
||||||
impl PopupWindowMode {
|
impl PopupWindowMode {
|
||||||
pub fn is_none(&self) -> bool {
|
pub fn is_none(&self) -> bool {
|
||||||
|
@ -512,8 +510,10 @@ pub fn edit_window_ui(
|
||||||
};
|
};
|
||||||
egui::ScrollArea::vertical().max_height(win_size.height()).scroll_bar_visibility(egui::scroll_area::ScrollBarVisibility::AlwaysVisible).show(ui, |ui| {
|
egui::ScrollArea::vertical().max_height(win_size.height()).scroll_bar_visibility(egui::scroll_area::ScrollBarVisibility::AlwaysVisible).show(ui, |ui| {
|
||||||
|
|
||||||
|
if ui.button("New Asset").clicked() {
|
||||||
if ui.button("test directory list popup").clicked() {
|
shared_ui_state.popup = PopupWindowMode::NewAsset("a".into(), false);
|
||||||
|
}
|
||||||
|
if ui.button("Load Asset").clicked() {
|
||||||
shared_ui_state.popup = PopupWindowMode::LoadFile("".into(), 0, Vec::new());
|
shared_ui_state.popup = PopupWindowMode::LoadFile("".into(), 0, Vec::new());
|
||||||
}
|
}
|
||||||
ui.label("This tool is in early development.");
|
ui.label("This tool is in early development.");
|
||||||
|
|
|
@ -12,6 +12,7 @@ use bevy_egui::{
|
||||||
self,
|
self,
|
||||||
ecolor::{hsv_from_rgb, rgb_from_hsv},
|
ecolor::{hsv_from_rgb, rgb_from_hsv},
|
||||||
epaint::Hsva,
|
epaint::Hsva,
|
||||||
|
Button,
|
||||||
},
|
},
|
||||||
EguiContexts,
|
EguiContexts,
|
||||||
};
|
};
|
||||||
|
@ -236,7 +237,8 @@ pub fn show_popup(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
PopupWindowMode::LoadFile(current_selection, counter, files) => {
|
PopupWindowMode::LoadFile(current_selection, counter, files) => {
|
||||||
// immediate mode means we run every frame
|
// immediate mode means we run every frame. counter and disk scan
|
||||||
|
{
|
||||||
if *counter == i32::MIN {
|
if *counter == i32::MIN {
|
||||||
// do nothing. disk inaccessible
|
// do nothing. disk inaccessible
|
||||||
} else if (*counter > (30 * 64)) | files.is_empty() {
|
} else if (*counter > (30 * 64)) | files.is_empty() {
|
||||||
|
@ -267,6 +269,8 @@ pub fn show_popup(
|
||||||
} else {
|
} else {
|
||||||
*counter += 1;
|
*counter += 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let response =
|
let response =
|
||||||
egui::Window::new("load file".to_owned()).id(state.egui.popup_identifier.unwrap());
|
egui::Window::new("load file".to_owned()).id(state.egui.popup_identifier.unwrap());
|
||||||
response.show(contexts.ctx_mut(), |ui| {
|
response.show(contexts.ctx_mut(), |ui| {
|
||||||
|
@ -335,7 +339,7 @@ pub fn show_popup(
|
||||||
}
|
}
|
||||||
ui.label("✔");
|
ui.label("✔");
|
||||||
} else {
|
} else {
|
||||||
ui.label("✘ not a valid file to load");
|
ui.label("✘");
|
||||||
}
|
}
|
||||||
if ui.button("close").clicked() {
|
if ui.button("close").clicked() {
|
||||||
state_change = PopupStateChange::Cancel;
|
state_change = PopupStateChange::Cancel;
|
||||||
|
@ -349,6 +353,43 @@ pub fn show_popup(
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
PopupWindowMode::NewAsset(current_name, is_structure_or_grid) => {
|
||||||
|
// things to do to make a new asset
|
||||||
|
// selector for type of asset
|
||||||
|
// name (selector ensures its unique before allowing creation)
|
||||||
|
// upon adding, in V state_change, submit to the selective visibility tech the entities spawned
|
||||||
|
let mut can_commit = false;
|
||||||
|
let ui =
|
||||||
|
egui::Window::new("new asset".to_owned()).id(state.egui.popup_identifier.unwrap());
|
||||||
|
ui.show(contexts.ctx_mut(), |ui| {
|
||||||
|
ui.vertical(|ui| {
|
||||||
|
// ENSURING UNIQUENESS: Must not already exist in assets folder or loaded assets.
|
||||||
|
// MUST BE A VALID IDENTIFIER
|
||||||
|
ui.label(
|
||||||
|
"identifiers cannot contain the pipe character \"|\", \
|
||||||
|
whitespace (spaces, newlines, tabs), or the comma character \",\". \
|
||||||
|
slashes \"/\" will create folders automatically if needed.",
|
||||||
|
);
|
||||||
|
ui.horizontal(|ui| {
|
||||||
|
ui.radio_value(is_structure_or_grid, true, "Structure");
|
||||||
|
ui.radio_value(is_structure_or_grid, false, "Grid");
|
||||||
|
});
|
||||||
|
ui.horizontal(|ui| {
|
||||||
|
if can_commit {
|
||||||
|
ui.label("✔");
|
||||||
|
} else {
|
||||||
|
ui.label("✘");
|
||||||
|
}
|
||||||
|
if ui.button("Cancel").clicked() {
|
||||||
|
state_change = PopupStateChange::Cancel;
|
||||||
|
}
|
||||||
|
if ui.add_enabled(can_commit, Button::new("create")).clicked() {
|
||||||
|
//commit changes
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
match state_change {
|
match state_change {
|
||||||
PopupStateChange::None => {} // nothing to do if state does not change
|
PopupStateChange::None => {} // nothing to do if state does not change
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
what its like to load a file
|
what its like to load a file
|
||||||
default structure is empty
|
default structure is empty
|
||||||
no meshes loaded
|
no meshes loaded
|
||||||
load a structure: structure is updated. load all meshes in the structure.
|
load a structure: display structure is updated. load all meshes in the structure.
|
||||||
load a mesh: add a mesh node in the structure at root with name of mesh
|
load a mesh: add a mesh node in the structure at root with name of mesh
|
||||||
|
|
||||||
~~BONUS: want a discovery-list-display of all known assets - scan assets folder~~
|
~~BONUS: want a discovery-list-display of all known assets - scan assets folder~~
|
||||||
|
|
Loading…
Reference in a new issue