Skip to content
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e192269
Add conversion from Fill to Table<Graphic>
YohYamasaki May 6, 2026
25358d3
Refactor Vector vello renderer for Gradient / Color
YohYamasaki May 7, 2026
8a2aec6
Refactor Vector SVG renderer for Gradient / Color
YohYamasaki May 8, 2026
bad70f7
Fix conflicts
YohYamasaki May 12, 2026
7ee4117
Add basic clipping-based fill for SVG rendering
YohYamasaki May 13, 2026
2859235
Use Cow to avoid cloning graphic list for fill
YohYamasaki May 15, 2026
42991b4
Cleanup for Cow usage
YohYamasaki May 15, 2026
a03afed
format code
YohYamasaki May 15, 2026
ac3f317
Use `<pattern>` instead of `<clipPath>` for clip
YohYamasaki May 18, 2026
189557e
Move svg pattern rendering function to RenderExt
YohYamasaki May 19, 2026
1802829
Fix comment
YohYamasaki May 19, 2026
3091a6f
Fix empty fill list rendering as default black
YohYamasaki May 19, 2026
3fd6116
Move opaque check function to Graphic impl
YohYamasaki May 19, 2026
746d783
Add color converter and debug node to use graphic
YohYamasaki May 19, 2026
1adeb4c
WIP: Use List<Graphic> to render Color & Gradient
YohYamasaki May 19, 2026
4285243
Use `Arc<List<Vector>>` for vector_data metadata
YohYamasaki May 20, 2026
44c03a3
Recurse opacity checks on nested `Graphic`
YohYamasaki May 21, 2026
18362b1
Fix fill and stroke visibility check degradation
YohYamasaki May 21, 2026
1b44cb2
Fix clipping based stroke paint positioning
YohYamasaki May 21, 2026
8e59653
Refactor vello renderer for stroke to use graphic
YohYamasaki May 21, 2026
7603828
Reduce `Fill` / `Stroke.color` to `List<Graphic>` allocations
YohYamasaki May 22, 2026
721daa3
Revert "Use `Arc<List<Vector>>` for vector_data metadata"
YohYamasaki May 22, 2026
671da90
Expose paint row attributes as dedicated metadata for vectors
YohYamasaki May 22, 2026
11724a5
Fix transparency check to consider fill opacity
YohYamasaki May 22, 2026
770a90e
Fix consistency of gradient placement for SVG stroke
YohYamasaki May 22, 2026
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
12 changes: 12 additions & 0 deletions editor/src/messages/portfolio/document/document_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use crate::messages::prelude::*;
use glam::{DAffine2, IVec2};
use graph_craft::document::NodeId;
use graphene_std::Color;
use graphene_std::Graphic;
use graphene_std::list::List;
use graphene_std::raster::BlendMode;
use graphene_std::raster::Image;
use graphene_std::transform::Footprint;
Expand Down Expand Up @@ -229,6 +231,16 @@ pub enum DocumentMessage {
UpdateVectorData {
vector_data: HashMap<NodeId, Arc<Vector>>,
},
// `Message` is only serialized at `editor_wrapper.rs`, and only inputs from JS pass through it.
// `UpdateFillAttributes` and `UpdateStrokePaintAttributes` are produced inside `editor.handle_message` by `node_graph_executor.rs` and consumed in the same dispatch loop, so it never reaches that serialization point.
#[serde(skip)]
UpdateFillAttributes {
fill_attributes: HashMap<NodeId, Arc<List<Graphic>>>,
},
#[serde(skip)]
UpdateStrokePaintAttributes {
stroke_paint_attributes: HashMap<NodeId, Arc<List<Graphic>>>,
},
Undo,
UngroupSelectedLayers,
UngroupLayer {
Expand Down
45 changes: 43 additions & 2 deletions editor/src/messages/portfolio/document/document_message_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,34 @@ impl MessageHandler<DocumentMessage, DocumentMessageContext<'_>> for DocumentMes
.collect();
self.network_interface.update_vector_data(layer_vector_data);
}
DocumentMessage::UpdateFillAttributes { fill_attributes } => {
// Convert NodeId keys to LayerNodeIdentifier keys, filtering to only layers
let layer_fill_attributes = fill_attributes
.into_iter()
.filter(|(node_id, _)| self.network_interface.document_network().nodes.contains_key(node_id))
.filter_map(|(node_id, attrs)| {
self.network_interface.is_layer(&node_id, &[]).then(|| {
let layer = LayerNodeIdentifier::new(node_id, &self.network_interface);
(layer, attrs)
})
})
.collect();
self.network_interface.update_fill_attributes(layer_fill_attributes);
}
DocumentMessage::UpdateStrokePaintAttributes { stroke_paint_attributes } => {
// Convert NodeId keys to LayerNodeIdentifier keys, filtering to only layers
let layer_stroke_paint_attributes = stroke_paint_attributes
.into_iter()
.filter(|(node_id, _)| self.network_interface.document_network().nodes.contains_key(node_id))
.filter_map(|(node_id, attrs)| {
self.network_interface.is_layer(&node_id, &[]).then(|| {
let layer = LayerNodeIdentifier::new(node_id, &self.network_interface);
(layer, attrs)
})
})
.collect();
self.network_interface.update_stroke_paint_attributes(layer_stroke_paint_attributes);
}
DocumentMessage::Undo => {
if self.network_interface.transaction_status() != TransactionStatus::Finished {
return;
Expand Down Expand Up @@ -2390,10 +2418,23 @@ impl DocumentMessageHandler {
continue;
};

let has_fill = !matches!(style.fill, Fill::None);
let fill_graphic_list = self.network_interface.document_metadata().layer_fill_attributes.get(&layer);
let stroke_paint_graphic_list = self.network_interface.document_metadata().layer_stroke_paint_attributes.get(&layer);

let has_fill = if let Some(list) = fill_graphic_list {
list.element(0).is_some()
} else {
!matches!(style.fill, Fill::None)
};
// `style.stroke` is `Some` whenever a `Stroke` node is in the chain, even with weight 0 or a transparent color.
// So `is_some()` would treat invisibly-stroked fill-only layers as having a stroke.
let has_stroke = style.stroke.as_ref().is_some_and(|s| s.has_renderable_stroke());
// `ATTR_STROKE_PAINT_GRAPHIC` is the source of truth when set; fall back to `style.stroke.color` only when no row attribute is present.
let stroke_paint_visible = if let Some(list) = stroke_paint_graphic_list {
list.element(0).is_some_and(|g| !g.is_fully_transparent())
} else {
style.stroke.as_ref().and_then(|s| s.color()).is_some_and(|c| c.a() != 0.)
};
let has_stroke = style.stroke.as_ref().is_some_and(|s| s.has_renderable_stroke()) && stroke_paint_visible;

// No stroke means there's nothing to solidify. Fill-only layers are already in the desired form, so skip.
if !has_stroke {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use crate::messages::portfolio::document::utility_types::network_interface::Flow
use crate::messages::tool::common_functionality::graph_modification_utils;
use glam::{DAffine2, DVec2};
use graph_craft::document::NodeId;
use graphene_std::Graphic;
use graphene_std::list::List;
use graphene_std::math::quad::Quad;
use graphene_std::subpath;
use graphene_std::transform::Footprint;
Expand Down Expand Up @@ -39,6 +41,12 @@ pub struct DocumentMetadata {
/// Vector data keyed by layer ID, used as fallback when no Path node exists.
/// This provides accurate SegmentIds for layers without explicit Path nodes.
pub layer_vector_data: HashMap<LayerNodeIdentifier, Arc<Vector>>,
/// Per-layer `ATTR_FILL_GRAPHIC` row attribute, exposed so message handlers can read paint
/// information that lives on the list.
pub layer_fill_attributes: HashMap<LayerNodeIdentifier, Arc<List<Graphic>>>,
/// Per-layer `ATTR_STROKE_PAINT_GRAPHIC` row attribute, exposed so message handlers can read
/// stroke paint information that lives on the list.
pub layer_stroke_paint_attributes: HashMap<LayerNodeIdentifier, Arc<List<Graphic>>>,
/// Transform from document space to viewport space.
pub document_to_viewport: DAffine2,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ use graph_craft::Type;
use graph_craft::document::value::TaggedValue;
use graph_craft::document::{DocumentNode, DocumentNodeImplementation, NodeId, NodeInput, NodeNetwork, OldDocumentNodeImplementation, OldNodeNetwork};
use graphene_std::ContextDependencies;
use graphene_std::Graphic;
use graphene_std::list::List;
use graphene_std::math::quad::Quad;
use graphene_std::subpath::Subpath;
use graphene_std::transform::Footprint;
Expand Down Expand Up @@ -3396,6 +3398,16 @@ impl NodeNetworkInterface {
pub fn update_vector_data(&mut self, new_layer_vector_data: HashMap<LayerNodeIdentifier, Arc<Vector>>) {
self.document_metadata.layer_vector_data = new_layer_vector_data;
}

/// Update the per-layer `ATTR_FILL_GRAPHIC` snapshot.
pub fn update_fill_attributes(&mut self, new_layer_fill_attributes: HashMap<LayerNodeIdentifier, Arc<List<Graphic>>>) {
self.document_metadata.layer_fill_attributes = new_layer_fill_attributes;
}

/// Update the per-layer `ATTR_STROKE_PAINT_GRAPHIC` snapshot.
pub fn update_stroke_paint_attributes(&mut self, new_layer_stroke_paint_attributes: HashMap<LayerNodeIdentifier, Arc<List<Graphic>>>) {
self.document_metadata.layer_stroke_paint_attributes = new_layer_stroke_paint_attributes;
}
}

// Public mutable methods
Expand Down
4 changes: 4 additions & 0 deletions editor/src/node_graph_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,8 @@ impl NodeGraphExecutor {
text_frames,
clip_targets,
vector_data,
fill_attributes,
stroke_paint_attributes,
backgrounds: _,
} = render_output.metadata;

Expand All @@ -452,6 +454,8 @@ impl NodeGraphExecutor {
responses.add(DocumentMessage::UpdateTextFrames { text_frames });
responses.add(DocumentMessage::UpdateClipTargets { clip_targets });
responses.add(DocumentMessage::UpdateVectorData { vector_data });
responses.add(DocumentMessage::UpdateFillAttributes { fill_attributes });
responses.add(DocumentMessage::UpdateStrokePaintAttributes { stroke_paint_attributes });
responses.add(DocumentMessage::RenderScrollbars);
responses.add(DocumentMessage::RenderRulers);
responses.add(OverlaysMessage::Draw);
Expand Down
6 changes: 6 additions & 0 deletions node-graph/libraries/core-types/src/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ pub const ATTR_SPREAD_METHOD: &str = "spread_method";
/// Gradient's `GradientType` (`Linear` or `Radial`).
pub const ATTR_GRADIENT_TYPE: &str = "gradient_type";

/// List<Graphic> data for fill.
pub const ATTR_FILL_GRAPHIC: &str = "fill_graphic";

/// List<Graphic> data for stroke.
pub const ATTR_STROKE_PAINT_GRAPHIC: &str = "stroke_paint_graphic";

// ========================
// TRAIT: AnyAttributeValue
// ========================
Expand Down
Loading
Loading