Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions node-graph/gcore/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub trait ExtractAnimationTime {
}

pub trait ExtractIndex {
fn try_index(&self) -> Option<impl Iterator<Item = usize>>;
fn try_index(&self) -> Option<impl DoubleEndedIterator<Item = usize>>;
}

// Consider returning a slice or something like that
Expand Down Expand Up @@ -175,7 +175,7 @@ impl<T: ExtractAnimationTime + Sync> ExtractAnimationTime for Option<T> {
}
}
impl<T: ExtractIndex> ExtractIndex for Option<T> {
fn try_index(&self) -> Option<impl Iterator<Item = usize>> {
fn try_index(&self) -> Option<impl DoubleEndedIterator<Item = usize>> {
self.as_ref().and_then(|x| x.try_index())
}
}
Expand Down Expand Up @@ -212,7 +212,7 @@ impl<T: ExtractAnimationTime + Sync> ExtractAnimationTime for Arc<T> {
}
}
impl<T: ExtractIndex> ExtractIndex for Arc<T> {
fn try_index(&self) -> Option<impl Iterator<Item = usize>> {
fn try_index(&self) -> Option<impl DoubleEndedIterator<Item = usize>> {
(**self).try_index()
}
}
Expand Down Expand Up @@ -268,7 +268,7 @@ impl ExtractRealTime for ContextImpl<'_> {
}
}
impl ExtractIndex for ContextImpl<'_> {
fn try_index(&self) -> Option<impl Iterator<Item = usize>> {
fn try_index(&self) -> Option<impl DoubleEndedIterator<Item = usize>> {
self.index.clone().map(|x| x.into_iter())
}
}
Expand Down Expand Up @@ -304,7 +304,7 @@ impl ExtractAnimationTime for OwnedContextImpl {
}
}
impl ExtractIndex for OwnedContextImpl {
fn try_index(&self) -> Option<impl Iterator<Item = usize>> {
fn try_index(&self) -> Option<impl DoubleEndedIterator<Item = usize>> {
self.index.clone().map(|x| x.into_iter())
}
}
Expand Down
3 changes: 2 additions & 1 deletion node-graph/gcore/src/vector/algorithms/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ async fn instance_position(ctx: impl Ctx + ExtractVarArgs) -> DVec2 {
async fn instance_index(ctx: impl Ctx + ExtractIndex, _primary: (), loop_level: u32) -> f64 {
let Some(index_iter) = ctx.try_index() else { return 0. };
let mut last = 0;
for (i, index) in index_iter.enumerate() {
// Index zero should be the top most index for some reason https://github.com/GraphiteEditor/Graphite/issues/3360
for (i, index) in index_iter.rev().enumerate() {
if i == loop_level as usize {
return index as f64;
}
Expand Down
Loading