Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurice Raybaud <mauriceraybaud@hotmail.fr>2016-05-23 22:20:39 +0300
committerMaurice Raybaud <mauriceraybaud@hotmail.fr>2016-05-23 22:20:39 +0300
commit7e05091168f0b1bb01c4164dcfeb80be7b2318b4 (patch)
treead4ebdbb68b80d00946c9dbd6d75019f4e2ec4f3
parent4eafe3195c9a18aae0813ccf39371ff910d47a5a (diff)
*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
-rw-r--r--render_povray/__init__.py16
-rw-r--r--render_povray/render.py14
-rw-r--r--render_povray/shading.py20
-rw-r--r--render_povray/ui.py130
4 files changed, 71 insertions, 109 deletions
diff --git a/render_povray/__init__.py b/render_povray/__init__.py
index f3f217cc..f2723550 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 822e1be7..d773e96b 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 1939cbe9..deb2ab86 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 3216ac2d..106bf6ed 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:
+ col = layout.column()
+ col.prop(mat.pov, "irid_enable")
+ if mat.pov.irid_enable:
col = layout.column()
- col.alignment = 'CENTER'
- col.label(text="The current Raytrace ")
- col.label(text="Transparency IOR is: " + str(mat.raytrace_transparency.ior))
-
-
-class MATERIAL_PT_povray_metallic(MaterialButtonsPanel, bpy.types.Panel):
- bl_label = "metallic Mirror"
- COMPAT_ENGINES = {'POVRAY_RENDER'}
-
- def draw_header(self, context):
- scene = context.material
-
- self.layout.prop(scene.pov, "mirror_metallic", text="")
-
- def draw(self, context):
- layout = self.layout
-
- mat = context.material
- layout.active = mat.pov.mirror_metallic
-
-
+ col.prop(mat.pov, "irid_amount", slider=True)
+ col.prop(mat.pov, "irid_thickness", slider=True)
+ col.prop(mat.pov, "irid_turbulence", slider=True)
+ col.prop(mat.pov, "conserve_energy")
+ col2=col.split().column()
+
+ if not mat.raytrace_mirror.use:
+ col2.label(text="Please Check Mirror settings :")
+ col2.active = mat.raytrace_mirror.use
+ col2.prop(mat.pov, "mirror_use_IOR")
+ if mat.pov.mirror_use_IOR:
+ col2.alignment = 'CENTER'
+ col2.label(text="The current Raytrace ")
+ col2.label(text="Transparency IOR is: " + str(mat.raytrace_transparency.ior))
+ col2.prop(mat.pov, "mirror_metallic")
+
+
class MATERIAL_PT_povray_fade_color(MaterialButtonsPanel, bpy.types.Panel):
- bl_label = "Interior Fade Color"
+ bl_label = "POV-Ray Absorption"
COMPAT_ENGINES = {'POVRAY_RENDER'}
def draw_header(self, context):
@@ -660,48 +650,15 @@ class MATERIAL_PT_povray_fade_color(MaterialButtonsPanel, bpy.types.Panel):
self.layout.prop(mat.pov, "interior_fade_color", text="")
def draw(self, context):
- # layout = self.layout
- # mat = context.material
- # layout.active = mat.pov.interior_fade_color
- pass
-
-
-class MATERIAL_PT_povray_conserve_energy(MaterialButtonsPanel, bpy.types.Panel):
- bl_label = "conserve energy"
- COMPAT_ENGINES = {'POVRAY_RENDER'}
-
- def draw_header(self, context):
- mat = context.material
-
- self.layout.prop(mat.pov, "conserve_energy", text="")
-
- def draw(self, context):
- layout = self.layout
-
- mat = context.material
- layout.active = mat.pov.conserve_energy
-
-
-class MATERIAL_PT_povray_iridescence(MaterialButtonsPanel, bpy.types.Panel):
- bl_label = "iridescence"
- COMPAT_ENGINES = {'POVRAY_RENDER'}
-
- def draw_header(self, context):
- mat = context.material
-
- self.layout.prop(mat.pov, "irid_enable", text="")
-
- def draw(self, context):
layout = self.layout
-
mat = context.material
- layout.active = mat.pov.irid_enable
-
- if mat.pov.irid_enable:
- col = layout.column()
- col.prop(mat.pov, "irid_amount", slider=True)
- col.prop(mat.pov, "irid_thickness", slider=True)
- col.prop(mat.pov, "irid_turbulence", slider=True)
+ # layout.active = mat.pov.interior_fade_color
+ if mat.pov.interior_fade_color != (0.0, 0.0, 0.0):
+ layout.label(text="Raytrace transparency")
+ layout.label(text="depth max Limit needs")
+ layout.label(text="to be non zero to fade")
+
+ pass
class MATERIAL_PT_povray_caustics(MaterialButtonsPanel, bpy.types.Panel):
@@ -710,28 +667,31 @@ class MATERIAL_PT_povray_caustics(MaterialButtonsPanel, bpy.types.Panel):
def draw_header(self, context):
mat = context.material
-
- self.layout.prop(mat.pov, "caustics_enable", text="")
-
+ if mat.pov.caustics_enable:
+ self.layout.prop(mat.pov, "caustics_enable", text="", icon="PMARKER_SEL" )
+ else:
+ self.layout.prop(mat.pov, "caustics_enable", text="", icon="PMARKER" )
def draw(self, context):
layout = self.layout
mat = context.material
layout.active = mat.pov.caustics_enable
-
+ col = layout.column()
if mat.pov.caustics_enable:
- col = layout.column()
- col.prop(mat.pov, "refraction_type")
+ col.prop(mat.pov, "refraction_caustics")
+ if mat.pov.refraction_caustics:
+
+ col.prop(mat.pov, "refraction_type", text="")
- if mat.pov.refraction_type == "1":
- col.prop(mat.pov, "fake_caustics_power", slider=True)
- elif mat.pov.refraction_type == "2":
- col.prop(mat.pov, "photons_dispersion", slider=True)
- col.prop(mat.pov, "photons_dispersion_samples", slider=True)
+ if mat.pov.refraction_type == "1":
+ col.prop(mat.pov, "fake_caustics_power", slider=True)
+ elif mat.pov.refraction_type == "2":
+ col.prop(mat.pov, "photons_dispersion", slider=True)
+ col.prop(mat.pov, "photons_dispersion_samples", slider=True)
col.prop(mat.pov, "photons_reflection")
- if mat.pov.refraction_type == "0" and not mat.pov.photons_reflection:
+ if not mat.pov.refraction_caustics and not mat.pov.photons_reflection:
col = layout.column()
col.alignment = 'CENTER'
col.label(text="Caustics override is on, ")