Skip to content
Snippets Groups Projects
Commit ecf2c3af authored by Maurice Raybaud's avatar Maurice Raybaud
Browse files

Further Error handling to allow win 32 bits blender builds to render with...

Further Error handling to allow win 32 bits blender builds to render with Povray 64 bits and the other way around.
parent aeb3cb5a
Branches
Tags
No related merge requests found
...@@ -1638,60 +1638,79 @@ class PovrayRender(bpy.types.RenderEngine): ...@@ -1638,60 +1638,79 @@ class PovrayRender(bpy.types.RenderEngine):
regKey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, "Software\\POV-Ray\\v3.7\\Windows") regKey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, "Software\\POV-Ray\\v3.7\\Windows")
#64 bits blender # TODO, report api
# 64 bits blender
if bitness == 64: if bitness == 64:
try: try:
pov_binary = winreg.QueryValueEx(regKey, "Home")[0] + "\\bin\\pvengine64" pov_binary = winreg.QueryValueEx(regKey, "Home")[0] + "\\bin\\pvengine64"
self._process = subprocess.Popen([pov_binary, self._temp_file_ini] + extra_args)
# This would work too but means we have to wait until its done:
# os.system("%s %s" % (pov_binary, self._temp_file_ini))
except OSError: except OSError:
# someone might run povray 32 bits on a 64 bits blender machine # someone might run povray 32 bits on a 64 bits blender machine
try: try:
pov_binary = winreg.QueryValueEx(regKey, "Home")[0] + "\\bin\\pvengine" pov_binary = winreg.QueryValueEx(regKey, "Home")[0] + "\\bin\\pvengine"
self._process = subprocess.Popen([pov_binary, self._temp_file_ini] + extra_args)
except OSError: except OSError:
# TODO, report api
print("POV-Ray 3.7: could not execute '%s', possibly POV-Ray isn't installed" % pov_binary) print("POV-Ray 3.7: could not execute '%s', possibly POV-Ray isn't installed" % pov_binary)
import traceback
traceback.print_exc()
print ("***-DONE-***")
return False
else: else:
print("POV-Ray 3.7 64 bits could not execute, running 32 bits instead") print("POV-Ray 3.7 64 bits could not execute, running 32 bits instead")
print("Command line arguments passed: " + str(extra_args))
return True
else: else:
print("POV-Ray 3.7 64 bits found") print("POV-Ray 3.7 64 bits found")
print("Command line arguments passed: " + str(extra_args))
return True
#32 bits blender #32 bits blender
else: else:
try: try:
pov_binary = winreg.QueryValueEx(regKey, "Home")[0] + "\\bin\\pvengine" pov_binary = winreg.QueryValueEx(regKey, "Home")[0] + "\\bin\\pvengine"
self._process = subprocess.Popen([pov_binary, self._temp_file_ini] + extra_args)
# someone might also run povray 64 bits with a 32 bits build of blender. # someone might also run povray 64 bits with a 32 bits build of blender.
except OSError: except OSError:
try: try:
pov_binary = winreg.QueryValueEx(regKey, "Home")[0] + "\\bin\\pvengine64" pov_binary = winreg.QueryValueEx(regKey, "Home")[0] + "\\bin\\pvengine64"
self._process = subprocess.Popen([pov_binary, self._temp_file_ini] + extra_args)
except OSError: except OSError:
# TODO, report api
print("POV-Ray 3.7: could not execute '%s', possibly POV-Ray isn't installed" % pov_binary) print("POV-Ray 3.7: could not execute '%s', possibly POV-Ray isn't installed" % pov_binary)
import traceback
traceback.print_exc()
print ("***-DONE-***")
return False
else: else:
print("Running POV-Ray 3.7 64 bits build with 32 bits Blender, \nYou might want to run Blender 64 bits as well.") print("Running POV-Ray 3.7 64 bits build with 32 bits Blender, \nYou might want to run Blender 64 bits as well.")
print("Command line arguments passed: " + str(extra_args))
return True
else: else:
print("POV-Ray 3.7 32 bits found") print("POV-Ray 3.7 32 bits found")
print("Command line arguments passed: " + str(extra_args))
return True
else: else:
# DH - added -d option to prevent render window popup which leads to segfault on linux # DH - added -d option to prevent render window popup which leads to segfault on linux
extra_args.append("-d") extra_args.append("-d")
# print("Extra Args: " + str(extra_args)) # TODO, when POV-Ray isn't found this can probably still give a cryptic error on linux,
# would be nice to be able to detect if it exists
if 1:
# TODO, when POV-Ray isn't found this gives a cryptic error, would be nice to be able to detect if it exists
try:
self._process = subprocess.Popen([pov_binary, self._temp_file_ini] + extra_args) # stdout=subprocess.PIPE, stderr=subprocess.PIPE
except OSError:
# TODO, report api
print("POV-Ray 3.7: could not execute '%s', possibly POV-Ray isn't installed" % pov_binary)
import traceback
traceback.print_exc()
print ("***-DONE-***")
return False
else:
# This works too but means we have to wait until its done
os.system("%s %s" % (pov_binary, self._temp_file_ini))
# print ("***-DONE-***") print("Command line arguments passed: " + str(extra_args))
return True
def _cleanup(self): def _cleanup(self):
for f in (self._temp_file_in, self._temp_file_ini, self._temp_file_out): for f in (self._temp_file_in, self._temp_file_ini, self._temp_file_out):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment