Prepare to support nested operations

This commit is contained in:
Hanno Braun 2024-12-10 19:24:28 +01:00
parent 050b9357c2
commit d7a183b6fc
2 changed files with 13 additions and 7 deletions

View File

@ -92,10 +92,8 @@ impl Renderer {
return Ok(());
};
let vertices =
Geometry::vertices(&self.device, selected_operation.as_ref());
let triangles =
Geometry::triangles(&self.device, selected_operation.as_ref());
let vertices = Geometry::vertices(&self.device, &selected_operation);
let triangles = Geometry::triangles(&self.device, &selected_operation);
let mut encoder = self
.device

View File

@ -15,12 +15,20 @@ impl OperationView {
}
}
pub fn operations(&self) -> Vec<(Box<dyn Operation>, bool)> {
pub fn operations(&self) -> Vec<(Self, bool)> {
self.operation
.children()
.into_iter()
.enumerate()
.map(|(i, op)| (op, Some(i) == self.selected))
.map(|(i, op)| {
(
OperationView {
operation: op,
selected: None,
},
Some(i) == self.selected,
)
})
.collect()
}
@ -40,7 +48,7 @@ impl OperationView {
}
}
pub fn selected(&self) -> Option<Box<dyn Operation>> {
pub fn selected(&self) -> Option<Self> {
let selected = self.selected?;
self.operations()