[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1677] trunk/py/scripts/addons/ render_povray: pep8 edits for povray, also dont use string addition for textblock contents, write newlines separate.

Campbell Barton ideasman42 at gmail.com
Fri Mar 4 05:39:13 CET 2011


Revision: 1677
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1677
Author:   campbellbarton
Date:     2011-03-04 04:39:13 +0000 (Fri, 04 Mar 2011)
Log Message:
-----------
pep8 edits for povray, also dont use string addition for textblock contents, write newlines separate.

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

Modified: trunk/py/scripts/addons/render_povray/__init__.py
===================================================================
--- trunk/py/scripts/addons/render_povray/__init__.py	2011-03-03 21:00:18 UTC (rev 1676)
+++ trunk/py/scripts/addons/render_povray/__init__.py	2011-03-04 04:39:13 UTC (rev 1677)
@@ -45,7 +45,6 @@
     from render_povray import ui
 
 
-
 def register():
     bpy.utils.register_module(__name__)
 
@@ -252,7 +251,6 @@
 
     #############################MATERIAL######################################
 
-
     Mat.pov_irid_enable = BoolProperty(
             name="Enable Iridescence",
             description="Newton's thin film interference (like an oil slick on a puddle of water or the rainbow hues of a soap bubble.)",
@@ -339,28 +337,27 @@
             default="1")
     ##################################CustomPOV Code############################
     Mat.pov_replacement_text = StringProperty(
-            name = "Declared name:",
+            name="Declared name:",
             description="Type the declared name in custom POV code or an external .inc it points at. texture {} expected",
             default="")
 
-    #Only DUMMIES below for now: 
+    #Only DUMMIES below for now:
     Tex.pov_replacement_text = StringProperty(
-            name = "Declared name:",
+            name="Declared name:",
             description="Type the declared name in custom POV code or an external .inc it points at. pigment {} expected",
             default="")
 
     Obj.pov_replacement_text = StringProperty(
-            name = "Declared name:",
+            name="Declared name:",
             description="Type the declared name in custom POV code or an external .inc it points at. Any POV shape expected e.g: isosurface {}",
             default="")
 
     Cam.pov_replacement_text = StringProperty(
-            name = "Texts in blend file",
+            name="Texts in blend file",
             description="Type the declared name in custom POV code or an external .inc it points at. camera {} expected",
             default="")
     ##############################TEXTURE######################################
 
