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
246 stars 9 forks source link

macOS OOP Implementation #15

Closed williamchange closed 3 years ago

williamchange commented 3 years ago

This fixes/amend issues in darwin.py that prevents the addon from functioning correctly on macOS:

  1. Missing execute function calls
  2. Capture the first result from stdout/stderr

I also noted and fixed a typo in the preference panel, a missing space between if and the

Other issues: I also noticed that images gets written inside the .blend(which failed), is it the intended behavior? (The image doesn't get saved as the directory doesn't exist):

i.e. image.png being saved to ..filepath/project.blend/image.png, as reported by the addon

However the image do get saved correctly if it was saved to other directories, though it should be noted that saving an image with the osascript will always return an error(but still saves the file correctly), thus the image will not get pasted:

ImagePaste: Cannot save image: ImagePaste-210720-160706.png<.../project.blend/ImagePaste-210720-160706.png> (*** Error creating a JP2 color space: falling back to sRGB)
williamchange commented 3 years ago

So far what's working:

  1. Copying to clipboard
  2. Pasting image(one or more files) from Finder to Blender
thanhph111 commented 3 years ago

Thank you very much for taking the time to do this. I've change the target branch to oop-implementation to make the main clean before this become official.

I also noticed that images gets written inside the .blend(which failed), is it the intended behavior? (The image doesn't get saved as the directory doesn't exist):

i.e. image.png being saved to ..filepath/project.blend/image.png, as reported by the addon

It's actually a bug, it has been fixed with 2a99d8cee1bfd5cfea8855b931a88f2288eb3503 that I've just commited. Can you merge it again to have the update.

williamchange commented 3 years ago

Thank you very much for taking the time to do this. I've change the target branch to oop-implementation to make the main clean before this become official.

I also noticed that images gets written inside the .blend(which failed), is it the intended behavior? (The image doesn't get saved as the directory doesn't exist): i.e. image.png being saved to ..filepath/project.blend/image.png, as reported by the addon

It's actually a bug, it has been fixed with 2a99d8c that I've just commited. Can you merge it again to have the update.

Yes I can confirm the files are saving correctly now, but still won't be pasted correctly(just one image in clipboard) as it will always return an error:

e.g. (*** Error creating a JP2 color space: falling back to sRGB)

, so now one of the ways to amend this is to see if files get saved(checking if file actually saved to the directory after running the command). What do you think?

williamchange commented 3 years ago

I can confirm now that all of the features are working normally now.

thanhph111 commented 3 years ago

Yeah, if not isfile(filepath): is a good check, but you mean this line still writes an image even there is an error.

e.g. (*** Error creating a JP2 color space: falling back to sRGB)

williamchange commented 3 years ago

Yeah, if not isfile(filepath): is a good check, but you mean this line still writes an image even there is an error.

e.g. (*** Error creating a JP2 color space: falling back to sRGB)

Yeah I have tested it, the image still get correctly written to even though there's an error.