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

Trying to Undo causes a crash. [BUG] #13

Closed NathanNegreiroMXT closed 3 years ago

NathanNegreiroMXT commented 3 years ago

Describe the bug

If you paste a reference image in, and then try to Undo, blender Crashes.

To Reproduce

  1. Ctrl-Shift-V to paste in a reference image.
  2. Ctrl-Z to Undo.

Expected behavior

The reference image should be removed.

Platform

Operating System:

Blender:

Screenshots/Screencast

N/A

Additional context

N/A

thanhph111 commented 3 years ago

Thank you for your report. I can reproduce it on Linux, both Blender 2.83 and 2.93. The bug comes from this line: https://github.com/Yeetus3141/ImagePaste/blob/894d95be07e5495959132cf167dec72fce465293/__init__.py#L121 and these: https://github.com/Yeetus3141/ImagePaste/blob/894d95be07e5495959132cf167dec72fce465293/__init__.py#L148-L150

These two operators belong to Blender, one from the core and one from the official Import Image as Plane add-on.

With operator bpy.ops.import_image.to_plane, the crash seem to only occur when I change the initial state of the .blend file before executing the operator.

I did some research and it turns out that the bug seems to be related to this planned undo system improvement. I find the Blender version 3.0 alpha less buggy.

So while waiting for the fix, we can use this stopgap: change the state of the scene (e.g., click outside the image) before undo. I may release a patch to temporarily handle it.

thanhph111 commented 3 years ago

@NathanNegreiroMXT the new version has fixed this issue, feel free to let us know if it still happens.