Add "add all csg" button
This commit is contained in:
+6
-3
@@ -36,7 +36,7 @@ pub(crate) struct GState {
|
|||||||
pub(crate) lights: Vec<Light>,
|
pub(crate) lights: Vec<Light>,
|
||||||
pub(crate) csg: Vec<Arc<RwLock<CSG>>>,
|
pub(crate) csg: Vec<Arc<RwLock<CSG>>>,
|
||||||
|
|
||||||
pub(crate) new_csg_needed: bool,
|
pub(crate) new_csgs_needed: u8,
|
||||||
|
|
||||||
pub(crate) fps: [f64; 128],
|
pub(crate) fps: [f64; 128],
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ impl Default for GState {
|
|||||||
lights: vec![],
|
lights: vec![],
|
||||||
csg: vec![],
|
csg: vec![],
|
||||||
|
|
||||||
new_csg_needed: false,
|
new_csgs_needed: 0,
|
||||||
|
|
||||||
fps: [0.0; 128],
|
fps: [0.0; 128],
|
||||||
|
|
||||||
@@ -228,7 +228,10 @@ pub(crate) fn gui_up(gui: &mut Gui, state: &mut GState) {
|
|||||||
state.csg.remove(i);
|
state.csg.remove(i);
|
||||||
}
|
}
|
||||||
if state.csg.len() < 32 && ui.small_button("add csg").clicked() {
|
if state.csg.len() < 32 && ui.small_button("add csg").clicked() {
|
||||||
state.new_csg_needed = true;
|
state.new_csgs_needed += 1;
|
||||||
|
}
|
||||||
|
if state.csg.len() < 32 && ui.small_button("add all csgs").clicked() {
|
||||||
|
state.new_csgs_needed = (32 - state.csg.len()) as u8;
|
||||||
}
|
}
|
||||||
ui.heading(format!("Lights ({})", state.lights.len()));
|
ui.heading(format!("Lights ({})", state.lights.len()));
|
||||||
let mut lightdel = vec![];
|
let mut lightdel = vec![];
|
||||||
|
|||||||
+2
-2
@@ -1560,7 +1560,7 @@ impl App {
|
|||||||
gui_up(&mut rcx.gui, &mut self.gstate);
|
gui_up(&mut rcx.gui, &mut self.gstate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.gstate.new_csg_needed {
|
while self.gstate.new_csgs_needed > 0 {
|
||||||
self.thread_work_creation
|
self.thread_work_creation
|
||||||
.send(WorkItem::CreateCSG(
|
.send(WorkItem::CreateCSG(
|
||||||
self.device.clone(),
|
self.device.clone(),
|
||||||
@@ -1579,7 +1579,7 @@ impl App {
|
|||||||
-1,
|
-1,
|
||||||
))
|
))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
self.gstate.new_csg_needed = false;
|
self.gstate.new_csgs_needed -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
rcx.recreate_pipelines |= self.gstate.recreate_pipelines;
|
rcx.recreate_pipelines |= self.gstate.recreate_pipelines;
|
||||||
|
|||||||
Reference in New Issue
Block a user