elmopl / ktba

Blender addons
MIT License
56 stars 12 forks source link

Unsaved .blend cause error #7

Closed tin2tin closed 3 years ago

tin2tin commented 6 years ago

If the .blend project isn't saved before running Parallel Render, it will cause an error and stop the export.

image

On the same note, if ex. resolution is changed after the .blend is saved it will not have an effect on the Parallel Rendered file. So, in other words, you'll have to save the .blend each time anything has been changed, to have effect on the render.

Here's a bit on how to check it: https://blender.stackexchange.com/questions/58711/python-check-if-file-was-saved

elmopl commented 6 years ago

I had this issue and I thought I fixed it with latest commit (77b90a5ad). The version without latest changes showed above.

I do check if file needs saving. If you save it (there should be no '*' in title of Blender window to indicate that) just before running add-on it will not try to save temporary file.

I've been trying to reproduce it with latest code, but I can't find a way for it to fail. Generally issue happened when file I tried to save already existed. However newest version of code should be creating a whole temporary directory (with random name as returned by mkdtemp), so those clashes should never happen.

On the same note, if ex. resolution is changed after the .blend is saved it will not have an effect on the Parallel Rendered file. So, in other words, you'll have to save the .blend each time anything has been changed, to have effect on the render.

Which is why I am trying to save a copy and work on copy. I would rather not make "render" add-on make "changes" to your project (i.e. save it).

To be perfectly honest I am a bit stuck here, as not being able to reproduce makes it quite hard to find a fix.

tin2tin commented 6 years ago

Here's what I do. I am using the latest code. I start Blender 2.79 on Win 8 with factory settings and I do not load any .blend file. I install the add on. Go to vse add a movie clip(.mov). Open preferences. Set file format to Ffmpeg video. Container to mpeg-4 and codec to h.264. Run the add on. Check all boxes and hit okay. Then this error shows up. The only way to proceed is to save the .blend. Maybe it is an OS problem?

elmopl commented 6 years ago

Oh, ok. Condition to reproduce is that you never saved your file (and not that you don't have most recent changes save in otherwise already save project). Now I understand why you were pointing me at that stackoverflow question.

I only check is_dirty. I don't look at is_saved. As you have never saved the file weird things might happen when I ask Blender to give me path to current project file (so that I can save a temporary in the same place to make sure all relative paths work). This probably ends up generating odd path that then screws up attempts to save a bit later.

I will play with it.

tin2tin commented 6 years ago

[I just want to mention that I posted about your add on a few days ago in the VSE group on Facebook - I hope that's okay? https://www.facebook.com/groups/1981104845289453/permalink/1991843484215589/ Maybe you want to join the group?]

elmopl commented 5 years ago

Quite annoyingly it seems is_dirty is a bit unreliable in test set up I currently have (https://blender.stackexchange.com/questions/127040/how-to-get-bpy-data-is-dirty-updating-when-changes-are-done-by-script). Not sure how to workaround that specific issue.

I believe I have fixed this, but I will have to manually play with Blender to make sure that it works better than it did before.

tin2tin commented 5 years ago

I don't know about these things. Maybe you can also post your question here: https://devtalk.blender.org/c/python

I wonder if the poll can be used to detect if the file has been saved? https://docs.blender.org/api/2.79/bpy.types.Operator.html?highlight=poll#bpy.types.Operator.poll