From c5a3c32114fbf649d9354de8f936f50bd4e6640b Mon Sep 17 00:00:00 2001 From: James Lindsay <78500760+0HyperCube@users.noreply.github.com> Date: Wed, 29 Jan 2025 21:09:02 +0000 Subject: [PATCH] Fix regression causing pasted images to have a zero-size transform (#2238) * Use the identity matrix as the default for an image frame * Fix all usages to be equivalent to their pre-refactor versions, opting to keep ZERO not IDENTITY as the default image size --------- Co-authored-by: Keavon Chambers --- .../messages/portfolio/document/document_message_handler.rs | 6 +++++- node-graph/gstd/src/brush.rs | 2 +- node-graph/gstd/src/raster.rs | 2 +- node-graph/gstd/src/wasm_application_io.rs | 3 ++- node-graph/interpreted-executor/src/node_registry.rs | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/editor/src/messages/portfolio/document/document_message_handler.rs b/editor/src/messages/portfolio/document/document_message_handler.rs index 90e0f49b..34ebb2ac 100644 --- a/editor/src/messages/portfolio/document/document_message_handler.rs +++ b/editor/src/messages/portfolio/document/document_message_handler.rs @@ -767,7 +767,11 @@ impl MessageHandler> for DocumentMessag responses.add(DocumentMessage::AddTransaction); - let image_frame = ImageFrame { image, ..Default::default() }; + let image_frame = ImageFrame { + image, + transform: DAffine2::IDENTITY, + alpha_blending: Default::default(), + }; let layer = graph_modification_utils::new_image_layer(image_frame, layer_node_id, self.new_layer_parent(true), responses); if let Some(name) = name { diff --git a/node-graph/gstd/src/brush.rs b/node-graph/gstd/src/brush.rs index 40876dd1..43f5b4c2 100644 --- a/node-graph/gstd/src/brush.rs +++ b/node-graph/gstd/src/brush.rs @@ -272,7 +272,7 @@ fn brush(_: Footprint, image: ImageFrameTable, bounds: ImageFrameTable ImageFrameTable { ..Default::default() }, transform: DAffine2::from_translation(offset) * DAffine2::from_scale(size), - ..Default::default() + alpha_blending: Default::default(), }; ImageFrameTable::new(result) diff --git a/node-graph/gstd/src/wasm_application_io.rs b/node-graph/gstd/src/wasm_application_io.rs index bdbedda9..f5e31a71 100644 --- a/node-graph/gstd/src/wasm_application_io.rs +++ b/node-graph/gstd/src/wasm_application_io.rs @@ -87,7 +87,8 @@ fn decode_image(_: (), data: Arc<[u8]>) -> ImageFrameTable { height: image.height(), ..Default::default() }, - ..Default::default() + transform: glam::DAffine2::IDENTITY, + alpha_blending: Default::default(), }; ImageFrameTable::new(image) diff --git a/node-graph/interpreted-executor/src/node_registry.rs b/node-graph/interpreted-executor/src/node_registry.rs index dda75861..c37c0eb2 100644 --- a/node-graph/interpreted-executor/src/node_registry.rs +++ b/node-graph/interpreted-executor/src/node_registry.rs @@ -161,7 +161,7 @@ fn node_registry() -> HashMap