diff --git a/render_povray/__init__.py b/render_povray/__init__.py index 4c3f278f9bd990fdf25f28d88c62d6e094ca806b..234761b61b5700938de136daeda994f86431ef3a 100644 --- a/render_povray/__init__.py +++ b/render_povray/__init__.py @@ -21,7 +21,7 @@ bl_info = { "name": "POV-Ray 3.7", "author": "Campbell Barton, Silvio Falcinelli, Maurice Raybaud, Constantin Rahn", - "version": (0, 0, 6), + "version": (0, 0, 7), "blender": (2, 5, 6), "api": 34318, "location": "Info Header (engine dropdown)", @@ -33,7 +33,6 @@ bl_info = { "func=detail&aid=23145", "category": "Render"} - if "bpy" in locals(): import imp imp.reload(ui) @@ -49,6 +48,29 @@ else: def register(): Scene = bpy.types.Scene + # File Options + Scene.pov_tempfiles_enable = BoolProperty( + name="Enable Tempfiles", + description="Enable the OS-Tempfiles. Otherwise set the path where to save the files.", + default=True) + Scene.pov_deletefiles_enable = BoolProperty( + name="Delete files", + description="Delete files after rendering. Doesn't work with the image.", + default=True) + Scene.pov_scene_name = StringProperty( + name="Scene Name", + description="Name of POV-Ray scene to create. Empty name will use the name of the blend file.", + default="", maxlen=1024) + Scene.pov_scene_path = StringProperty( + name="Export scene path", + # description="Path to directory where the exported scene (POV and INI) is created", # Bug in POV-Ray RC3 + description="Path to directory where the files are created", + default="", maxlen=1024, subtype="DIR_PATH") + Scene.pov_renderimage_path = StringProperty( + name="Rendered image path", + description="Full path to directory where the rendered image is saved.", + default="", maxlen=1024, subtype="DIR_PATH") + # Not a real pov option, just to know if we should write Scene.pov_radio_enable = BoolProperty( name="Enable Radiosity", @@ -78,11 +100,11 @@ def register(): items=(("0", "None", "No indentation"), ("1", "Tabs", "Indentation with tabs"), ("2", "Spaces", "Indentation with spaces")), - default="1") + default="2") Scene.pov_indentation_spaces = IntProperty( name="Quantity of spaces", description="The number of spaces for indentation", - min=1, max=10, default=3) + min=1, max=10, default=4) Scene.pov_comments_enable = BoolProperty( name="Enable Comments", @@ -291,6 +313,11 @@ def unregister(): Mat = bpy.types.Material # MR Tex = bpy.types.Texture # MR Obj = bpy.types.Object # MR + del Scene.pov_tempfiles_enable # CR + del Scene.pov_scene_name # CR + del Scene.pov_deletefiles_enable # CR + del Scene.pov_scene_path # CR + del Scene.pov_renderimage_path # CR del Scene.pov_radio_enable del Scene.pov_radio_display_advanced del Scene.pov_radio_adc_bailout diff --git a/render_povray/render.py b/render_povray/render.py index 8785dd231e3ea589d1697ae718ea76518b9fdcce..4c4b201f6e533cfd08ca1e178e313749b08880a9 100644 --- a/render_povray/render.py +++ b/render_povray/render.py @@ -35,6 +35,8 @@ else: ##############################SF########################### ##############find image texture + + def splitExt(path): dotidx = path.rfind(".") if dotidx == -1: @@ -42,7 +44,7 @@ def splitExt(path): else: return path[dotidx:].upper().replace(".", "") - + def imageFormat(imgF): ext = "" ext_orig = splitExt(imgF) @@ -69,7 +71,7 @@ def imageFormat(imgF): print(imgF) if not ext: - print(" WARNING: texture image format not supported ") # % (imgF , "")) #(ext_orig))) + print(" WARNING: texture image format not supported ") # % (imgF , "")) #(ext_orig))) return ext @@ -199,7 +201,7 @@ TabLevel = 0 def write_pov(filename, scene=None, info_callback=None): import mathutils #file = filename - file = open(filename.name, "w") + file = open(filename, "w") # Only for testing if not scene: @@ -326,6 +328,7 @@ def write_pov(filename, scene=None, info_callback=None): # Level=1 Means No specular nor Mirror reflection # Level=2 Means translation of spec and mir levels for when no map influences them # Level=3 Means Maximum Spec and Mirror + def povHasnoSpecularMaps(Level): if Level == 1: tabWrite("#declare %s = finish {" % safety(name, Level=1)) @@ -359,7 +362,7 @@ def write_pov(filename, scene=None, info_callback=None): elif frontDiffuse == backDiffuse: frontDiffuse = backDiffuse = 0.5 # Try to respect the user's 'intention' by comparing the two values but bringing the total back to one elif frontDiffuse > backDiffuse: # Let the highest value stay the highest value - backDiffuse = min(backDiffuse, (1.0 - frontDiffuse)) # clamps the sum below 1 + backDiffuse = min(backDiffuse, (1.0 - frontDiffuse)) # clamps the sum below 1 else: frontDiffuse = min(frontDiffuse, (1.0 - backDiffuse)) @@ -1455,10 +1458,10 @@ def write_pov_ini(filename_ini, filename_pov, filename_image): x = int(render.resolution_x * render.resolution_percentage * 0.01) y = int(render.resolution_y * render.resolution_percentage * 0.01) - file = open(filename_ini.name, "w") + file = open(filename_ini, "w") file.write("Version=3.7\n") - file.write("Input_File_Name='%s'\n" % filename_pov.name) - file.write("Output_File_Name='%s'\n" % filename_image.name) + file.write("Input_File_Name='%s'\n" % filename_pov) + file.write("Output_File_Name='%s'\n" % filename_image) file.write("Width=%d\n" % x) file.write("Height=%d\n" % y) @@ -1505,20 +1508,26 @@ class PovrayRender(bpy.types.RenderEngine): bl_label = "POV-Ray 3.7" DELAY = 0.5 - def _export(self, scene): + def _export(self, scene, povPath, renderImagePath): import tempfile + import os - # mktemp is Deprecated since version 2.3, replaced with NamedTemporaryFile() #CR - self._temp_file_in = tempfile.NamedTemporaryFile(suffix=".pov", delete=False) - self._temp_file_out = tempfile.NamedTemporaryFile(suffix=".png", delete=False) # PNG with POV 3.7, can show the background color with alpha. In the long run using the POV-Ray interactive preview like bishop 3D could solve the preview for all formats. - #self._temp_file_out = tempfile.NamedTemporaryFile(suffix=".tga", delete=False) - self._temp_file_ini = tempfile.NamedTemporaryFile(suffix=".ini", delete=False) - ''' - self._temp_file_in = "/test.pov" - self._temp_file_out = "/test.png" # PNG with POV-Ray 3.7, can show the background color with alpha. In the long run using the POV-Ray interactive preview like bishop 3D could solve the preview for all formats. - #self._temp_file_out = "/test.tga" - self._temp_file_ini = "/test.ini" - ''' + if scene.pov_tempfiles_enable: + self._temp_file_in = tempfile.NamedTemporaryFile(suffix=".pov", delete=False).name + self._temp_file_out = tempfile.NamedTemporaryFile(suffix=".png", delete=False).name # PNG with POV 3.7, can show the background color with alpha. In the long run using the POV-Ray interactive preview like bishop 3D could solve the preview for all formats. + #self._temp_file_out = tempfile.NamedTemporaryFile(suffix=".tga", delete=False).name + self._temp_file_ini = tempfile.NamedTemporaryFile(suffix=".ini", delete=False).name + else: + self._temp_file_in = povPath + ".pov" + self._temp_file_out = renderImagePath + ".png" # PNG with POV-Ray 3.7, can show the background color with alpha. In the long run using the POV-Ray interactive preview like bishop 3D could solve the preview for all formats. + #self._temp_file_out = renderImagePath + ".tga" + self._temp_file_ini = povPath + ".ini" + ''' + self._temp_file_in = "/test.pov" + self._temp_file_out = "/test.png" # PNG with POV-Ray 3.7, can show the background color with alpha. In the long run using the POV-Ray interactive preview like bishop 3D could solve the preview for all formats. + #self._temp_file_out = "/test.tga" + self._temp_file_ini = "/test.ini" + ''' def info_callback(txt): self.update_stats("", "POV-Ray 3.7: " + txt) @@ -1528,7 +1537,7 @@ class PovrayRender(bpy.types.RenderEngine): def _render(self, scene): try: - os.remove(self._temp_file_out.name) # so as not to load the old file + os.remove(self._temp_file_out) # so as not to load the old file except OSError: pass @@ -1587,7 +1596,7 @@ class PovrayRender(bpy.types.RenderEngine): 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.name] + extra_args) # stdout=subprocess.PIPE, stderr=subprocess.PIPE + 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) @@ -1598,37 +1607,27 @@ class PovrayRender(bpy.types.RenderEngine): else: # This works too but means we have to wait until its done - os.system("%s %s" % (pov_binary, self._temp_file_ini.name)) + 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): - #print("Name: %s" % f.name) - #print("File closed %s" % f.closed) - f.close() # Why do I have to close them again? Without closeing the pov and ini files are not deletable. PNG is not closable! try: - os.unlink(f.name) - #os.remove(f.name) + os.unlink(f) except OSError: # was that the proper error type? - #print("Couldn\'t remove/unlink TEMP file %s" % f.name) + #print("POV-Ray 3.7: could not remove/unlink TEMP file %s" % f.name) pass #print("") self.update_stats("", "") def render(self, scene): + import tempfile - self.update_stats("", "POV-Ray 3.7: Exporting data from Blender") - self._export(scene) - self.update_stats("", "POV-Ray 3.7: Parsing File") - - if not self._render(scene): - self.update_stats("", "POV-Ray 3.7: Not found") - return + print("***INITIALIZING***") - r = scene.render ##WIP output format ## if r.file_format == 'OPENEXR': ## fformat = 'EXR' @@ -1638,12 +1637,99 @@ class PovrayRender(bpy.types.RenderEngine): ## r.file_format = 'TARGA' ## r.color_mode = 'RGBA' + blendSceneName = bpy.data.filepath.split(os.path.sep)[-1].split(".")[0] + povSceneName = "" + povPath = "" + renderImagePath = "" + + if not scene.pov_tempfiles_enable: + + # check paths + povPath = bpy.path.abspath(scene.pov_scene_path).replace('\\', '/') + if povPath == "": + if bpy.path.abspath("//") != "": + povPath = bpy.path.abspath("//") + else: + povPath = tempfile.gettempdir() + elif povPath.endswith("/"): + if povPath == "/": + povPath = bpy.path.abspath("//") + else: + povPath = bpy.path.abspath(scene.pov_scene_path) + if not os.path.exists(povPath): + print("POV-Ray 3.7: Cannot find scenes directory") + self.update_stats("", "POV-Ray 3.7: Cannot find scenes directory") + print("Path: " + povPath) + time.sleep(2.0) + return + + ''' + # Bug in POV-Ray RC3 + renderImagePath = bpy.path.abspath(scene.pov_renderimage_path).replace('\\','/') + if renderImagePath == "": + if bpy.path.abspath("//") != "": + renderImagePath = bpy.path.abspath("//") + else: + renderImagePath = tempfile.gettempdir() + #print("Path: " + renderImagePath) + elif path.endswith("/"): + if renderImagePath == "/": + renderImagePath = bpy.path.abspath("//") + else: + renderImagePath = bpy.path.abspath(scene.pov_renderimage_path) + if not os.path.exists(path): + print("POV-Ray 3.7: Cannot find render image directory") + self.update_stats("", "POV-Ray 3.7: Cannot find render image directory") + time.sleep(2.0) + return + ''' + + # check name + if scene.pov_scene_name == "": + if blendSceneName != "": + povSceneName = blendSceneName + else: + povSceneName = "untitled" + else: + povSceneName = scene.pov_scene_name + if os.path.isfile(povSceneName): + povSceneName = os.path.basename(povSceneName) + povSceneName = povSceneName.split('/')[-1].split('\\')[-1] + if not povSceneName: + print("POV-Ray 3.7: Invalid scene name") + self.update_stats("", "POV-Ray 3.7: Invalid scene name") + time.sleep(2.0) + return + povSceneName = os.path.splitext(povSceneName)[0] + + print("Scene name: " + povSceneName) + print("Export path: " + povPath) + povPath = povPath + "\\" + povSceneName + povPath = os.path.realpath(povPath) + + # renderImagePath = renderImagePath + "\\" + povSceneName # for now this has to be the same like the pov output. Bug in POV-Ray RC3. + renderImagePath = povPath # Bugfix for POV-Ray RC3 bug + renderImagePath = os.path.realpath(renderImagePath) + + #print("Export path: %s" % povPath) + #print("Render Image path: %s" % renderImagePath) + + # start export + self.update_stats("", "POV-Ray 3.7: Exporting data from Blender") + self._export(scene, povPath, renderImagePath) + self.update_stats("", "POV-Ray 3.7: Parsing File") + + if not self._render(scene): + self.update_stats("", "POV-Ray 3.7: Not found") + return + + r = scene.render # compute resolution x = int(r.resolution_x * r.resolution_percentage * 0.01) y = int(r.resolution_y * r.resolution_percentage * 0.01) # Wait for the file to be created - while not os.path.exists(self._temp_file_out.name): + while not os.path.exists(self._temp_file_out): # print("***POV WAITING FOR FILE***") if self.test_break(): try: @@ -1661,7 +1747,7 @@ class PovrayRender(bpy.types.RenderEngine): time.sleep(self.DELAY) - if os.path.exists(self._temp_file_out.name): + if os.path.exists(self._temp_file_out): # print("***POV FILE OK***") self.update_stats("", "POV-Ray 3.7: Rendering") @@ -1673,7 +1759,7 @@ class PovrayRender(bpy.types.RenderEngine): lay = result.layers[0] # possible the image wont load early on. try: - lay.load_from_file(self._temp_file_out.name) + lay.load_from_file(self._temp_file_out) except SystemError: pass self.end_result(result) @@ -1702,7 +1788,7 @@ class PovrayRender(bpy.types.RenderEngine): # stdout_value, stderr_value = self._process.communicate() # locks # check if the file updated - new_size = os.path.getsize(self._temp_file_out.name) + new_size = os.path.getsize(self._temp_file_out) if new_size != prev_size: update_image() @@ -1714,4 +1800,5 @@ class PovrayRender(bpy.types.RenderEngine): print("***POV FINISHED***") #time.sleep(self.DELAY) - self._cleanup() + if scene.pov_deletefiles_enable: + self._cleanup() diff --git a/render_povray/ui.py b/render_povray/ui.py index 93a21e0c161dd1ec339fdf4a0395609ce09caa9e..678314f1917c24109db8a125643cc158790ac363 100644 --- a/render_povray/ui.py +++ b/render_povray/ui.py @@ -25,7 +25,7 @@ import properties_render properties_render.RENDER_PT_render.COMPAT_ENGINES.add('POVRAY_RENDER') properties_render.RENDER_PT_dimensions.COMPAT_ENGINES.add('POVRAY_RENDER') # properties_render.RENDER_PT_antialiasing.COMPAT_ENGINES.add('POVRAY_RENDER') -properties_render.RENDER_PT_shading.COMPAT_ENGINES.add('POVRAY_RENDER') +properties_render.RENDER_PT_shading.COMPAT_ENGINES.add('POVRAY_RENDER') # We don't use it right now. Should be implemented later. properties_render.RENDER_PT_output.COMPAT_ENGINES.add('POVRAY_RENDER') del properties_render @@ -134,143 +134,57 @@ class ObjectButtonsPanel(): rd = context.scene.render return obj and (rd.use_game_engine == False) and (rd.engine in cls.COMPAT_ENGINES) -########################################MR###################################### - -class MATERIAL_PT_povray_mirrorIOR(MaterialButtonsPanel, bpy.types.Panel): - bl_label = "IOR Mirror" - 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: - split = layout.split() - col = split.column() - row = col.row() - row.alignment = 'CENTER' - row.label(text="The current Raytrace ") - row = col.row() - row.alignment = 'CENTER' - row.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 - - -class MATERIAL_PT_povray_conserve_energy(MaterialButtonsPanel, bpy.types.Panel): - bl_label = "conserve energy" +class RENDER_PT_povray_export_settings(RenderButtonsPanel, bpy.types.Panel): + bl_label = "Export Settings" 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="") + scene = context.scene + rd = scene.render - def draw(self, context): - layout = self.layout + layout.active = scene.pov_max_trace_level + split = layout.split() - mat = context.material - layout.active = mat.pov_irid_enable + col = split.column() + col.label(text="Command line switches:") + col.prop(scene, "pov_command_line_switches", text="") + split = layout.split() + col = split.column() + col.prop(scene, "pov_tempfiles_enable", text="OS Tempfiles") + if not scene.pov_tempfiles_enable: + col = split.column() + col.prop(scene, "pov_deletefiles_enable", text="Delete files") + else: + col = split.column() - if mat.pov_irid_enable: + split = layout.split() + if not scene.pov_tempfiles_enable: + col = split.column() + col.prop(scene, "pov_scene_name", text="Name") split = layout.split() - col = split.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) - - -class MATERIAL_PT_povray_caustics(MaterialButtonsPanel, bpy.types.Panel): - bl_label = "Caustics" - COMPAT_ENGINES = {'POVRAY_RENDER'} - - def draw_header(self, context): - mat = context.material - - self.layout.prop(mat, "pov_caustics_enable", text="") - - def draw(self, context): - - layout = self.layout - - mat = context.material - layout.active = mat.pov_caustics_enable - Radio = 1 - if mat.pov_caustics_enable: + col.prop(scene, "pov_scene_path", text="Path to files") + #col.prop(scene, "pov_scene_path", text="Path to POV-file") split = layout.split() + #col = split.column() # Bug in POV-Ray RC3 + #col.prop(scene, "pov_renderimage_path", text="Path to image") + #split = layout.split() 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 - 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 - col.prop(mat, "pov_photons_dispersion", slider=True) - col.prop(mat, "pov_photons_reflection") - -## col.prop(mat, "pov_fake_caustics") -## if mat.pov_fake_caustics: -## col.prop(mat, "pov_fake_caustics_power", slider=True) -## mat.pov_photons_refraction=0 -## else: -## col.prop(mat, "pov_photons_refraction") -## if mat.pov_photons_refraction: -## col.prop(mat, "pov_photons_dispersion", slider=True) -## Radio = 0 -## mat.pov_fake_caustics=Radio -## col.prop(mat, "pov_photons_reflection") -####TODO : MAKE THIS A real RADIO BUTTON (using EnumProperty?) -######################################EndMR##################################### + col.prop(scene, "pov_indentation_character", text="Indent") + col = split.column() + if scene.pov_indentation_character == "2": + col.prop(scene, "pov_indentation_spaces", text="Spaces") + split = layout.split() + col = split.column() + col.prop(scene, "pov_comments_enable", text="Comments") -class RENDER_PT_povray_global_settings(RenderButtonsPanel, bpy.types.Panel): - bl_label = "Global Settings" +class RENDER_PT_povray_render_settings(RenderButtonsPanel, bpy.types.Panel): + bl_label = "Render Settings" COMPAT_ENGINES = {'POVRAY_RENDER'} def draw(self, context): @@ -281,11 +195,6 @@ class RENDER_PT_povray_global_settings(RenderButtonsPanel, bpy.types.Panel): layout.active = scene.pov_max_trace_level split = layout.split() - - col = split.column() - col.label(text="Command line switches:") - col.prop(scene, "pov_command_line_switches", text="") - split = layout.split() col = split.column() col.prop(scene, "pov_max_trace_level", text="Ray Depth") col = split.column() @@ -407,7 +316,6 @@ class RENDER_PT_povray_media(RenderButtonsPanel, bpy.types.Panel): col = split.column() col.prop(scene, "pov_media_color", text="Color") - ##class RENDER_PT_povray_baking(RenderButtonsPanel, bpy.types.Panel): ## bl_label = "Baking" ## COMPAT_ENGINES = {'POVRAY_RENDER'} @@ -426,26 +334,135 @@ class RENDER_PT_povray_media(RenderButtonsPanel, bpy.types.Panel): ## layout.active = scene.pov_baking_enable -class RENDER_PT_povray_formatting(RenderButtonsPanel, bpy.types.Panel): - bl_label = "Formatting POV-Ray file" +class MATERIAL_PT_povray_mirrorIOR(MaterialButtonsPanel, bpy.types.Panel): + bl_label = "IOR Mirror" 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 - scene = context.scene - rd = scene.render + mat = context.material + layout.active = mat.pov_mirror_use_IOR - split = layout.split() + if mat.pov_mirror_use_IOR: + split = layout.split() + col = split.column() + row = col.row() + row.alignment = 'CENTER' + row.label(text="The current Raytrace ") + row = col.row() + row.alignment = 'CENTER' + row.label(text="Transparency IOR is: " + str(mat.raytrace_transparency.ior)) - col = split.column() - col.prop(scene, "pov_indentation_character", text="Indent") - col = split.column() - if scene.pov_indentation_character == "2": - col.prop(scene, "pov_indentation_spaces", text="Spaces") - split = layout.split() - col = split.column() - col.prop(scene, "pov_comments_enable", text="Comments") + +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 + + +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: + split = layout.split() + + col = split.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) + + +class MATERIAL_PT_povray_caustics(MaterialButtonsPanel, bpy.types.Panel): + bl_label = "Caustics" + COMPAT_ENGINES = {'POVRAY_RENDER'} + + def draw_header(self, context): + mat = context.material + + self.layout.prop(mat, "pov_caustics_enable", text="") + + def draw(self, context): + + layout = self.layout + + mat = context.material + layout.active = mat.pov_caustics_enable + Radio = 1 + if mat.pov_caustics_enable: + split = layout.split() + + 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 + 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 + col.prop(mat, "pov_photons_dispersion", slider=True) + col.prop(mat, "pov_photons_reflection") + +## col.prop(mat, "pov_fake_caustics") +## if mat.pov_fake_caustics: +## col.prop(mat, "pov_fake_caustics_power", slider=True) +## mat.pov_photons_refraction=0 +## else: +## col.prop(mat, "pov_photons_refraction") +## if mat.pov_photons_refraction: +## col.prop(mat, "pov_photons_dispersion", slider=True) +## Radio = 0 +## mat.pov_fake_caustics=Radio +## col.prop(mat, "pov_photons_reflection") +####TODO : MAKE THIS A real RADIO BUTTON (using EnumProperty?) class TEXTURE_PT_povray_tex_gamma(TextureButtonsPanel, bpy.types.Panel):