Bring the editor onto the reconciled node catalog and paint carrier

This commit is contained in:
Dennis Kobert
2026-09-08 16:33:52 +00:00
parent 3830ace926
commit 33b20d6329
11 changed files with 74 additions and 80 deletions

View File

@@ -388,7 +388,7 @@ const ATTR_PAINT_ORDER: &str = "paint_order";
/// `Vector::stroke` is gone upstream. In our paint model a lane's stroke is the `ATTR_STROKE`
/// `List<Graphic>`, so the stroke's GEOMETRY parameters ride that list's own attribute columns, on the
/// same names master's `Coverage` uses. Mirrors `vector_nodes::stroke_params`, which writes them.
fn stroke_params(paint: &List<Graphic>) -> StrokeStyle {
pub fn stroke_params(paint: &List<Graphic>) -> StrokeStyle {
let defaults = StrokeStyle::default();
StrokeStyle {
weight: paint.attribute_cloned_or(ATTR_WEIGHT, 0, defaults.weight),

View File

@@ -29,25 +29,21 @@ pub(crate) fn generate_node_input_references(
let struct_name = format_ident!("{}Input", input_ident.ident.to_string().to_case(Case::Pascal));
let (fn_generic_params, phantom_data_declerations) = generate_phantom_data(used.iter());
// Only create structs with phantom data where necessary.
generated_input_accessor.push(if phantom_data_declerations.is_empty() {
quote! {
pub struct #struct_name;
}
} else {
quote! {
pub struct #struct_name <#(#used),*>{
#(#phantom_data_declerations,)*
}
}
});
// The marker is always a unit struct so it can be passed as a value; its generics would only have described
// `Result`, which nothing reads through the marker.
let _ = &phantom_data_declerations;
generated_input_accessor.push(quote! {
impl <#(#used),*> #core_types::NodeInputDecleration for #struct_name <#(#fn_generic_params),*> {
pub struct #struct_name;
});
let result_ty = if used.is_empty() { quote!(#ty) } else { quote!(()) };
let _ = &fn_generic_params;
generated_input_accessor.push(quote! {
impl #core_types::NodeInputDecleration for #struct_name {
const INDEX: usize = #input_index;
fn identifier() -> #core_types::ProtoNodeIdentifier {
#inputs_module_name::IDENTIFIER.clone()
}
type Result = #ty;
type Result = #result_ty;
}
})
}

View File

@@ -393,10 +393,11 @@ fn fill<'e>(
_backup_gradient: IList<Gradient>,
_gradient_form: GradientForm,
_gradient_spread: GradientSpread,
_transform: Option<DAffine2>,
_has_transform: bool,
_transform: DAffine2,
) -> Result<(Vector, Attr<'e, Fill>), Interrupt> {
let mut paint = paint_table(paint);
default_gradient_paint(&mut paint, element.bounding_box(), _gradient_form, _gradient_spread, _transform);
default_gradient_paint(&mut paint, element.bounding_box(), _gradient_form, _gradient_spread, _has_transform.then_some(_transform));
let parked = park_paint(ctx.arena(), paint)?;
Ok((element, Attr(Some(parked))))
}
@@ -413,14 +414,15 @@ fn fill_graphic_leveled<'e>(
_backup_gradient: IList<Gradient>,
_gradient_form: GradientForm,
_gradient_spread: GradientSpread,
_transform: Option<DAffine2>,
_has_transform: bool,
_transform: DAffine2,
) -> Result<(Graphic<'static>, Attr<'e, Fill>), Interrupt> {
let bounds = match BoundingBox::bounding_box(&element, DAffine2::IDENTITY, false) {
RenderBoundingBox::Rectangle(bounds) => Some(bounds),
_ => None,
};
let mut paint = paint_table(paint);
default_gradient_paint(&mut paint, bounds, _gradient_form, _gradient_spread, _transform);
default_gradient_paint(&mut paint, bounds, _gradient_form, _gradient_spread, _has_transform.then_some(_transform));
let parked = park_paint(ctx.arena(), paint)?;
Ok((element, Attr(Some(parked))))
}