only rust changes reset scene (#6060)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
@ -529,6 +529,18 @@ impl ExecutorContext {
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn bust_cache_and_reset_scene(&self) -> Result<ExecOutcome, KclErrorWithOutputs> {
|
||||
cache::bust_cache().await;
|
||||
|
||||
// Execute an empty program to clear and reset the scene.
|
||||
// We specifically want to be returned the objects after the scene is reset.
|
||||
// Like the default planes so it is easier to just execute an empty program
|
||||
// after the cache is busted.
|
||||
let outcome = self.run_with_caching(crate::Program::empty()).await?;
|
||||
|
||||
Ok(outcome)
|
||||
}
|
||||
|
||||
async fn prepare_mem(&self, exec_state: &mut ExecState) -> Result<(), KclErrorWithOutputs> {
|
||||
self.eval_prelude(exec_state, SourceRange::synthetic())
|
||||
.await
|
||||
|
@ -211,6 +211,14 @@ impl Program {
|
||||
pub fn recast_with_options(&self, options: &FormatOptions) -> String {
|
||||
self.ast.recast(options, 0)
|
||||
}
|
||||
|
||||
/// Create an empty program.
|
||||
pub fn empty() -> Self {
|
||||
Self {
|
||||
ast: parsing::ast::types::Node::no_src(parsing::ast::types::Program::default()),
|
||||
original_file_contents: String::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
Reference in New Issue
Block a user