Skip to content
This repository has been archived by the owner on Jul 18, 2020. It is now read-only.

Commit

Permalink
Add error message if exception during tile rendering
Browse files Browse the repository at this point in the history
Until now, if for some reason there was a problem with the tile rendering in the exporter, due to errors in the exporter code or (more likely) unexpected changes in the Blender Rendering API, there were no error messages at all, but the render was totally black, making troubleshooting much more difficult for users and developers.

I've added code that shows an error message if there is an exception while rendering the tiles and the cause of the exception. I hope that with this we will be able to better react to changes in Blender API, etc, that affect the Rendering interface.

While implementing this, I discovered there were exceptions in the Material Preview (didn't seem to affect the preview itself, though), so I've used the oportunity to fix that as well.

Changes to be committed:
modified: io/yaf_export.py
  • Loading branch information
DavidBluecame committed Nov 8, 2015
1 parent 313f77a commit a6875b4
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions io/yaf_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import threading
import time
import yafrayinterface
import traceback
from yafaray import PLUGIN_PATH
from yafaray import YAF_ID_NAME
from .yaf_object import yafObject
Expand Down Expand Up @@ -368,11 +369,17 @@ def drawAreaCallback(*args):
if bpy.app.version < (2, 74, 4 ):
l.rect, l.passes[0].rect = tile
else:
l.passes[0].rect, l.passes[1].rect = tile
if self.is_preview:
l.passes[0].rect = tile[0]
else:
l.passes[0].rect, l.passes[1].rect = tile

self.end_result(res)

except:
pass
print("Exporter: Exception while rendering in drawAreaCallback function:")
traceback.print_exc()

self.end_result(res)

def flushCallback(*args):
w, h, tile = args
Expand All @@ -382,11 +389,16 @@ def flushCallback(*args):
if bpy.app.version < (2, 74, 4 ):
l.rect, l.passes[0].rect = tile
else:
l.passes[0].rect, l.passes[1].rect = tile
except BaseException as e:
pass
if self.is_preview:
l.passes[0].rect = tile[0]
else:
l.passes[0].rect, l.passes[1].rect = tile

self.end_result(res)
self.end_result(res)

except BaseException as e:
print("Exporter: Exception while rendering in flushCallback function:")
traceback.print_exc()

t = threading.Thread(
target=self.yi.render,
Expand Down

0 comments on commit a6875b4

Please sign in to comment.