[Bf-extensions-cvs] [7e05091] master: *converted all calls to file.write of .shading.py to tabWrite function to no longer pass the file variable

Maurice Raybaud noreply at git.blender.org
Mon May 23 21:20:52 CEST 2016


Commit: 7e05091168f0b1bb01c4164dcfeb80be7b2318b4
Author: Maurice Raybaud
Date:   Mon May 23 21:20:39 2016 +0200
Branches: master
https://developer.blender.org/rBA7e05091168f0b1bb01c4164dcfeb80be7b2318b4

*converted all calls to file.write of .shading.py to tabWrite function to no longer pass the file variable

*added a conversion of all image paths to forward slashes, preferred by POV, sending less warning.

*repaired basic handling of packed textures

*rearranged Material UI

===================================================================

M	render_povray/__init__.py
M	render_povray/render.py
M	render_povray/shading.py
M	render_povray/ui.py

===================================================================

diff --git a/render_povray/__init__.py b/render_povray/__init__.py
index f3f217c..f272355 100644
--- a/render_povray/__init__.py
+++ b/render_povray/__init__.py
@@ -351,7 +351,7 @@ class RenderPovSettingsScene(PropertyGroup):
 ###############################################################################
 class RenderPovSettingsMaterial(PropertyGroup):
     irid_enable = BoolProperty(
-            name="Enable Iridescence",
+            name="Iridescence coating",
             description="Newton's thin film interference (like an oil slick on a puddle of "
                         "water or the rainbow hues of a soap bubble.)",
             default=False)
@@ -392,7 +392,7 @@ class RenderPovSettingsMaterial(PropertyGroup):
             min=0.0, max=10.0, soft_min=0.000, soft_max=1.0, default=0)
 
     interior_fade_color = FloatVectorProperty(
-            name="Fade Color", description="Color of filtered attenuation for transparent "
+            name="Interior Fade Color", description="Color of filtered attenuation for transparent "
                                            "materials",
             precision=4, step=0.01, min=0.0, soft_max=1.0,
             default=(0, 0, 0), options={'ANIMATABLE'}, subtype='COLOR')
@@ -412,11 +412,11 @@ class RenderPovSettingsMaterial(PropertyGroup):
             description="Values typically range from 0.0 to 1.0 or higher. Zero is no caustics. "
                         "Low, non-zero values give broad hot-spots while higher values give "
                         "tighter, smaller simulated focal points",
-            min=0.00, max=10.0, soft_min=0.00, soft_max=1.10, default=0.5)
+            min=0.00, max=10.0, soft_min=0.00, soft_max=5.0, default=0.07)
 
-    photons_refraction = BoolProperty(
-            name="Refractive Photon Caustics", description="more physically correct",
-            default=False)
+    refraction_caustics = BoolProperty(
+            name="Refractive Caustics", description="hotspots of light focused when going through the material",
+            default=True)
 
     photons_dispersion = FloatProperty(
             name="Chromatic Dispersion",
@@ -435,10 +435,10 @@ class RenderPovSettingsMaterial(PropertyGroup):
             default=False)
 
     refraction_type = EnumProperty(
-            items=[("0", "None", "use only reflective caustics"),
+            items=[
                    ("1", "Fake Caustics", "use fake caustics"),
                    ("2", "Photons Caustics", "use photons for refractive caustics")],
-            name="Refractive",
+            name="Refraction Type:",
             description="use fake caustics (fast) or true photons for refractive Caustics",
             default="1")
 
diff --git a/render_povray/render.py b/render_povray/render.py
index 822e1be..d773e96 100644
--- a/render_povray/render.py
+++ b/render_povray/render.py
@@ -142,8 +142,9 @@ def imgMapBG(wts):
     
     
 def path_image(image):
-    return bpy.path.abspath(image.filepath, library=image.library)
-
+    return bpy.path.abspath(image.filepath, library=image.library).replace("\\","/")
+    # .replace("\\","/") to get only forward slashes as it's what POV prefers, 
+    # even on windows
 # end find image texture
 # -----------------------------------------------------------------------------
 
@@ -425,7 +426,7 @@ def write_pov(filename, scene=None, info_callback=None):
 
             if material.pov.photons_reflection:
                 pov_photons_reflection = True
-            if material.pov.refraction_type == "0":
+            if not material.pov.refraction_caustics:
                 pov_fake_caustics = False
                 pov_photons_refraction = False
             elif material.pov.refraction_type == "1":
@@ -2709,9 +2710,9 @@ def write_pov(filename, scene=None, info_callback=None):
                                                                         LocalMaterialNames,
                                                                         path_image, imageFormat,
                                                                         imgMap, imgMapTransforms,
-                                                                        file, tabWrite,
+                                                                        tabWrite,
                                                                         string_strip_hyphen,
-                                                                        safety, col)
+                                                                        safety, col, os, preview_dir,  unpacked_images)
                                     ###################################################################
                                     index[0] = idx
                                     idx += 1                                    
@@ -3153,7 +3154,8 @@ def write_pov(filename, scene=None, info_callback=None):
             #string_strip_hyphen(patternNames[texture.name]) #maybe instead of the above
             LocalPatternNames.append(currentPatName) 
             #use above list to prevent writing texture instances several times and assign in mats?
