Add workaround for cache context nullification breaking nested loop indexes (#3178)

* Disable caching for the instance repeat etc. nodes

* Add usize implementation for caching and monitor nodes

* Change return type of instance index node back to f64

* Cleanup while loop

* Remove stray usize changes

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Dennis Kobert
2025-09-16 23:59:43 +02:00
committed by GitHub
parent 390ce023ea
commit e4d2805115
2 changed files with 20 additions and 14 deletions

View File

@@ -27,7 +27,7 @@ pub trait ExtractAnimationTime {
}
pub trait ExtractIndex {
fn try_index(&self) -> Option<Vec<usize>>;
fn try_index(&self) -> Option<impl Iterator<Item = usize>>;
}
// Consider returning a slice or something like that
@@ -175,7 +175,7 @@ impl<T: ExtractAnimationTime + Sync> ExtractAnimationTime for Option<T> {
}
}
impl<T: ExtractIndex> ExtractIndex for Option<T> {
fn try_index(&self) -> Option<Vec<usize>> {
fn try_index(&self) -> Option<impl Iterator<Item = usize>> {
self.as_ref().and_then(|x| x.try_index())
}
}
@@ -212,7 +212,7 @@ impl<T: ExtractAnimationTime + Sync> ExtractAnimationTime for Arc<T> {
}
}
impl<T: ExtractIndex> ExtractIndex for Arc<T> {
fn try_index(&self) -> Option<Vec<usize>> {
fn try_index(&self) -> Option<impl Iterator<Item = usize>> {
(**self).try_index()
}
}
@@ -268,8 +268,8 @@ impl ExtractRealTime for ContextImpl<'_> {
}
}
impl ExtractIndex for ContextImpl<'_> {
fn try_index(&self) -> Option<Vec<usize>> {
self.index.clone()
fn try_index(&self) -> Option<impl Iterator<Item = usize>> {
self.index.clone().map(|x| x.into_iter())
}
}
impl ExtractVarArgs for ContextImpl<'_> {
@@ -304,8 +304,8 @@ impl ExtractAnimationTime for OwnedContextImpl {
}
}
impl ExtractIndex for OwnedContextImpl {
fn try_index(&self) -> Option<Vec<usize>> {
self.index.clone()
fn try_index(&self) -> Option<impl Iterator<Item = usize>> {
self.index.clone().map(|x| x.into_iter())
}
}
impl ExtractVarArgs for OwnedContextImpl {
@@ -418,7 +418,7 @@ impl OwnedContextImpl {
footprint,
varargs: None,
parent,
index,
index: index.map(|x| x.collect()),
real_time,
animation_time,
}