diff --git a/editor/src/node_graph_executor/runtime.rs b/editor/src/node_graph_executor/runtime.rs index 4aae271c77..300cd5db93 100644 --- a/editor/src/node_graph_executor/runtime.rs +++ b/editor/src/node_graph_executor/runtime.rs @@ -503,10 +503,7 @@ impl NodeRuntime { // SAFETY: the batch is resident for the read. let item = unsafe { GroupItem::from_resident(batch) }; let bounds = graphene_std::renderer::graphic_list_bounding_box(&RunView::::new(&item)?, DAffine2::IDENTITY); - let group = Graphic::Group(Group { - row: None, - content: item, - }); + let group = Graphic::Group(Group { row: None, content: item }); Self::render_thumbnail(thumbnail_renders, parent_network_node_id, &group, bounds, responses) } Some(()) diff --git a/node-graph/interpreted-executor/src/dynamic_executor.rs b/node-graph/interpreted-executor/src/dynamic_executor.rs index c4b58327c3..af02549acb 100644 --- a/node-graph/interpreted-executor/src/dynamic_executor.rs +++ b/node-graph/interpreted-executor/src/dynamic_executor.rs @@ -167,11 +167,7 @@ impl DynamicExecutor { /// introspection window. The monitor stores only the context; the value is /// recreated against current source data, so a read right after an /// execution serves out of the warm memo entries. - pub fn introspect_with( - &self, - node_path: &[NodeId], - read: impl FnOnce(&core_types::record::Layout, core_types::node::RecordBatch<'_>, &Arena) -> Option, - ) -> Result { + pub fn introspect_with(&self, node_path: &[NodeId], read: impl FnOnce(&core_types::record::Layout, core_types::node::RecordBatch<'_>, &Arena) -> Option) -> Result { let serialized = self.tree.introspect(node_path)?; let Some(snapshot) = serialized.downcast_ref::() else { return Err(IntrospectError::NoData); diff --git a/node-graph/libraries/core-types/src/record.rs b/node-graph/libraries/core-types/src/record.rs index a46bc31d53..0f9822897f 100644 --- a/node-graph/libraries/core-types/src/record.rs +++ b/node-graph/libraries/core-types/src/record.rs @@ -1507,11 +1507,7 @@ impl SourcePlan { .filter(|field| source.offset_of(field.name, field.level).is_none()) .map(|field| (field.offset, default_fill_bytes(field.name, field.size))) .collect(); - Some(SourcePlan { - moves, - fills, - source: source.clone(), - }) + Some(SourcePlan { moves, fills, source: source.clone() }) } /// # Safety @@ -1887,7 +1883,12 @@ impl ServedRecord { /// markers. Panics unless the field is declared at `T` and byte-carried; /// a parked field reads through replay, not the captured bytes. pub fn field(&self, name: &str, level: u8) -> T { - let field = self.layout.fields.iter().find(|field| field.name == name && field.level == level).expect("the layout carries the read field"); + let field = self + .layout + .fields + .iter() + .find(|field| field.name == name && field.level == level) + .expect("the layout carries the read field"); assert_eq!(field.type_id, std::any::TypeId::of::(), "the field was declared at this value type"); assert!(field.repark.is_none(), "a parked field reads through replay, not the captured bytes"); // SAFETY: the captured bytes image a record of this layout and the @@ -2076,7 +2077,11 @@ impl<'e> RunBuilder<'e> { /// Starts the next lane: moves its element in and default-fills its /// fields. Returns the lane index; `None` reports arena exhaustion. pub fn push(&mut self, element: T) -> Option { - assert_eq!(std::any::TypeId::of::(), self.layout.element.type_id, "the pushed element must match the layout's element type"); + assert_eq!( + std::any::TypeId::of::(), + self.layout.element.type_id, + "the pushed element must match the layout's element type" + ); assert!(self.pushed < self.len, "the builder holds exactly its declared lane count"); let lane = self.pushed; let stride = self.layout.lane_stride(); @@ -2106,7 +2111,12 @@ impl<'e> RunBuilder<'e> { A::Value<'static>: 'static, { assert!(lane < self.pushed, "attributes write onto pushed lanes"); - let field = self.layout.fields.iter().find(|field| field.name == A::NAME && field.level == 0).expect("the layout carries the written marker"); + let field = self + .layout + .fields + .iter() + .find(|field| field.name == A::NAME && field.level == 0) + .expect("the layout carries the written marker"); let offset = field.offset; assert_eq!(field.type_id, std::any::TypeId::of::>(), "the field was declared at the marker's value type"); // SAFETY: the offset comes from the builder's own layout and the value @@ -2445,7 +2455,10 @@ impl<'a, T: dyn_any::StaticTypeSized> crate::lane::LaneSource for RunView<'a, T> impl crate::render_complexity::RenderComplexity for RunView<'_, T> { fn render_complexity(&self) -> usize { use crate::lane::LaneSource; - (0..self.lane_count()).filter_map(|lane| self.element(lane)).map(crate::render_complexity::RenderComplexity::render_complexity).sum() + (0..self.lane_count()) + .filter_map(|lane| self.element(lane)) + .map(crate::render_complexity::RenderComplexity::render_complexity) + .sum() } } diff --git a/node-graph/libraries/graphic-types/src/boundary.rs b/node-graph/libraries/graphic-types/src/boundary.rs index fc58abed1f..bb9b5d67a2 100644 --- a/node-graph/libraries/graphic-types/src/boundary.rs +++ b/node-graph/libraries/graphic-types/src/boundary.rs @@ -33,13 +33,7 @@ where LevelStatus::Batch(batch, finality) => { // SAFETY: a materialized batch's frames are arena-resident. let item = unsafe { GroupItem::from_resident(batch) }; - LevelGroup::Group( - Group { - row: None, - content: item, - }, - finality, - ) + LevelGroup::Group(Group { row: None, content: item }, finality) } LevelStatus::Pending => LevelGroup::Pending, LevelStatus::Error(error) => LevelGroup::Error(error), @@ -80,10 +74,7 @@ pub fn batch_to_legacy(layout: &core_types::record::Layout, batch: core_types::n run_to_legacy_list::(item).map(|list| Box::new(list) as Box) } if item.typed_lanes::().is_some() { - let group = Group { - row: None, - content: item, - }; + let group = Group { row: None, content: item }; return Some(Box::new(group_to_legacy_list(&group))); } fn typed_artboards(item: &GroupItem) -> Option> { diff --git a/node-graph/libraries/graphic-types/src/graphic.rs b/node-graph/libraries/graphic-types/src/graphic.rs index 5e737ec920..9e6a5e4f00 100644 --- a/node-graph/libraries/graphic-types/src/graphic.rs +++ b/node-graph/libraries/graphic-types/src/graphic.rs @@ -999,13 +999,7 @@ impl VectorRow<'_> { } } -fn walk_rows_of_run( - item: &core_types::record::GroupItem, - scale: FlattenScale, - layer_path: Option<&[NodeId]>, - paint: LanePaint<'_>, - visit: &mut dyn FnMut(VectorRow<'_>) -> RowStep, -) -> RowStep { +fn walk_rows_of_run(item: &core_types::record::GroupItem, scale: FlattenScale, layer_path: Option<&[NodeId]>, paint: LanePaint<'_>, visit: &mut dyn FnMut(VectorRow<'_>) -> RowStep) -> RowStep { let Some(run) = core_types::record::RunView::::new(item) else { return RowStep::Continue; }; @@ -1548,10 +1542,7 @@ mod run_tests { let mut builder = RunBuilder::new(&source, element_write_hashed::(), &[FieldWrite::of::(0)], 1).unwrap(); let lane = builder.push(vector.clone()).unwrap(); builder.attr::(lane, Some(&paint)); - let group = core_types::record::Group { - row: None, - content: builder.finish(), - }; + let group = core_types::record::Group { row: None, content: builder.finish() }; let expected = group_to_legacy_list(&group); let owned = map_groups_to_owned(&Graphic::Group(group)); drop(source); @@ -1568,17 +1559,11 @@ mod run_tests { let source = core_types::arena::Arena::new(1 << 16).unwrap(); let mut builder = RunBuilder::new(&source, element_write_hashed::(), &[], 1).unwrap(); builder.push(vector.clone()).unwrap(); - let nested = Graphic::Group(core_types::record::Group { - row: None, - content: builder.finish(), - }); + let nested = Graphic::Group(core_types::record::Group { row: None, content: builder.finish() }); let mut builder = RunBuilder::new(&source, element_write_hashed::(), &[], 1).unwrap(); builder.push(nested).unwrap(); - let group = core_types::record::Group { - row: None, - content: builder.finish(), - }; + let group = core_types::record::Group { row: None, content: builder.finish() }; let expected = group_to_legacy_list(&group); let owned = map_groups_to_owned(&Graphic::Group(group)); drop(source); @@ -1592,10 +1577,7 @@ mod run_tests { fn native_group_paint<'a>(vector: &Vector, arena: &'a core_types::arena::Arena) -> List> { let mut builder = RunBuilder::new(arena, element_write_hashed::(), &[], 1).unwrap(); builder.push(vector.clone()).unwrap(); - List::new_from_element(Graphic::Group(core_types::record::Group { - row: None, - content: builder.finish(), - })) + List::new_from_element(Graphic::Group(core_types::record::Group { row: None, content: builder.finish() })) } #[test] @@ -1716,10 +1698,7 @@ mod run_tests { let mut top = List::new(); top.push(Item::new_from_element(Graphic::Graphic(painted))); top.push(Item::new_from_element(Graphic::Graphic(nested))); - top.push(Item::new_from_element(Graphic::Group(core_types::record::Group { - row: None, - content: inner_item, - }))); + top.push(Item::new_from_element(Graphic::Group(core_types::record::Group { row: None, content: inner_item }))); top.push(Item::new_from_element(Graphic::Color(Color::BLACK))); top.push(Item::new_from_element(Graphic::Vector(unit_square_at(DVec2::new(6., 0.))))); top.set_attribute(core_types::ATTR_TRANSFORM, 0, DAffine2::from_translation(DVec2::new(5., 5.))); @@ -1743,14 +1722,26 @@ mod run_tests { let native = flatten_vector_rows(GraphicLevel::Legacy(&top)); assert_eq!(native.len(), legacy.len()); for row in 0..native.len() { - assert_eq!(native.attribute::(core_types::ATTR_TRANSFORM, row), legacy.attribute::(core_types::ATTR_TRANSFORM, row), "transform, row {row}"); - assert_eq!(native.attribute::(core_types::ATTR_OPACITY, row), legacy.attribute::(core_types::ATTR_OPACITY, row), "opacity, row {row}"); + assert_eq!( + native.attribute::(core_types::ATTR_TRANSFORM, row), + legacy.attribute::(core_types::ATTR_TRANSFORM, row), + "transform, row {row}" + ); + assert_eq!( + native.attribute::(core_types::ATTR_OPACITY, row), + legacy.attribute::(core_types::ATTR_OPACITY, row), + "opacity, row {row}" + ); assert_eq!( native.attribute::>(core_types::ATTR_EDITOR_LAYER_PATH, row), legacy.attribute::>(core_types::ATTR_EDITOR_LAYER_PATH, row), "layer path, row {row}" ); - assert_eq!(native.attribute::>>(ATTR_FILL, row), legacy.attribute::>>(ATTR_FILL, row), "fill, row {row}"); + assert_eq!( + native.attribute::>>(ATTR_FILL, row), + legacy.attribute::>>(ATTR_FILL, row), + "fill, row {row}" + ); } assert_eq!(native, legacy); } diff --git a/node-graph/libraries/rendering/src/renderer.rs b/node-graph/libraries/rendering/src/renderer.rs index 6843ad9770..961a49cb24 100644 --- a/node-graph/libraries/rendering/src/renderer.rs +++ b/node-graph/libraries/rendering/src/renderer.rs @@ -11,10 +11,10 @@ use core_types::bounds::RenderBoundingBox; use core_types::color::Color; use core_types::color::SRGBA8; use core_types::lane::LaneSource; -use core_types::list::{Item, List}; use core_types::lane::{LeafLane, Single}; -use core_types::record::{Group, RunView}; +use core_types::list::{Item, List}; use core_types::math::quad::Quad; +use core_types::record::{Group, RunView}; use core_types::render_complexity::RenderComplexity; use core_types::transform::Footprint; use core_types::uuid::{NodeId, generate_uuid}; @@ -1043,7 +1043,14 @@ fn render_graphic_vello<'e, S: LaneSource>>(source: &S, sc render_graphic_vello_with(source, PaintReach::NONE, scene, transform, context, render_params) } -fn render_graphic_vello_with<'a, 'e, S: LaneSource>>(source: &'a S, inherited: PaintReach<'a>, scene: &mut Scene, transform: DAffine2, context: &mut RenderContext, render_params: &RenderParams) { +fn render_graphic_vello_with<'a, 'e, S: LaneSource>>( + source: &'a S, + inherited: PaintReach<'a>, + scene: &mut Scene, + transform: DAffine2, + context: &mut RenderContext, + render_params: &RenderParams, +) { let paint_columns = PaintColumns::new(source); let mut mask_element_and_transform = None; @@ -1127,7 +1134,13 @@ fn collect_graphic_metadata<'e, S: LaneSource>>(source: &S collect_graphic_metadata_with(source, PaintReach::NONE, metadata, footprint, element_id) } -fn collect_graphic_metadata_with<'a, 'e, S: LaneSource>>(source: &'a S, inherited: PaintReach<'a>, metadata: &mut RenderMetadata, footprint: Footprint, element_id: Option) { +fn collect_graphic_metadata_with<'a, 'e, S: LaneSource>>( + source: &'a S, + inherited: PaintReach<'a>, + metadata: &mut RenderMetadata, + footprint: Footprint, + element_id: Option, +) { let paint_columns = PaintColumns::new(source); for index in 0..source.lane_count() { let item_transform: DAffine2 = source.attr::(index); @@ -1520,8 +1533,7 @@ fn render_vector_vello>(source: &S, scene: &mut // the function ignores the arg for Center align) and the `SrcIn`/`SrcOut` aligned-stroke branch further down. let stroke = element.stroke.as_ref(); let stroke_fully_transparent = stroke_graphic_list.is_none_or(|l| l.element(0).is_none_or(|g| g.is_fully_transparent())); - let can_draw_aligned_stroke = - !stroke_fully_transparent && stroke.is_some_and(|s| s.has_renderable_stroke() && s.align.is_not_centered()) && element.stroke_bezier_paths().all(|p| p.closed()); + let can_draw_aligned_stroke = !stroke_fully_transparent && stroke.is_some_and(|s| s.has_renderable_stroke() && s.align.is_not_centered()) && element.stroke_bezier_paths().all(|p| p.closed()); let opacity = (opacity_attr * if render_params.for_mask { 1. } else { opacity_fill_attr }) as f32; if opacity < 1. || blend_mode_attr != BlendMode::default() { diff --git a/node-graph/node-macro/src/codegen.rs b/node-graph/node-macro/src/codegen.rs index 88e069cddf..7821ca397d 100644 --- a/node-graph/node-macro/src/codegen.rs +++ b/node-graph/node-macro/src/codegen.rs @@ -848,7 +848,12 @@ pub(crate) fn generate_node_impl(crate_ident: &CrateIdent, parsed: &ParsedNodeFn // never binds the context's arena; the kernel keeps its own bound. let extracts_arena = |bound: &TypeParamBound| matches!(bound, TypeParamBound::Trait(trait_bound) if trait_bound.path.segments.last().is_some_and(|segment| segment.ident == "ExtractArena")); let mut impl_ctx_bounds: Vec = match ctx_param { - Some(ctx_param) => ctx_param.bounds.iter().filter(|bound| !matches!(bound, TypeParamBound::Lifetime(_)) && !extracts_arena(bound)).map(|bound| quote!(#bound)).collect(), + Some(ctx_param) => ctx_param + .bounds + .iter() + .filter(|bound| !matches!(bound, TypeParamBound::Lifetime(_)) && !extracts_arena(bound)) + .map(|bound| quote!(#bound)) + .collect(), None => Vec::new(), }; if ctx_param.is_none() { @@ -2325,22 +2330,34 @@ pub(crate) fn generate_node_impl(crate_ident: &CrateIdent, parsed: &ParsedNodeFn reading_secondary_indices(®ular_fields, skips_carrier) .into_iter() .filter_map(|index| match ®ular_fields[index].ty { - ParsedFieldType::Regular(RegularParsedField { ty, .. }) => Some({ let ty = &crate::codegen::classify::substitute_lifetimes(ty, "'static"); quote!(#ty: ::core::clone::Clone) }), + ParsedFieldType::Regular(RegularParsedField { ty, .. }) => Some({ + let ty = &crate::codegen::classify::substitute_lifetimes(ty, "'static"); + quote!(#ty: ::core::clone::Clone) + }), _ => None, }), ); if let Some(ty) = carrier_read_ty { - bounds.push({ let ty = &crate::codegen::classify::substitute_lifetimes(ty, "'static"); quote!(#ty: ::core::clone::Clone) }); + bounds.push({ + let ty = &crate::codegen::classify::substitute_lifetimes(ty, "'static"); + quote!(#ty: ::core::clone::Clone) + }); } // The element store parks droppable elements in the arena. if let Some(ty) = element_write { - bounds.push({ let ty = &crate::codegen::classify::substitute_lifetimes(ty, "'static"); quote!(#ty: ::core::marker::Send + ::core::marker::Sync + #core_types::StaticTypeSized + 'static) }); + bounds.push({ + let ty = &crate::codegen::classify::substitute_lifetimes(ty, "'static"); + quote!(#ty: ::core::marker::Send + ::core::marker::Sync + #core_types::StaticTypeSized + 'static) + }); } } // A routing node's value elements copy out of their records. if let Some(generic) = &routing_generic { bounds.extend(routing_value_indices(®ular_fields, generic).into_iter().filter_map(|index| match ®ular_fields[index].ty { - ParsedFieldType::Regular(RegularParsedField { ty, .. }) => Some({ let ty = &crate::codegen::classify::substitute_lifetimes(ty, "'static"); quote!(#ty: ::core::clone::Clone) }), + ParsedFieldType::Regular(RegularParsedField { ty, .. }) => Some({ + let ty = &crate::codegen::classify::substitute_lifetimes(ty, "'static"); + quote!(#ty: ::core::clone::Clone) + }), _ => None, })); } @@ -2350,7 +2367,10 @@ pub(crate) fn generate_node_impl(crate_ident: &CrateIdent, parsed: &ParsedNodeFn ParsedFieldType::Regular(RegularParsedField { ty, .. }) if !node.inputs[index].subject && matches!(ir::value_binding(&node, index), ValueBinding::Plain | ValueBinding::ReadingSecondary | ValueBinding::RecordElement) => { - Some({ let ty = &crate::codegen::classify::substitute_lifetimes(ty, "'static"); quote!(#ty: ::core::clone::Clone) }) + Some({ + let ty = &crate::codegen::classify::substitute_lifetimes(ty, "'static"); + quote!(#ty: ::core::clone::Clone) + }) } _ => None, })); @@ -2370,9 +2390,18 @@ pub(crate) fn generate_node_impl(crate_ident: &CrateIdent, parsed: &ParsedNodeFn .filter(|(index, _)| ir::materialized_levels(&node, *index) == 0) .filter_map(|(_, field)| match &field.ty { // The conditional arena-park moves a lend element once. - ParsedFieldType::Regular(RegularParsedField { ty, lend: Some(_), .. }) => Some({ let ty = &crate::codegen::classify::substitute_lifetimes(ty, "'static"); quote!(#ty: ::core::marker::Send + ::core::marker::Sync + 'static) }), - ParsedFieldType::Regular(RegularParsedField { ty, .. }) => Some({ let ty = &crate::codegen::classify::substitute_lifetimes(ty, "'static"); quote!(#ty: ::core::clone::Clone) }), - ParsedFieldType::Node(NodeParsedField { output_type, .. }) => Some({ let output_type = &crate::codegen::classify::substitute_lifetimes(output_type, "'static"); quote!(#output_type: ::core::clone::Clone) }), + ParsedFieldType::Regular(RegularParsedField { ty, lend: Some(_), .. }) => Some({ + let ty = &crate::codegen::classify::substitute_lifetimes(ty, "'static"); + quote!(#ty: ::core::marker::Send + ::core::marker::Sync + 'static) + }), + ParsedFieldType::Regular(RegularParsedField { ty, .. }) => Some({ + let ty = &crate::codegen::classify::substitute_lifetimes(ty, "'static"); + quote!(#ty: ::core::clone::Clone) + }), + ParsedFieldType::Node(NodeParsedField { output_type, .. }) => Some({ + let output_type = &crate::codegen::classify::substitute_lifetimes(output_type, "'static"); + quote!(#output_type: ::core::clone::Clone) + }), }) .collect(); let out = crate::codegen::classify::substitute_lifetimes(&slot_value_type(&parsed.output_type), "'static"); diff --git a/node-graph/node-macro/src/codegen/entries.rs b/node-graph/node-macro/src/codegen/entries.rs index 3c961ec505..c7ce3d115e 100644 --- a/node-graph/node-macro/src/codegen/entries.rs +++ b/node-graph/node-macro/src/codegen/entries.rs @@ -1,6 +1,6 @@ use super::*; -use proc_macro2::TokenStream as TokenStream2; use proc_macro_error2::emit_error; +use proc_macro2::TokenStream as TokenStream2; use quote::{format_ident, quote}; use syn::spanned::Spanned; use syn::{GenericParam, Ident, Type}; diff --git a/node-graph/node-macro/src/codegen/ir.rs b/node-graph/node-macro/src/codegen/ir.rs index 0d784dccf5..22f477e4fc 100644 --- a/node-graph/node-macro/src/codegen/ir.rs +++ b/node-graph/node-macro/src/codegen/ir.rs @@ -1,9 +1,7 @@ //! The intent IR: a node built from its signature, from which lowering derives. #![allow(dead_code)] -use crate::codegen::classify::{ - Dialect, RoutingIo, bare_ident, context_param, dialect, flip_carrier, generic_assignment, generic_extractable, is_served, record_shape, routing_io, slot_value_type, -}; +use crate::codegen::classify::{Dialect, RoutingIo, bare_ident, context_param, dialect, flip_carrier, generic_assignment, generic_extractable, is_served, record_shape, routing_io, slot_value_type}; use crate::codegen::entries::implementation_rows; use crate::parsing::{AttributeRead, NodeParsedField, ParsedField, ParsedFieldType, ParsedNodeFn, RecordWrites, RegularParsedField, record_writes}; use proc_macro2::TokenStream as TokenStream2; diff --git a/node-graph/nodes/gcore/src/record.rs b/node-graph/nodes/gcore/src/record.rs index 165b71911e..61666611b7 100644 --- a/node-graph/nodes/gcore/src/record.rs +++ b/node-graph/nodes/gcore/src/record.rs @@ -691,7 +691,11 @@ mod tests { let leveled = repeat_opacity_layout(&base); let frames = frames_for(&[&base, &leveled]); - let node = install(RepeatOpacityNode::new(bare_source(&base, 7.), ValueSource::new(8u32), &base), repeat_opacity_layout_meta(), &[Some(&base)]); + let node = install( + RepeatOpacityNode::new(bare_source(&base, 7.), ValueSource::new(8u32), &base), + repeat_opacity_layout_meta(), + &[Some(&base)], + ); assert_eq!(Node::::layout(&node), &leveled); let GPoll::Final(served) = core_types::record::capture(&node, &indexed, &frames) else { panic!("expected a final record"); @@ -710,7 +714,11 @@ mod tests { let base = f64_layout(&[]); let frames = frames_for(&[&base]); - let node = install(RepeatOpacityNode::new(bare_source(&base, 7.), ValueSource::new(3u32), &base), repeat_opacity_layout_meta(), &[Some(&base)]); + let node = install( + RepeatOpacityNode::new(bare_source(&base, 7.), ValueSource::new(3u32), &base), + repeat_opacity_layout_meta(), + &[Some(&base)], + ); // The pushed level (0, the only level) reports the copy count. assert_eq!(node.extent_at(&ctx, 0, &frames), core_types::gpoll::GPoll::Final(core_types::gpoll::Extent::Exactly(3))); } @@ -852,7 +860,11 @@ mod tests { let (reverse_edge, reverse_layout) = lifted_value(false); let frames = frames_for(&[&base, &leveled_content, &count_layout, &reverse_layout]); - let content = install(RepeatOpacityNode::new(bare_source(&base, 7.), ValueSource::new(3u32), &base), repeat_opacity_layout_meta(), &[Some(&base)]); + let content = install( + RepeatOpacityNode::new(bare_source(&base, 7.), ValueSource::new(3u32), &base), + repeat_opacity_layout_meta(), + &[Some(&base)], + ); let meta = core_types::record::LayoutMeta { sources: vec![0], reads: vec![], @@ -1434,7 +1446,11 @@ mod tests { .map(|&(element, x)| (element, DAffine2::from_translation(glam::DVec2::new(x, 0.)))) .collect(), }; - let node = install(MirrorNode::new(RecordSource::new(content, &layout, &layout), ValueSource::new(true)), mirror_layout_meta(), &[Some(&layout)]); + let node = install( + MirrorNode::new(RecordSource::new(content, &layout, &layout), ValueSource::new(true)), + mirror_layout_meta(), + &[Some(&layout)], + ); let out = Node::::layout(&node).clone(); let head = ctx.index_head(); let scoped = ctx.promoted(&head, 0); @@ -1612,7 +1628,11 @@ mod tests { let out = f64_layout(&[]); let frames = frames_for(&[&base, &leveled_content, &count_layout, &reverse_layout, &out]); - let content = install(RepeatOpacityNode::new(bare_source(&base, 7.), ValueSource::new(3u32), &base), repeat_opacity_layout_meta(), &[Some(&base)]); + let content = install( + RepeatOpacityNode::new(bare_source(&base, 7.), ValueSource::new(3u32), &base), + repeat_opacity_layout_meta(), + &[Some(&base)], + ); let meta = core_types::record::LayoutMeta { sources: vec![0], reads: vec![], @@ -1821,7 +1841,11 @@ mod tests { let out = f64_layout(&[]); let frames = frames_for(&[&base, &leveled, &out]); - let repeat = install(RepeatOpacityNode::new(bare_source(&base, 7.), ValueSource::new(3u32), &base), repeat_opacity_layout_meta(), &[Some(&base)]); + let repeat = install( + RepeatOpacityNode::new(bare_source(&base, 7.), ValueSource::new(3u32), &base), + repeat_opacity_layout_meta(), + &[Some(&base)], + ); let node = install_flip(SumNode::new(repeat, &leveled), &out); assert_eq!(Node::::layout(&node).depth, 0, "the reducer collapsed the rank level"); @@ -2066,7 +2090,11 @@ mod tests { let layout = source_opacity_layout(); let frames = frames_for(&[&layout]); - let node = install(SourceOpacityNode::new(ValueSource::new(()), ValueSource::new(3.), ValueSource::new(0.25)), source_opacity_layout_meta(), &[]); + let node = install( + SourceOpacityNode::new(ValueSource::new(()), ValueSource::new(3.), ValueSource::new(0.25)), + source_opacity_layout_meta(), + &[], + ); assert_eq!(Node::::layout(&node), &layout); let GPoll::Final(served) = core_types::record::capture(&node, &ctx, &frames) else { panic!("expected a final record"); diff --git a/node-graph/nodes/graphic/src/artboard.rs b/node-graph/nodes/graphic/src/artboard.rs index 225a8e2955..64de190ecc 100644 --- a/node-graph/nodes/graphic/src/artboard.rs +++ b/node-graph/nodes/graphic/src/artboard.rs @@ -36,10 +36,7 @@ pub fn create_artboard<'e>( clip: bool, ) -> (Artboard<'e>, Attr, Attr, Attr, Attr) { let item = content.as_group_item(); - let content = core_types::list::List::new_from_element(Graphic::Group(core_types::record::Group { - row: None, - content: item, - })); + let content = core_types::list::List::new_from_element(Graphic::Group(core_types::record::Group { row: None, content: item })); // Normalize so `location` is the top-left corner and `dimensions` are positive (allowing negative input // dimensions to represent dragging from the opposite corner). Compute the corner using the raw signed diff --git a/node-graph/nodes/graphic/src/graphic.rs b/node-graph/nodes/graphic/src/graphic.rs index 9682fc5251..5ba97016e5 100644 --- a/node-graph/nodes/graphic/src/graphic.rs +++ b/node-graph/nodes/graphic/src/graphic.rs @@ -461,10 +461,7 @@ pub fn wrap_graphic<'e, T: Clone + Send + Sync + core_types::CacheHash + 'static #[implementations(Graphic, Vector, Raster, Raster, Color, GradientStops, String)] content: IList, ) -> Result>, Interrupt> { let item = content.as_group_item(); - Ok(Graphic::Group(core_types::record::Group { - row: None, - content: item, - })) + Ok(Graphic::Group(core_types::record::Group { row: None, content: item })) } /// The collected group is the level's single lane. @@ -530,10 +527,7 @@ pub fn to_graphic_typed<'e, T: Clone + Send + Sync + core_types::CacheHash + 'st #[implementations(Vector, Raster, Raster, Color, GradientStops, String)] content: IList, ) -> Result>, Interrupt> { let item = content.as_group_item(); - Ok(Graphic::Group(core_types::record::Group { - row: None, - content: item, - })) + Ok(Graphic::Group(core_types::record::Group { row: None, content: item })) } /// An unconnected content input carries the unit, which renders as nothing like diff --git a/node-graph/nodes/graphic/src/record.rs b/node-graph/nodes/graphic/src/record.rs index bcb7508584..52f38126f0 100644 --- a/node-graph/nodes/graphic/src/record.rs +++ b/node-graph/nodes/graphic/src/record.rs @@ -103,10 +103,7 @@ fn flatten_extent(content: ListIn<'_, Graphic>, fully_flatten: ValueIn<'_, bool> #[node_macro::node(category("Test"), extent(wrap_extent))] fn wrap<'e>(_: impl Ctx, content: IList>) -> Result>, Interrupt> { let item = content.as_group_item(); - Ok(Graphic::Group(core_types::record::Group { - row: None, - content: item, - })) + Ok(Graphic::Group(core_types::record::Group { row: None, content: item })) } /// The collected group is the level's single lane. diff --git a/node-graph/nodes/path-bool/src/lib.rs b/node-graph/nodes/path-bool/src/lib.rs index 06e96d24c1..538eb1985d 100644 --- a/node-graph/nodes/path-bool/src/lib.rs +++ b/node-graph/nodes/path-bool/src/lib.rs @@ -4,9 +4,9 @@ use core_types::uuid::NodeId; use core_types::{ATTR_BLEND_MODE, ATTR_CLIPPING_MASK, ATTR_EDITOR_LAYER_PATH, ATTR_OPACITY, ATTR_OPACITY_FILL, ATTR_TRANSFORM, BlendMode, Color, Ctx}; use glam::{DAffine2, DVec2}; use graphic_types::graphic::{GraphicLevel, PaintColumns, PaintReach, bake_paint_transforms, is_paint_present, set_paint_attribute, set_paint_attribute_at}; +use graphic_types::markers::{EditorMergedLayers, Fill, Stroke}; use graphic_types::raster_types::{CPU, GPU, Raster}; use graphic_types::vector_types::GradientStops; -use graphic_types::markers::{EditorMergedLayers, Fill, Stroke}; use graphic_types::vector_types::gradient::{GradientSpreadMethod, GradientType}; use graphic_types::vector_types::subpath::{ManipulatorGroup, Subpath}; use graphic_types::vector_types::vector::PointId; @@ -128,9 +128,7 @@ fn boolean_operation<'e>( > { let item = content.as_group_item(); let flattened = flatten_vector_run(GraphicLevel::Run(&item), DAffine2::IDENTITY, PaintReach::NONE); - let snapshot = graphic_types::graphic::run_to_list::(&item) - .expect("the run holds the row's element type") - .into_graphic_list(); + let snapshot = graphic_types::graphic::run_to_list::(&item).expect("the run holds the row's element type").into_graphic_list(); boolean_core(ctx.arena(), flattened, snapshot, operation) } @@ -157,9 +155,7 @@ fn boolean_operation_vector<'e>( > { let item = content.as_group_item(); let flattened = graphic_types::graphic::run_to_list::(&item).expect("the run holds vector lanes"); - let snapshot = graphic_types::graphic::run_to_list::(&item) - .expect("the run holds the row's element type") - .into_graphic_list(); + let snapshot = graphic_types::graphic::run_to_list::(&item).expect("the run holds the row's element type").into_graphic_list(); boolean_core(ctx.arena(), flattened, snapshot, operation) } @@ -445,7 +441,10 @@ fn flatten_group(out: &mut List, group: &core_types::record::Group, comp } else if let Some(image) = graphic_types::graphic::run_to_list::>(item) { push_rows(out, raster_stand_in_rows(&image, composed)); } else if let Some(color) = graphic_types::graphic::run_to_list::(item) { - push_rows(out, (0..color.len()).filter_map(|i| Some(color_paint_row(*color.element(i)?, color.clone_item_attributes(i)))).collect()); + push_rows( + out, + (0..color.len()).filter_map(|i| Some(color_paint_row(*color.element(i)?, color.clone_item_attributes(i)))).collect(), + ); } else if let Some(gradient) = graphic_types::graphic::run_to_list::(item) { push_rows( out, diff --git a/node-graph/nodes/repeat/src/repeat_nodes.rs b/node-graph/nodes/repeat/src/repeat_nodes.rs index 223efc136a..013e894f4c 100644 --- a/node-graph/nodes/repeat/src/repeat_nodes.rs +++ b/node-graph/nodes/repeat/src/repeat_nodes.rs @@ -360,7 +360,13 @@ mod test { transform: local, }; - let mut node = RepeatRadialNode::new(RecordSource::new(content, &layout, &layout), ValueSource::new(90.0f64), ValueSource::new(2.0f64), ValueSource::new(4u32), &layout); + let mut node = RepeatRadialNode::new( + RecordSource::new(content, &layout, &layout), + ValueSource::new(90.0f64), + ValueSource::new(2.0f64), + ValueSource::new(4u32), + &layout, + ); Node::::set_layout(&mut node, repeat_radial_layout_meta().resolve(&[Some(&layout)])); assert_eq!(node.extent_at(&ctx, 0, &frames.reborrow()), GPoll::Final(Extent::Exactly(4))); diff --git a/node-graph/nodes/vector/src/vector_nodes.rs b/node-graph/nodes/vector/src/vector_nodes.rs index 81702cbe74..0e3437bd5f 100644 --- a/node-graph/nodes/vector/src/vector_nodes.rs +++ b/node-graph/nodes/vector/src/vector_nodes.rs @@ -1660,7 +1660,12 @@ fn solidify_stroke_vector<'e>( Interrupt, > { let wrapper = wrap_vector_level(content); - solidify_native_lane(ctx.arena(), graphic_types::graphic::GraphicLevel::Legacy(&wrapper), || legacy_graphic_list_of(content), ctx.index() as usize) + solidify_native_lane( + ctx.arena(), + graphic_types::graphic::GraphicLevel::Legacy(&wrapper), + || legacy_graphic_list_of(content), + ctx.index() as usize, + ) } fn solidify_stroke_vector_extent(content: ListIn<'_, Vector>, level: LevelIn) -> GPoll {