mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-17 07:18:04 +08:00
@@ -1350,6 +1350,23 @@ async fn instance_map(ctx: impl Ctx + CloneVarArgs + ExtractAll, content: Table<
|
||||
rows.into_iter().collect()
|
||||
}
|
||||
|
||||
#[node_macro::node(category("Vector"), path(graphene_core::vector))]
|
||||
async fn map_points(ctx: impl Ctx + CloneVarArgs + ExtractAll, content: Table<Vector>, mapped: impl Node<Context<'static>, Output = DVec2>) -> Table<Vector> {
|
||||
let mut content = content;
|
||||
let mut index = 0;
|
||||
|
||||
for row in content.iter_mut() {
|
||||
for (_, position) in row.element.point_domain.positions_mut() {
|
||||
let owned_ctx = OwnedContextImpl::from(ctx.clone()).with_index(index).with_position(*position);
|
||||
index += 1;
|
||||
|
||||
*position = mapped.eval(owned_ctx.into_context()).await;
|
||||
}
|
||||
}
|
||||
|
||||
content
|
||||
}
|
||||
|
||||
#[node_macro::node(category("Vector"), path(graphene_core::vector))]
|
||||
async fn flatten_path<T: 'n + Send>(
|
||||
_: impl Ctx,
|
||||
|
||||
Reference in New Issue
Block a user