From e160e3ce70f7f758d27ac5482aff790941267766 Mon Sep 17 00:00:00 2001 From: mohan-bee Date: Sun, 11 Jan 2026 16:35:17 +0530 Subject: [PATCH 1/3] fix: thumbnail render for empty layers --- editor/src/node_graph_executor/runtime.rs | 52 +++++++++++++---------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/editor/src/node_graph_executor/runtime.rs b/editor/src/node_graph_executor/runtime.rs index 66022cc047..13bbcb8017 100644 --- a/editor/src/node_graph_executor/runtime.rs +++ b/editor/src/node_graph_executor/runtime.rs @@ -8,7 +8,7 @@ use graph_craft::proto::GraphErrors; use graph_craft::wasm_application_io::EditorPreferences; use graph_craft::{ProtoNodeIdentifier, concrete}; use graphene_std::application_io::{ApplicationIo, ExportFormat, ImageTexture, NodeGraphUpdateMessage, NodeGraphUpdateSender, RenderConfig}; -use graphene_std::bounds::RenderBoundingBox; +use graphene_std::bounds::{self, RenderBoundingBox}; use graphene_std::memo::IORecord; use graphene_std::ops::Convert; use graphene_std::raster_types::Raster; @@ -471,33 +471,39 @@ impl NodeRuntime { } return; } - - let bounds = match graphic.bounding_box(DAffine2::IDENTITY, true) { - RenderBoundingBox::None => return, - RenderBoundingBox::Infinite => [DVec2::ZERO, DVec2::new(300., 200.)], - RenderBoundingBox::Rectangle(bounds) => bounds, - }; - let footprint = Footprint { - transform: DAffine2::from_translation(DVec2::new(bounds[0].x, bounds[0].y)), - resolution: UVec2::new((bounds[1].x - bounds[0].x).abs() as u32, (bounds[1].y - bounds[0].y).abs() as u32), - quality: RenderQuality::Full, + // Get the bounds (as an Option) + let bounds_option = match graphic.bounding_box(DAffine2::IDENTITY, true) { + RenderBoundingBox::None => None, + RenderBoundingBox::Infinite => Some([DVec2::ZERO, DVec2::new(300., 200.)]), + RenderBoundingBox::Rectangle(bounds) => Some(bounds), }; + // Generate the SVG based on whether bounds exist + let new_thumbnail_svg = if let Some(bounds) = bounds_option { + let footprint = Footprint { + transform: DAffine2::from_translation(DVec2::new(bounds[0].x, bounds[0].y)), + resolution: UVec2::new((bounds[1].x - bounds[0].x).abs() as u32, (bounds[1].y - bounds[0].y).abs() as u32), + quality: RenderQuality::Full, + }; - // Render the thumbnail from a `Graphic` into an SVG string - let render_params = RenderParams { - footprint, - thumbnail: true, - ..Default::default() - }; - let mut render = SvgRender::new(); - graphic.render_svg(&mut render, &render_params); + // Render the thumbnail from a `Graphic` into an SVG string + let render_params = RenderParams { + footprint, + thumbnail: true, + ..Default::default() + }; + let mut render = SvgRender::new(); + graphic.render_svg(&mut render, &render_params); - // And give the SVG a viewbox and outer ... wrapper tag - render.format_svg(bounds[0], bounds[1]); + // And give the SVG a viewbox and outer ... wrapper tag + render.format_svg(bounds[0], bounds[1]); - // UPDATE FRONTEND THUMBNAIL + render.svg + } else { + // If there are no bounds (empty layer), return an empty SVG vector + Vec::new() + }; - let new_thumbnail_svg = render.svg; + // UPDATE FRONTEND THUMBNAIL let old_thumbnail_svg = thumbnail_renders.entry(parent_network_node_id).or_default(); if old_thumbnail_svg != &new_thumbnail_svg { From f511d5d706626ce2df207dc5129301f72863680d Mon Sep 17 00:00:00 2001 From: mohan-bee Date: Sun, 11 Jan 2026 18:17:57 +0530 Subject: [PATCH 2/3] removed self import --- editor/src/node_graph_executor/runtime.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor/src/node_graph_executor/runtime.rs b/editor/src/node_graph_executor/runtime.rs index 13bbcb8017..6bdd5173b5 100644 --- a/editor/src/node_graph_executor/runtime.rs +++ b/editor/src/node_graph_executor/runtime.rs @@ -8,7 +8,7 @@ use graph_craft::proto::GraphErrors; use graph_craft::wasm_application_io::EditorPreferences; use graph_craft::{ProtoNodeIdentifier, concrete}; use graphene_std::application_io::{ApplicationIo, ExportFormat, ImageTexture, NodeGraphUpdateMessage, NodeGraphUpdateSender, RenderConfig}; -use graphene_std::bounds::{self, RenderBoundingBox}; +use graphene_std::bounds::RenderBoundingBox; use graphene_std::memo::IORecord; use graphene_std::ops::Convert; use graphene_std::raster_types::Raster; From 12ebeb57eac9eb3b180c9a5add6498fe0e48f28f Mon Sep 17 00:00:00 2001 From: mohan-bee Date: Tue, 13 Jan 2026 10:20:40 +0530 Subject: [PATCH 3/3] fix: rename --- editor/src/node_graph_executor/runtime.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/editor/src/node_graph_executor/runtime.rs b/editor/src/node_graph_executor/runtime.rs index 6bdd5173b5..43605e990c 100644 --- a/editor/src/node_graph_executor/runtime.rs +++ b/editor/src/node_graph_executor/runtime.rs @@ -471,14 +471,14 @@ impl NodeRuntime { } return; } - // Get the bounds (as an Option) - let bounds_option = match graphic.bounding_box(DAffine2::IDENTITY, true) { + + let bounds = match graphic.bounding_box(DAffine2::IDENTITY, true) { RenderBoundingBox::None => None, RenderBoundingBox::Infinite => Some([DVec2::ZERO, DVec2::new(300., 200.)]), RenderBoundingBox::Rectangle(bounds) => Some(bounds), }; // Generate the SVG based on whether bounds exist - let new_thumbnail_svg = if let Some(bounds) = bounds_option { + let new_thumbnail_svg = if let Some(bounds) = bounds { let footprint = Footprint { transform: DAffine2::from_translation(DVec2::new(bounds[0].x, bounds[0].y)), resolution: UVec2::new((bounds[1].x - bounds[0].x).abs() as u32, (bounds[1].y - bounds[0].y).abs() as u32),