proof visual editor of files for node transforms, saving and loading
This commit is contained in:
parent
26d0b1627b
commit
662436bb3e
|
@ -8,8 +8,9 @@ use bevy::{
|
|||
},
|
||||
math::Vec3,
|
||||
prelude::default,
|
||||
reflect::Reflect,
|
||||
render::{camera::Camera, color::Color},
|
||||
transform::components::GlobalTransform,
|
||||
transform::components::{GlobalTransform, Transform},
|
||||
window::{PrimaryWindow, Window},
|
||||
};
|
||||
use bevy_egui::{
|
||||
|
@ -32,6 +33,7 @@ use crate::{
|
|||
use super::{
|
||||
s_editor_bevy_input_shim::setup_inputs,
|
||||
s_orbit_camera::orbit_camera::{pan_orbit_camera, spawn_camera},
|
||||
s_string_tree::StringTree,
|
||||
s_ui_helpers_and_popup::*,
|
||||
};
|
||||
|
||||
|
@ -532,13 +534,13 @@ pub fn edit_window_ui(
|
|||
}
|
||||
});
|
||||
let mut selected_structure = false;
|
||||
let mut selection = None;
|
||||
let mut selection = Option::<StringTree>::None;
|
||||
if shared_ui_state.selected_structure != "" {
|
||||
for structure in &shared_ui_state.structures {
|
||||
if structure.path == shared_ui_state.selected_structure {
|
||||
let asset = structure_assets.get_mut(structure.id.clone());
|
||||
if asset.is_some() {
|
||||
selection = Some(&mut asset.unwrap().layout);
|
||||
selection = Some(asset.unwrap().layout.clone());
|
||||
selected_structure = true;
|
||||
}
|
||||
break;
|
||||
|
@ -558,6 +560,36 @@ pub fn edit_window_ui(
|
|||
}
|
||||
ui.separator();
|
||||
if shared_ui_state.selected_structure_element != "" {
|
||||
let structure_name = shared_ui_state.selected_structure.clone();
|
||||
let selection_name = shared_ui_state.selected_structure_element.clone();
|
||||
for structure in &mut shared_ui_state.structures {
|
||||
if structure.path == structure_name {
|
||||
let asset = structure_assets.get_mut(structure.id.clone());
|
||||
if asset.is_some() {
|
||||
let selection = asset.unwrap();
|
||||
ui.collapsing("Node Data", |ui| {
|
||||
let mut trans = {
|
||||
if selection.default_pose_positions.contains_key(&selection_name) {
|
||||
selection.default_pose_positions.get(&selection_name).unwrap().clone()
|
||||
} else {
|
||||
Transform::IDENTITY
|
||||
}
|
||||
}.clone();
|
||||
ui.label("Position");
|
||||
editable_vec3(ui, &mut trans.translation);
|
||||
ui.label("Scale");
|
||||
editable_vec3(ui, &mut trans.scale);
|
||||
ui.label("Rotation");
|
||||
editable_quat(ui, &mut trans.rotation);
|
||||
|
||||
selection.default_pose_positions.insert(selection_name, trans);
|
||||
structure.has_changed_since_last_save = true;
|
||||
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ui.button("Edit Structure of Node").clicked() {
|
||||
let selection = shared_ui_state.selected_structure_element.clone();
|
||||
let mut should_close = false;
|
||||
|
@ -590,7 +622,7 @@ pub fn edit_window_ui(
|
|||
let mut string_selection =
|
||||
shared_ui_state.selected_structure_element.clone();
|
||||
|
||||
show_stringtree_selector(ui, selection, &mut string_selection);
|
||||
show_stringtree_selector(ui, &selection, &mut string_selection);
|
||||
shared_ui_state.selected_structure_element = string_selection;
|
||||
})
|
||||
});
|
||||
|
|
|
@ -478,7 +478,7 @@ pub mod serialization {
|
|||
let mut data: String = "".into();
|
||||
// v STRING TREE (tree that defines shape/structure of it)
|
||||
{
|
||||
let mut is_first = true;
|
||||
//let mut is_first = true;
|
||||
data += NEWLINE;
|
||||
let mut to_process = Vec::<String>::new();
|
||||
for each in &asset.layout.root {
|
||||
|
|
Loading…
Reference in a new issue