Engine: keep every placed body's frame with the world state (#7411)
Each command that names a body (appearance, material, move, ...) mapped it to its component's own name by working out every placed body's world name and frame, so a command on a large assembly cost a walk of the whole design. The list is now kept with the world-placement cache while it is current. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -101,7 +101,7 @@ fn table(id: &str) -> &'static [(&'static str, K)] {
|
||||
struct Frames {
|
||||
/// Worked out on first use: most commands pick no body, and a large assembly's frames cost
|
||||
/// a walk of every body on every command.
|
||||
bodies: std::cell::OnceCell<Vec<(String, String, Mat)>>,
|
||||
bodies: std::cell::OnceCell<crate::BodyFrames>,
|
||||
active: Mat,
|
||||
/// The frame of the sketch being edited (its component), else the active component's.
|
||||
sketch: Mat,
|
||||
@@ -117,10 +117,7 @@ fn frames(s: &Session) -> Frames {
|
||||
impl Frames {
|
||||
/// World name, the component's own body name, and its frame, for every body.
|
||||
fn bodies(&self, s: &Session) -> &[(String, String, Mat)] {
|
||||
self.bodies.get_or_init(|| {
|
||||
let st = s.model.state();
|
||||
s.placed_document().body_frames_with_source(&st).into_iter().map(|(world, own, _, _, m)| (world, own, m)).collect()
|
||||
})
|
||||
self.bodies.get_or_init(|| s.body_frames())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user