From 4e20bec0ecbba20604c99743087d7d883426b31a Mon Sep 17 00:00:00 2001 From: Maurice Raybaud <mauriceraybaud@hotmail.fr> Date: Thu, 16 Dec 2010 15:18:03 +0000 Subject: [PATCH] Moved some properties assignment out of the UI module and made alpha slider set transparency --- render_povray/render.py | 31 ++++++++++++++----------------- render_povray/ui.py | 18 +++++++++--------- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/render_povray/render.py b/render_povray/render.py index 28b591ebb..f04723c62 100644 --- a/render_povray/render.py +++ b/render_povray/render.py @@ -137,19 +137,6 @@ def safety(name, Level): elif Level == 3: return prefix+name+'1'#used for 1 of specular map -##def safety0(name): #used for 0 of specular map -## try: -## if int(name) > 0: prefix='shader' -## except: prefix='' -## prefix='shader_' -## return prefix+name+'0' -## -##def safety1(name): #used for 1 of specular map -## try: -## if int(name) > 0: prefix='shader' -## except: prefix='' -## prefix='shader_' -## return prefix+name+'1' ##############end safety string name material ##############################EndSF########################### @@ -190,7 +177,16 @@ def write_pov(filename, scene=None, info_callback=None): else: file.write('\tinterior { ior %.6f\n' % material.raytrace_transparency.ior) - + if material.pov_refraction_type=="0": + material.pov_fake_caustics = False + material.pov_photons_refraction = False + material.pov_photons_reflection = True + elif material.pov_refraction_type=="1": + material.pov_fake_caustics = True + material.pov_photons_refraction = False + elif material.pov_refraction_type=="2": + material.pov_fake_caustics = False + material.pov_photons_refraction = True #If only Raytrace transparency is set, its IOR will be used for refraction, but user can set up "un-physical" fresnel reflections in raytrace mirror parameters. #Last, if none of the above is specified, user can set up "un-physical" fresnel reflections in raytrace mirror parameters. And pov IOR defaults to 1. @@ -201,6 +197,7 @@ def write_pov(filename, scene=None, info_callback=None): file.write('\tdispersion %.3g\n' % material.pov_photons_dispersion) #Default of 1 means no dispersion #TODO # Other interior args + # if material.use_transparency and material.transparency_method == 'RAYTRACE': # fade_distance 2 # fade_power [Value] # fade_color @@ -270,7 +267,7 @@ def write_pov(filename, scene=None, info_callback=None): roughness += (1 / 511.0) #####################################Diffuse Shader###################################### - # Not used for Full spec level(3) of the shader + # Not used for Full spec (Level=3) of the shader if material.diffuse_shader == 'OREN_NAYAR' and Level != 3: file.write('\tbrilliance %.3g\n' % (0.9+material.roughness))#blender roughness is what is generally called oren nayar Sigma, and brilliance in povray @@ -722,8 +719,8 @@ def write_pov(filename, scene=None, info_callback=None): material = me_materials[col[3]] material_finish = materialNames[material.name] - if material.use_transparency and material.transparency_method == 'RAYTRACE': - trans = 1.0 - material.raytrace_transparency.filter + if material.use_transparency: + trans = 1.0 - material.alpha else: trans = 0.0 diff --git a/render_povray/ui.py b/render_povray/ui.py index a81e40ab0..dbd57bc9c 100644 --- a/render_povray/ui.py +++ b/render_povray/ui.py @@ -209,17 +209,17 @@ class MATERIAL_PT_povray_caustics(MaterialButtonsPanel, bpy.types.Panel): col = split.column() col.prop(mat, "pov_refraction_type") - if mat.pov_refraction_type=="0": - mat.pov_fake_caustics = False - mat.pov_photons_refraction = False - mat.pov_photons_reflection = True - elif mat.pov_refraction_type=="1": - mat.pov_fake_caustics = True - mat.pov_photons_refraction = False +## if mat.pov_refraction_type=="0": +## mat.pov_fake_caustics = False +## mat.pov_photons_refraction = False +## mat.pov_photons_reflection = True + if mat.pov_refraction_type=="1": +## mat.pov_fake_caustics = True +## mat.pov_photons_refraction = False col.prop(mat, "pov_fake_caustics_power", slider=True) elif mat.pov_refraction_type=="2": - mat.pov_fake_caustics = False - mat.pov_photons_refraction = True +## mat.pov_fake_caustics = False +## mat.pov_photons_refraction = True col.prop(mat, "pov_photons_dispersion", slider=True) col.prop(mat, "pov_photons_reflection") -- GitLab