Skip to content

New node: 'Bake Footprint', with a draggable footprint cage - #5014

Open
TrueDoctor wants to merge 3 commits into
masterfrom
new-node-bake-footprint
Open

TrueDoctor wants to merge 3 commits into
masterfrom
new-node-bake-footprint

Conversation

@TrueDoctor

Copy link
Copy Markdown
Member

Add a bake transform node which sets the footprint and add a draggable cage for the footprint widget.
image
This also makes it possible to modify the bounds for the rasterize node via a gizmo

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 20 files

Confidence score: 3/5

  • context.rs unconditionally inverts the supplied footprint, so a zero-sized or singular area can pass a non-finite transform into the wrapped graph. Validate the footprint transform and resolution before inversion.
  • observations.rs drops every vector after row 0 for multi-element Path inputs, which can leave path overlays and editing state out of sync with rendered geometry. Preserve all list rows or normalize observations to match the rendered geometry.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="node-graph/nodes/gcore/src/context.rs">

<violation number="1" location="node-graph/nodes/gcore/src/context.rs:144">
P2: This unconditionally inverts a user-provided footprint, so a zero-sized or singular area injects a singular/non-finite transform into the wrapped graph. Validate the footprint transform and resolution before inversion and handle the invalid input with a localized failure or empty result, matching `rasterize_with_vello`.</violation>
</file>

<file name="editor/src/node_graph_executor/observations.rs">

<violation number="1" location="editor/src/node_graph_executor/observations.rs:45">
P2: This drops every vector after row 0 when a `Path` node receives a multi-element list, so the editor’s path overlays and editing state no longer match the rendered geometry. Preserve all list rows or normalize the observed value through the same ranked adapter used by the node before building the editable geometry.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

let area = footprint.into_element();
let unit_square_to_pixels = DAffine2::from_scale(area.resolution.as_dvec2());
let footprint = Footprint {
transform: unit_square_to_pixels * area.transform.inverse(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This unconditionally inverts a user-provided footprint, so a zero-sized or singular area injects a singular/non-finite transform into the wrapped graph. Validate the footprint transform and resolution before inversion and handle the invalid input with a localized failure or empty result, matching rasterize_with_vello.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At node-graph/nodes/gcore/src/context.rs, line 144:

<comment>This unconditionally inverts a user-provided footprint, so a zero-sized or singular area injects a singular/non-finite transform into the wrapped graph. Validate the footprint transform and resolution before inversion and handle the invalid input with a localized failure or empty result, matching `rasterize_with_vello`.</comment>

<file context>
@@ -96,6 +97,96 @@ fn read_index(
+	let area = footprint.into_element();
+	let unit_square_to_pixels = DAffine2::from_scale(area.resolution.as_dvec2());
+	let footprint = Footprint {
+		transform: unit_square_to_pixels * area.transform.inverse(),
+		..area
+	};
</file context>

Comment thread editor/src/node_graph_executor.rs Resolved
Comment thread editor/src/node_graph_executor.rs Resolved
let value = result.data.as_ref()?;

let geometry = match value.downcast_ref::<List<Vector>>() {
Some(list) => VectorGeometry::new(list.element(0).cloned().unwrap_or_default(), paths_from_list_row_attributes(list, 0).cloned().unwrap_or_default()),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This drops every vector after row 0 when a Path node receives a multi-element list, so the editor’s path overlays and editing state no longer match the rendered geometry. Preserve all list rows or normalize the observed value through the same ranked adapter used by the node before building the editable geometry.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At editor/src/node_graph_executor/observations.rs, line 45:

<comment>This drops every vector after row 0 when a `Path` node receives a multi-element list, so the editor’s path overlays and editing state no longer match the rendered geometry. Preserve all list rows or normalize the observed value through the same ranked adapter used by the node before building the editable geometry.</comment>

<file context>
@@ -0,0 +1,51 @@
+			let value = result.data.as_ref()?;
+
+			let geometry = match value.downcast_ref::<List<Vector>>() {
+				Some(list) => VectorGeometry::new(list.element(0).cloned().unwrap_or_default(), paths_from_list_row_attributes(list, 0).cloned().unwrap_or_default()),
+				None => VectorGeometry::from_item(value.downcast_ref::<Item<Vector>>()?),
+			};
</file context>

Comment thread node-graph/nodes/gcore/src/context.rs Resolved
@TrueDoctor TrueDoctor changed the title New node: "Bake Footprint" with a draggable footprint cage New node: 'Bake Footprint', with a draggable footprint cage Nov 24, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 10 files (changes from recent commits).

Confidence score: 3/5

  • In footprint_cage.rs, clamping the size can move the stationary edge when a resize crosses it, and centered drags may end up off-center. Preserve the fixed edge and recenter the clamped dimension for centered drags.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="editor/src/messages/tool/common_functionality/gizmos/footprint_cage.rs">

<violation number="1" location="editor/src/messages/tool/common_functionality/gizmos/footprint_cage.rs:143">
P2: Clamping `size` without adjusting `position` moves the stationary edge when a resize collapses past it. Preserve the fixed edge while enforcing the minimum size, and recenter the clamped dimension for centered drags.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic


let original_area = drag.original_area;
let one_pixel = original_area.resolution.as_dvec2().recip();
let size = size.max(one_pixel);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Clamping size without adjusting position moves the stationary edge when a resize collapses past it. Preserve the fixed edge while enforcing the minimum size, and recenter the clamped dimension for centered drags.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At editor/src/messages/tool/common_functionality/gizmos/footprint_cage.rs, line 143:

<comment>Clamping `size` without adjusting `position` moves the stationary edge when a resize collapses past it. Preserve the fixed edge while enforcing the minimum size, and recenter the clamped dimension for centered drags.</comment>

<file context>
@@ -143,6 +139,9 @@ impl FootprintCage {
 
 		let original_area = drag.original_area;
+		let one_pixel = original_area.resolution.as_dvec2().recip();
+		let size = size.max(one_pixel);
+
 		let area = Footprint {
</file context>

This branch was successfully deployed

1 active deployment
graphite-dev (Preview) — 90d5c809 Deployed Nov 25, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant