Node Editor: Node pasted at double the mouse position #103739

Closed
opened 2023-01-08 15:43:54 +01:00 by kim yongbin · 14 comments

System Information
Operating system: M1 Mac Mini
Graphics card: M1 GPU

Blender Version
Daily 2022-01-08

Short description of error
Node not pasted at mouse cursor position, but double the position in Node Editors (Both Shader and Geometry).

Exact steps for others to reproduce the error
Copy a node.
Paste the node.
It places not the same place.
I assume the pasted position is mouse position * 2.

**System Information** Operating system: M1 Mac Mini Graphics card: M1 GPU **Blender Version** Daily 2022-01-08 **Short description of error** Node not pasted at mouse cursor position, but double the position in Node Editors (Both Shader and Geometry). **Exact steps for others to reproduce the error** Copy a node. Paste the node. It places not the same place. I assume the pasted position is mouse position * 2.
Author

Added subscriber: @kim-yong-bin

Added subscriber: @kim-yong-bin

Added subscriber: @mod_moder

Added subscriber: @mod_moder

Hello, check in new versions, it seems it has already been fixed.

Hello, check in new versions, it seems it has already been fixed.

Added subscriber: @blenderrocket

Added subscriber: @blenderrocket
Member

Added subscriber: @lone_noel

Added subscriber: @lone_noel
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

Thanks for the report, @kim-yong-bin!

I can confirm the issue in latest master. It seems like a small error with the handling of the UI scale in 7355d64f2b and can be reproduced by setting the UI scale to something other than 1.0 (macs with retina displays have some scaling by default so there it's visible with a UI scale of 1.0).

The following fixes it for me:

diff --git a/source/blender/editors/space_node/clipboard.cc b/source/blender/editors/space_node/clipboard.cc
index beda081eec8..95c1c25e343 100644
--- a/source/blender/editors/space_node/clipboard.cc
+++ b/source/blender/editors/space_node/clipboard.cc
@@ -257,11 +257,10 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op)
     }
     /* DPI factor needs to be removed when computing a View2D offset from drawing rects. */
     center /= clipboard.nodes.size();
-    center /= UI_DPI_FAC;
 
     float2 mouse_location;
     RNA_property_float_get_array(op->ptr, offset_prop, mouse_location);
-    const float2 offset = mouse_location - center;
+    const float2 offset = (mouse_location - center) / UI_DPI_FAC;
 
     for (bNode *new_node : node_map.values()) {
       new_node->locx += offset.x;
Thanks for the report, @kim-yong-bin! I can confirm the issue in latest master. It seems like a small error with the handling of the UI scale in 7355d64f2b and can be reproduced by setting the UI scale to something other than `1.0` (macs with retina displays have some scaling by default so there it's visible with a UI scale of `1.0`). The following fixes it for me: ``` diff --git a/source/blender/editors/space_node/clipboard.cc b/source/blender/editors/space_node/clipboard.cc index beda081eec8..95c1c25e343 100644 --- a/source/blender/editors/space_node/clipboard.cc +++ b/source/blender/editors/space_node/clipboard.cc @@ -257,11 +257,10 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op) } /* DPI factor needs to be removed when computing a View2D offset from drawing rects. */ center /= clipboard.nodes.size(); - center /= UI_DPI_FAC; float2 mouse_location; RNA_property_float_get_array(op->ptr, offset_prop, mouse_location); - const float2 offset = mouse_location - center; + const float2 offset = (mouse_location - center) / UI_DPI_FAC; for (bNode *new_node : node_map.values()) { new_node->locx += offset.x; ```
Member

Added subscribers: @HooglyBoogly, @lichtwerk

Added subscribers: @HooglyBoogly, @lichtwerk
Member

CC @HooglyBoogly : mind checking provided fix?

CC @HooglyBoogly : mind checking provided fix?

This issue was referenced by 891fe70d7f

This issue was referenced by 891fe70d7f0a84573b94379d067f00fb0469b0c2
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Hans Goudey self-assigned this 2023-01-09 17:38:11 +01:00

@HooglyBoogly

Hi, Firstly, thank you Hans for your continued and impressive Blender developments.

Recently encountered your node editor changes. Could the functionality of commit 7355d64f2b be further expanded?

Shift+V = paste at mouse position
Ctrl+Shift+V = paste in place

While there’s benefits of the new paste at mouse position, the former paste in place can also be very useful. For example, previously created 72 flag shaders for a particle system (same shader was duplicated & modified). Later the shaders were refined by creating a group node, since shaders nodes were aligned, pasting in place allowed rapid updating of all 72 shaders.

Kind regards.

@HooglyBoogly Hi, Firstly, thank you Hans for your continued and impressive Blender developments. Recently encountered your node editor changes. Could the functionality of commit 7355d64f2be5 be further expanded? Shift+V = paste at mouse position Ctrl+Shift+V = paste in place While there’s benefits of the new paste at mouse position, the former paste in place can also be very useful. For example, previously created 72 flag shaders for a particle system (same shader was duplicated & modified). Later the shaders were refined by creating a group node, since shaders nodes were aligned, pasting in place allowed rapid updating of all 72 shaders. Kind regards.
Member

Hi @david_black, I think that is reasonable and I've seen other people mention it. However the best place for that sort of request is rightclickselect, it's much easier for an idea to get momentum there and it makes it easier for developers to gauge the interest.

Hi @david_black, I think that is reasonable and I've seen other people mention it. However the best place for that sort of request is [rightclickselect](https://blender.community/c/rightclickselect/), it's much easier for an idea to get momentum there and it makes it easier for developers to gauge the interest.

Hi @HooglyBoogly, Thank you for your feedback, the idea wasn't so much a request, rather a method of maintaining the current Blender 3.4 (and older) behavior, while also featuring the new Blender 3.5 implementation.

Hi @HooglyBoogly, Thank you for your feedback, the idea wasn't so much a request, rather a method of maintaining the current Blender 3.4 (and older) behavior, while also featuring the new Blender 3.5 implementation.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
8 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#103739
No description provided.