UI: Allow copy & paste images in linux/Wayland #119117
No reviewers
Labels
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#119117
Loading…
Reference in New Issue
No description provided.
Delete Branch "Jose-Vicente-Barrachina/blender:wl-image-clipboard"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds copy and paste images functionality to and from the image editor in linux/Wayland clipboard.
Basically, this PR adds the new functions stated in #111404, using the already existing code for copying and pasting text, and adapting it for its use with images.
Paste
option only gets activated when exists a supported image on the clipboard.Keybord shortcuts (Ctrl-C, Ctrl-V) don't seem to be working. I don't know if this was intended also in #105833 or it is necessary to modify some other part of the code.
Since previous code was intended for use with text mime types, a refactor would be necessary to make the clipboard implementation more type-agnostic.
Currently, the only format supported is
PNG
, in accordance to #105833 and the use of alpha channels, but it will be easy to include other formats.I've tested the functionality with:
That is expected. Those obvious keyboard shortcuts are not in our keymap yet. While Image Editor is in "mask" mode then Ctrl-C and Ctrl-V are currently used for copying and pasting splines. I can imagine that we'll give this a rethink if we have image copy/paste for all platforms.
The use of PNG in that was for a very platform-specific reason. Although Windows supplies clipboard copy/paste functionality with defined formats (along with the ability to define custom ones), the built-in formats did not support alpha channels until very recently. This meant that many programs used the same custom format (using PNG) to transfer in a way that preserved alpha. This means that on Windows we need to put two image formats on the clipboard at once so that applications can take whatever is best.
For Linux feel free to support whatever formats make the most sense there. Your testing to ensure that you can copy images with alpha with Gimp and Krita is probably all we really need. So if you can do that without using PNG that's great, or if just just using PNG works that's also fine.
I don't compile for Linux, so having Campbell as reviewer is perfect. But he is quite busy right now, so review by others is also welcome. Having expanded platform support of image copy/paste is on our short-term roadmap, so having this within the 4.2 release schedule would be ideal.
Thanks for working on this!
Hi.
The "issue" here is that, if I've understood correctly how the clipboard works, Wayland requires creating a buffer for each type of image offered before the clients choose which format is best for them, you can't do it on demand. So, as many formats supported, more memory needed.
If
png
is enough I'd leave it as it is. Anyway, if other types are needed, adding them is trivial.Thank you so much.
I'll be working on supporting this in X11.
@Jose-Vicente-Barrachina
Sorry if I rambled and was not clear. I was only trying to say that you can disregard everything that I did for the Window code and do whatever makes sense, or is simplest, for this platform. So if supporting just PNG works, that's just awesome.
Wonderful!
Oh, don't worry, not at all. I understood you perfectly.
I was trying to explain why I did it that way. I'm a noob 😄 .
I think all modern apps support
png
but, ni case I'm wrong, I just wanted to point out that adding other mime types is easy.Sorry if I overexplain myself. English is not my first language and maybe I don't make thinks clear as I should.
Are there any remaining TODO's with this PR or is it ready for review?
It's ready for review. Do I have to remove the WIP prefix?
It doesn't include support for linux/X11 yet, but I was thinking of making a separate pull request, since this is functional.
WIP: UI: Allow copy & paste images in linux/Waylandto UI: Allow copy & paste images in linux/WaylandYes, remove the WIP prefix if it's ready (WIP means you intend to make further changes).
Also, best split X11 into a separate PR.
Committed with minor edits:
data
read which would be null on failure to read (broken pipe for e.g.).data_len
toThreadResult
for consistency.IMAGE_MT_image
checks explicitly for Wayland (instead of Linux).