Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to copy images to clipboard #8769

Closed
yamikukki opened this issue Jan 1, 2024 · 1 comment
Closed

Add the ability to copy images to clipboard #8769

yamikukki opened this issue Jan 1, 2024 · 1 comment
Labels

Comments

@yamikukki
Copy link

Describe the project you are working on

A texture editing tool that requires a lot of copying/pasting for the work-in-progress texture between the tool and an external image editor (for example Krita) in order to apply some complex filters / tools that are impossible to add to Krita via scripting. Generally useful for any kind of image editing tools.

Some other tools that are limited by this include basically any sprite editor plugins / standalone tools, for example Pixelorama (https://www.oramainteractive.com/Pixelorama-Docs/user_manual/selecting/#copy-paste-cut-and-delete)

Describe the problem or limitation you are having in your project

Currently, the class DisplayServer has clipboard_get() to get text, clipboard_set() to set text and clipboard_get_image() to get the image data from the clipboard, but doesn't have clipboard_set_image() for setting the image data to the clipboard.
This prevents me from implementing the ability to quickly copy the image data from my tool to paste it in some other tool.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add clipboard_set_image() method to DisplayServer class to enable the ability to implement image copy/paste functionality.
If some platform doesn't support this functionality, then do nothing / print a warning.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

clipboard_set_image(Image) should accept Image data as the only parameter (the same type as the result type in the clipboard_get_image() method)

If this enhancement will not be used often, can it be worked around with a few lines of script?

I haven't tested this method yet, but if it's possible, the only workaround is to create a C++ Dll / GDExtension, pass DisplayServer.WindowGetNativeHandle(DisplayServer.HandleType.WindowHandle) into it together with the image bytes, dimensions and encoding, and then implement the desired functionality with the help of WinAPI's winuser.h.
If this doesn't work, then the only option is to save the WIP texture into a file, then reload this file in the image editing app, then copy-paste it to your actual .psd project to work on it there.
It's doable this way, but I expect my tool's users to transfer the WIP texture back and forth at least a few dozens to a few hundred times, so having the ability to directly copy/paste images would save them a lot of time and mental energy.

Is there a reason why this should be core and not an add-on in the asset library?

In my opinion it's only natural to have DisplayServer.clipboard_set_image(Image) method, as we already have clipboard_get_image() to match it, just as clipboard_get has its matching clipboard_set

@KoBeWi
Copy link
Member

KoBeWi commented Jan 1, 2024

Thanks for the proposal! Consolidating in #7899.
The feature is already planned and had implementation attempts: godotengine/godot#79561

@KoBeWi KoBeWi closed this as not planned Won't fix, can't repro, duplicate, stale Jan 1, 2024
@KoBeWi KoBeWi added the archived label Jan 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants