b-init / ImagePaste

A simple Blender addon to grab images from your clipboard and paste as a reference image in viewport or onto the image editor.
GNU General Public License v3.0
251 stars 9 forks source link

BUG: Fail to paste from clipboard in 3D viewport (Blender 4.2.0) (Image Paste 1.8.1) (Windows 10) #56

Closed herbyhack closed 4 months ago

herbyhack commented 4 months ago

Describe the bug

Add-on fails to paste image from clipboard into 3D viewport (either as reference image or plane). Blender 4.2.0 (Windows 10).

The addon seems to still be functioning fine in the Blender Image Editor. (Haven't tested further in Shader Editor or Video Editor)

Image below is for pasting image "...as Plane" (very similar error for "...as Reference" - please see log below)

image

Step to reproduce

  1. Snip something in Windows 10 (Win+Shift+S)
  2. Go to bledner 3d vieport.
  3. Shift A -> Image -> Paste from Clipboard as...

Relevant log output

********************************************
//******* Paste as Plane...***/// ERROR:
********************************************

Python: Traceback (most recent call last):
  File "C:\Users\Andrew\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons\imagepaste\imagepaste\operators.py", line 161, in execute
    bpy.ops.import_image.to_plane(files=[{"name": image.filepath}])
  File "C:\Program Files\Blender Foundation\Blender\blender-4.2.0-LTS-windows-x64\4.2\scripts\modules\bpy\ops.py", line 109, in __call__
    ret = _op_call(self.idname_py(), kw)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: Calling operator "bpy.ops.import_image.to_plane" error, could not be found

***********************************************
//******* Paste as Reference...***/// ERROR:
***********************************************

Python: Traceback (most recent call last):
  File "C:\Users\Andrew\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons\imagepaste\imagepaste\operators.py", line 188, in execute
    bpy.ops.object.load_reference_image(filepath=image.filepath)
  File "C:\Program Files\Blender Foundation\Blender\blender-4.2.0-LTS-windows-x64\4.2\scripts\modules\bpy\ops.py", line 109, in __call__
    ret = _op_call(self.idname_py(), kw)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: Calling operator "bpy.ops.object.load_reference_image" error, could not be found

Expected behavior

Image should paste to 3D viewport as Plane or Reference.

Platform

Windows

Platform version

Windows 10 Pro (10.0.19045 Build 19045)

Blender version

Other

ImagePaste Version

1.8.1

alikish4 commented 4 months ago

I experience this as well, blender 4.2 win 10

williamchange commented 4 months ago

The operators probably got renamed but replacing them from the operators.py file should make them work again

bpy.ops.import_image.to_plane to bpy.ops.image.import_as_mesh_planes bpy.ops.object.load_reference_image to bpy.ops.object.empty_image_add

Here's the add-on with the fix (Blender 4.2+) ImagePaste-1.8.2.zip

https://github.com/user-attachments/assets/d1aa1ef5-7108-4cfe-a7bb-8f57774de312

herbyhack commented 4 months ago

Thanks so much,

Add-on now seems to work as intended in 3D viewport (and Image Editor, and VSE, and Shader Editor).

Awesome!

Kind regards, Andrew

[image: image.png]

On Sat, 20 Jul 2024 at 15:04, MW @.***> wrote:

The operators probably got renamed but replacing them from the operators.py file should make them work again

bpy.ops.import_image.to_plane to bpy.ops.image.import_as_mesh_planes bpy.ops.object.load_reference_image to bpy.ops.object.empty_image_add

Here's the add-on with the fix (Blender 4.2+) ImagePaste-1.8.2.zip https://github.com/user-attachments/files/16318911/ImagePaste-1.8.2.zip

https://github.com/user-attachments/assets/d1aa1ef5-7108-4cfe-a7bb-8f57774de312

— Reply to this email directly, view it on GitHub https://github.com/b-init/ImagePaste/issues/56#issuecomment-2240921526, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE7567Z5AY7O3NLDPSYYB53ZNHVWPAVCNFSM6AAAAABLDSZIJKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBQHEZDCNJSGY . You are receiving this because you authored the thread.Message ID: @.***>

herbyhack commented 4 months ago

Image below of addon (1.8.2) working effectively in Blender 4.2.0

image

b-init commented 4 months ago

Sorry I haven't been available. Thanks a lot @williamchange for the fix and others for reporting and helping. This addon would have died long ago without you. I'll update the release and on other platforms.