-
     #Custom texture gamma
     Tex.pov_tex_gamma_enable = BoolProperty(
             name="Enable custom texture gamma",
@@ -374,7 +371,6 @@
 
     #################################OBJECT####################################
 
-
     #Importance sampling
     Obj.pov_importance_value = FloatProperty(
             name="Radiosity Importance",
@@ -424,7 +420,6 @@
 
     ###################################TEXT####################################
 
-
     Text.pov_custom_code = BoolProperty(
             name="Custom Code",
             description="Add this text at the top of the exported POV-Ray file",
@@ -514,7 +509,7 @@
     del Cam.pov_dof_variance  # MR
     del Cam.pov_dof_confidence  # MR
     del Cam.pov_replacement_text  # MR
-    del Text.pov_custom_code  #MR
-    
+    del Text.pov_custom_code  # MR
+
 if __name__ == "__main__":
     register()

Modified: trunk/py/scripts/addons/render_povray/render.py
===================================================================
--- trunk/py/scripts/addons/render_povray/render.py	2011-03-03 21:00:18 UTC (rev 1676)
+++ trunk/py/scripts/addons/render_povray/render.py	2011-03-04 04:39:13 UTC (rev 1677)
@@ -198,6 +198,7 @@
 
 tabLevel = 0
 
+
 def write_pov(filename, scene=None, info_callback=None):
     import mathutils
     #file = filename
@@ -957,7 +958,7 @@
                                 t_alpha = t
 
                 ##############################################################################################################
-                    
+
                 if material.pov_replacement_text != "":
                     file.write("\n")
                     file.write(" texture{%s}\n" % material.pov_replacement_text)
@@ -1465,13 +1466,14 @@
         tabWrite("}\n")
 
     def exportCustomCode():
-        
-        for Text in bpy.data.texts:
-            if Text.pov_custom_code:
-                file.write("\n" + Text.as_string())
+
+        for txt in bpy.data.texts:
+            if txt.pov_custom_code:
+                # Why are the newlines needed?
                 file.write("\n")
+                file.write(txt.as_string())
+                file.write("\n")
 
-
     sel = scene.objects
     comments = scene.pov_comments_enable
     if not scene.pov_tempfiles_enable and comments:
@@ -1481,7 +1483,7 @@
     if not scene.pov_tempfiles_enable and comments:
         file.write("\n//--CUSTOM CODE--\n\n")
     exportCustomCode()
-        
+
     if not scene.pov_tempfiles_enable and comments:
         file.write("\n//--Global settings and background--\n\n")
 

Modified: trunk/py/scripts/addons/render_povray/ui.py
===================================================================
--- trunk/py/scripts/addons/render_povray/ui.py	2011-03-03 21:00:18 UTC (rev 1676)
+++ trunk/py/scripts/addons/render_povray/ui.py	2011-03-04 04:39:13 UTC (rev 1677)
@@ -508,7 +508,7 @@
 
 class MATERIAL_PT_povray_replacement_text(MaterialButtonsPanel, bpy.types.Panel):
     bl_label = "Custom POV Code"
-    COMPAT_ENGINES = {'POVRAY_RENDER'} 
+    COMPAT_ENGINES = {'POVRAY_RENDER'}
 
     def draw(self, context):
         layout = self.layout
@@ -540,7 +540,7 @@
 
 class TEXTURE_PT_povray_replacement_text(TextureButtonsPanel, bpy.types.Panel):
     bl_label = "Custom POV Code"
-    COMPAT_ENGINES = {'POVRAY_RENDER'} 
+    COMPAT_ENGINES = {'POVRAY_RENDER'}
 
     def draw(self, context):
         layout = self.layout
@@ -569,9 +569,10 @@
         col.label(text="Photons:")
         col.prop(obj, "pov_collect_photons", text="Receive Photon Caustics")
 
+
 class OBJECT_PT_povray_replacement_text(ObjectButtonsPanel, bpy.types.Panel):
     bl_label = "Custom POV Code"
-    COMPAT_ENGINES = {'POVRAY_RENDER'} 
+    COMPAT_ENGINES = {'POVRAY_RENDER'}
 
     def draw(self, context):
         layout = self.layout
@@ -602,7 +603,7 @@
         layout.prop(cam, "pov_dof_aperture")
 
         split = layout.split()
-        
+
         col = split.column()
         col.prop(cam, "pov_dof_samples_min")
         col.prop(cam, "pov_dof_variance")
@@ -614,7 +615,7 @@
 
 class CAMERA_PT_povray_replacement_text(CameraDataButtonsPanel, bpy.types.Panel):
     bl_label = "Custom POV Code"
-    COMPAT_ENGINES = {'POVRAY_RENDER'} 
+    COMPAT_ENGINES = {'POVRAY_RENDER'}
 
     def draw(self, context):
         layout = self.layout
@@ -628,7 +629,7 @@
 
 class TEXT_PT_povray_custom_code(TextButtonsPanel, bpy.types.Panel):
     bl_label = "P.O.V-Ray"
-    COMPAT_ENGINES = {'POVRAY_RENDER'} 
+    COMPAT_ENGINES = {'POVRAY_RENDER'}
 
     def draw(self, context):
         layout = self.layout
@@ -636,7 +637,3 @@
         text = context.space_data.text
         if text:
             layout.prop(text, "pov_custom_code", text="Add as POV code")
-
-
-
-



More information about the Bf-extensions-cvs mailing list