[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1793] trunk/py/scripts/addons/ render_povray/render.py: Further Error handling to allow win 32 bits blender builds to render with Povray 64 bits and the other way around .

Maurice Raybaud mauriceraybaud at hotmail.fr
Wed Apr 6 17:18:16 CEST 2011


Revision: 1793
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1793
Author:   mauriceraybaud
Date:     2011-04-06 15:18:15 +0000 (Wed, 06 Apr 2011)
Log Message:
-----------
Further Error handling to allow win 32 bits blender builds to render with Povray 64 bits and the other way around.

Modified Paths:
--------------
    trunk/py/scripts/addons/render_povray/render.py

Modified: trunk/py/scripts/addons/render_povray/render.py
===================================================================
--- trunk/py/scripts/addons/render_povray/render.py	2011-04-06 11:06:56 UTC (rev 1792)
+++ trunk/py/scripts/addons/render_povray/render.py	2011-04-06 15:18:15 UTC (rev 1793)
@@ -1638,61 +1638,80 @@
 
             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:
                 try:
                     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:
                     # someone might run povray 32 bits on a 64 bits blender machine
                     try:
                         pov_binary = winreg.QueryValueEx(regKey, "Home")[0] + "\\bin\\pvengine"
+                        self._process = subprocess.Popen([pov_binary, self._temp_file_ini] + extra_args)
+                        
                     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:
                         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:
                     print("POV-Ray 3.7 64 bits found")
-
+                    print("Command line arguments passed: " + str(extra_args))
+                    return True
+                
             #32 bits blender
             else:
                 try:
                     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.
                 except OSError:
                     try:
                         pov_binary = winreg.QueryValueEx(regKey, "Home")[0] + "\\bin\\pvengine64"
+                        self._process = subprocess.Popen([pov_binary, self._temp_file_ini] + extra_args)
+                        
                     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:
                         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:
                     print("POV-Ray 3.7 32 bits found")
+                    print("Command line arguments passed: " + str(extra_args))
+                    return True
+                
 
         else:
             # DH - added -d option to prevent render window popup which leads to segfault on linux
             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
+            print("Command line arguments passed: " + str(extra_args))
 
-        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-***")
-        return True
-
     def _cleanup(self):
         for f in (self._temp_file_in, self._temp_file_ini, self._temp_file_out):
             try:



More information about the Bf-extensions-cvs mailing list