-            file.write("\n#declare PAT_%s = \n" % currentPatName)
+            if (texture.type!='NONE' and texture.pov.tex_pattern_type == 'emulator')or(texture.type =='NONE' and texture.pov.tex_pattern_type != 'emulator'):
+                file.write("\n#declare PAT_%s = \n" % currentPatName)
             file.write(shading.exportPattern(texture, string_strip_hyphen))
             file.write("\n")                
     if comments:
diff --git a/render_povray/shading.py b/render_povray/shading.py
index 1939cbe..deb2ab8 100644
--- a/render_povray/shading.py
+++ b/render_povray/shading.py
@@ -266,7 +266,7 @@ def exportPattern(texture, string_strip_hyphen):
         return colRampStrg
     #much work to be done here only defaults translated for now:
     #pov noise_generator 3 means perlin noise
-    if pat.tex_pattern_type == 'emulator':
+    if tex.type!='NONE' and pat.tex_pattern_type == 'emulator':
         texStrg+="pigment {\n"
         ####################### EMULATE BLENDER VORONOI TEXTURE ####################
         if tex.type == 'VORONOI':  
@@ -547,7 +547,7 @@ def exportPattern(texture, string_strip_hyphen):
         texStrg+="function{pigment{%s}}\n"%PATname       
         texStrg+="\n"
         
-    else:
+    elif pat.tex_pattern_type != 'emulator':
         texStrg+="pigment {\n"
         texStrg+="%s\n"%pat.tex_pattern_type
         if pat.tex_pattern_type == 'agate': 
@@ -706,8 +706,8 @@ def exportPattern(texture, string_strip_hyphen):
     
     
 def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
-                            imageFormat, imgMap, imgMapTransforms, file,
-                            tabWrite, string_strip_hyphen, safety, col):
+                            imageFormat, imgMap, imgMapTransforms, tabWrite,
+                            string_strip_hyphen, safety, col, os, preview_dir, unpacked_images):
     material_finish = materialNames[mater.name]                        
     if mater.use_transparency:
         trans = 1.0 - mater.alpha
@@ -809,17 +809,17 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
     ####################################################################################
 
 
-    file.write("\n")
+    tabWrite("\n")
     # THIS AREA NEEDS TO LEAVE THE TEXTURE OPEN UNTIL ALL MAPS ARE WRITTEN DOWN.
     # --MR
     currentMatName = string_strip_hyphen(materialNames[mater.name])
     LocalMaterialNames.append(currentMatName)
-    file.write("\n#declare MAT_%s = \ntexture{\n" % currentMatName)
+    tabWrite("\n#declare MAT_%s = \ntexture{\n" % currentMatName)
 
     ################################################################################
     
     if mater.pov.replacement_text != "":
-        file.write("%s\n" % mater.pov.replacement_text)
+        tabWrite("%s\n" % mater.pov.replacement_text)
     #################################################################################
     if mater.diffuse_shader == 'MINNAERT':
         tabWrite("\n")
@@ -1107,9 +1107,9 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
         ## scale 1 rotate y*0
         #imageMap = ("{image_map {%s \"%s\" %s }" % \
         #            (imageFormat(textures), textures,imgMap(t_dif)))
-        #file.write("\n\t\t\tuv_mapping pigment %s} %s finish {%s}" % \
+        #tabWrite("\n\t\t\tuv_mapping pigment %s} %s finish {%s}" % \
         #           (imageMap, mapping, safety(material_finish)))
-        #file.write("\n\t\t\tpigment {uv_mapping image_map " \
+        #tabWrite("\n\t\t\tpigment {uv_mapping image_map " \
         #           "{%s \"%s\" %s}%s} finish {%s}" % \
         #           (imageFormat(texturesDif), texturesDif,imgMap(t_dif),
         #            mappingDif, safety(material_finish)))
@@ -1170,7 +1170,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
     
     if colored_specular_found and not special_texture_found:
         if comments:
-            file.write("  // colored highlights with a stransparent metallic layer\n")
+            tabWrite("  // colored highlights with a stransparent metallic layer\n")
         else:
             tabWrite("\n")
     
diff --git a/render_povray/ui.py b/render_povray/ui.py
index 3216ac2..106bf6e 100644
--- a/render_povray/ui.py
+++ b/render_povray/ui.py
@@ -612,46 +612,36 @@ class RENDER_PT_povray_media(WorldButtonsPanel, bpy.types.Panel):
 ##        layout.active = scene.pov.baking_enable
 
 
-class MATERIAL_PT_povray_mirrorIOR(MaterialButtonsPanel, bpy.types.Panel):
-    bl_label = "IOR Mirror"
+class MATERIAL_PT_povray_reflection(MaterialButtonsPanel, bpy.types.Panel):
+    bl_label = "POV-Ray Reflection"
     COMPAT_ENGINES = {'POVRAY_RENDER'}
 
-    def draw_header(self, context):
-        scene = context.material
-
-        self.layout.prop(scene.pov, "mirror_use_IOR", text="")
-
     def draw(self, context):
         layout = self.layout
-
         mat = context.material
-        layout.active = mat.pov.mirror_use_IOR
-
-        if mat.pov.mirror_use_IOR:
+     

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list