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>2018-01-28 15:47:02 +0300
committerMaurice Raybaud <mauriceraybaud@hotmail.fr>2018-01-28 15:47:02 +0300
commit1df44726b049543330d033fd7685771007eae06d (patch)
tree72b2893b646722e5fa732a297d3984531ebb0089 /render_povray
parent87579bd164c60ac7e6861be49bc7bcd4b84641ce (diff)
Added Lamp , Radiosity, and World presets
Diffstat (limited to 'render_povray')
-rw-r--r--render_povray/__init__.py110
-rw-r--r--render_povray/render.py163
-rw-r--r--render_povray/shading.py13
-rw-r--r--render_povray/ui.py197
4 files changed, 401 insertions, 82 deletions
diff --git a/render_povray/__init__.py b/render_povray/__init__.py
index cfb45f5a..90d80f13 100644
--- a/render_povray/__init__.py
+++ b/render_povray/__init__.py
@@ -19,14 +19,13 @@
# <pep8 compliant>
bl_info = {
- "name": "POVRAY-3.7",
+ "name": "POV-3.7",
"author": "Campbell Barton, Silvio Falcinelli, Maurice Raybaud, "
"Constantin Rahn, Bastien Montagne, Leonid Desyatkov",
- "version": (0, 0, 9),
- "blender": (2, 75, 0),
+ "version": (0, 1, 0),
+ "blender": (2, 79, 0),
"location": "Render > Engine > POV-Ray 3.7",
"description": "Basic POV-Ray 3.7 integration for blender",
- "warning": "this script is RC",
"wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
"Scripts/Render/POV-Ray",
"category": "Render",
@@ -44,6 +43,7 @@ else:
#import addon_utils # To use some other addons
import nodeitems_utils #for Nodes
from nodeitems_utils import NodeCategory, NodeItem #for Nodes
+ from bl_operators.presets import AddPresetBase
from bpy.types import (
AddonPreferences,
PropertyGroup,
@@ -73,6 +73,11 @@ def string_strip_hyphen(name):
# Scene POV properties.
###############################################################################
class RenderPovSettingsScene(PropertyGroup):
+ #Linux SDL-window enable
+ sdl_window_enable = BoolProperty(
+ name="Enable SDL window",
+ description="Enable the SDL window in Linux OS",
+ default=True)
# File Options
text_block = StringProperty(
name="Text Scene Name",
@@ -121,7 +126,7 @@ class RenderPovSettingsScene(PropertyGroup):
radio_enable = BoolProperty(
name="Enable Radiosity",
description="Enable POV-Rays radiosity calculation",
- default=False)
+ default=True)
radio_display_advanced = BoolProperty(
name="Advanced Options",
@@ -132,19 +137,88 @@ class RenderPovSettingsScene(PropertyGroup):
name="Enable Media",
description="Enable POV-Rays atmospheric media",
default=False)
+
media_samples = IntProperty(
name="Samples",
description="Number of samples taken from camera to first object "
"encountered along ray path for media calculation",
min=1, max=100, default=35)
-
- media_color = FloatVectorProperty(
- name="Media Color", description="The atmospheric media color",
+
+ media_scattering_type = EnumProperty(
+ name="Scattering Type",
+ description="Scattering model",
+ items=(('1', "1 Isotropic", "The simplest form of scattering because"
+ " it is independent of direction."),
+ ('2', "2 Mie haze ", "For relatively small particles such as "
+ "minuscule water droplets of fog, cloud "
+ "particles, and particles responsible "
+ "for the polluted sky. In this model the"
+ " scattering is extremely directional in"
+ " the forward direction i.e. the amount "
+ "of scattered light is largest when the "
+ "incident light is anti-parallel to the "
+ "viewing direction (the light goes "
+ "directly to the viewer). It is smallest"
+ " when the incident light is parallel to"
+ " the viewing direction. "),
+ ('3', "3 Mie murky", "Like haze but much more directional"),
+ ('4', "4 Rayleigh", "For extremely small particles such as "
+ "molecules of the air. The amount of "
+ "scattered light depends on the incident"
+ " light angle. It is largest when the "
+ "incident light is parallel or "
+ "anti-parallel to the viewing direction "
+ "and smallest when the incident light is "
+ "perpendicular to viewing direction."),
+ ('5', "5 Henyey-Greenstein", "The default eccentricity value "
+ "of zero defines isotropic "
+ "scattering while positive "
+ "values lead to scattering in "
+ "the direction of the light and "
+ "negative values lead to "
+ "scattering in the opposite "
+ "direction of the light. Larger "
+ "values of e (or smaller values "
+ "in the negative case) increase "
+ "the directional property of the"
+ " scattering.")),
+ default='1')
+
+ media_diffusion_scale = FloatProperty(
+ name="Scale", description="Scale factor of Media Diffusion Color",
+ precision=12, step=0.00000001, min=0.000000001, max=1.0,
+ default=(1.0))
+
+ media_diffusion_color = FloatVectorProperty(
+ name="Media Diffusion Color", description="The atmospheric media color",
precision=4, step=0.01, min=0, soft_max=1,
default=(0.001, 0.001, 0.001),
options={'ANIMATABLE'},
subtype='COLOR')
+ media_absorption_scale = FloatProperty(
+ name="Scale", description="Scale factor of Media Absorption Color. "
+ "use 1/depth of media volume in meters",
+ precision=12, step=0.000001, min=0.000000001, max=1.0,
+ default=(0.00002))
+
+ media_absorption_color = FloatVectorProperty(
+ name="Media Absorption Color", description="The atmospheric media absorption color",
+ precision=4, step=0.01, min=0, soft_max=1,
+ default=(0.0, 0.0, 0.0),
+ options={'ANIMATABLE'},
+ subtype='COLOR')
+
+ media_eccentricity = FloatProperty(
+ name="Media Eccenticity Factor", description="Positive values lead"
+ " to scattering in the direction of the light and negative "
+ "values lead to scattering in the opposite direction of the "
+ "light. Larger values of e (or smaller values in the negative"
+ " case) increase the directional property of the scattering.",
+ precision=2, step=0.01, min=-1.0, max=1.0,
+ default=(0.0),
+ options={'ANIMATABLE'})
+
baking_enable = BoolProperty(
name="Enable Baking",
description="Enable POV-Rays texture baking",
@@ -377,7 +451,7 @@ class RenderPovSettingsScene(PropertyGroup):
description="",
maxlen=1024, subtype="FILE_PATH")
-
+ #########RADIOSITY########
radio_adc_bailout = FloatProperty(
name="ADC Bailout",
description="The adc_bailout for radiosity rays. Use "
@@ -422,7 +496,7 @@ class RenderPovSettingsScene(PropertyGroup):
radio_media = BoolProperty(
name="Media", description="Radiosity estimation can be affected by media",
- default=False)
+ default=True)
radio_subsurface = BoolProperty(
name="Subsurface", description="Radiosity estimation can be affected by Subsurface Light Transport",
@@ -468,7 +542,6 @@ class RenderPovSettingsScene(PropertyGroup):
"in the mosaic preview last pass",
min=0.000925, max=1.00, soft_min=0.01, soft_max=1.00, default=0.04, precision=3)
-
###############################################################################
# Material POV properties.
###############################################################################
@@ -2199,20 +2272,14 @@ class PovrayPreferences(AddonPreferences):
-
-
-
-
-
-
-
-
-
def register():
bpy.utils.register_module(__name__)
bpy.types.INFO_MT_add.prepend(ui.menu_func_add)
bpy.types.INFO_MT_file_import.append(ui.menu_func_import)
bpy.types.TEXT_MT_templates.append(ui.menu_func_templates)
+ bpy.types.RENDER_PT_povray_radiosity.prepend(ui.rad_panel_func)
+ bpy.types.LAMP_PT_POV_lamp.prepend(ui.lamp_panel_func)
+ bpy.types.WORLD_PT_world.prepend(ui.world_panel_func)
# was used for parametric objects but made the other addon unreachable on
# unregister for other tools to use created a user action call instead
#addon_utils.enable("add_mesh_extra_objects", default_set=False, persistent=True)
@@ -2244,6 +2311,9 @@ def unregister():
#bpy.types.TEXTURE_PT_context_texture.remove(TEXTURE_PT_povray_type)
#addon_utils.disable("add_mesh_extra_objects", default_set=False)
+ bpy.types.WORLD_PT_world.remove(ui.world_panel_func)
+ bpy.types.LAMP_PT_POV_lamp.remove(ui.lamp_panel_func)
+ bpy.types.RENDER_PT_povray_radiosity.remove(ui.rad_panel_func)
bpy.types.TEXT_MT_templates.remove(ui.menu_func_templates)
bpy.types.INFO_MT_file_import.remove(ui.menu_func_import)
bpy.types.INFO_MT_add.remove(ui.menu_func_add)
diff --git a/render_povray/render.py b/render_povray/render.py
index d3695780..7e1f0499 100644
--- a/render_povray/render.py
+++ b/render_povray/render.py
@@ -186,13 +186,17 @@ def safety(name, Level):
##############end safety string name material
##############################EndSF###########################
+csg_list = []
+
def is_renderable(scene, ob):
- return (ob.is_visible(scene) and not ob.hide_render)
+ return (ob.is_visible(scene) and not ob.hide_render and ob not in csg_list)
def renderable_objects(scene):
return [ob for ob in bpy.data.objects if is_renderable(scene, ob)]
+def no_renderable_objects(scene):
+ return [ob for ob in csg_list]
tabLevel = 0
unpacked_images=[]
@@ -628,7 +632,7 @@ def write_pov(filename, scene=None, info_callback=None):
tabWrite("fade_distance %.6f\n" % (lamp.distance / 2.0))
# Area lights have no falloff type, so always use blenders lamp quad equivalent
# for those?
- tabWrite("fade_power %d\n" % 0)
+ tabWrite("fade_power %d\n" % 2)
size_x = lamp.size
samples_x = lamp.shadow_ray_samples_x
if lamp.shape == 'SQUARE':
@@ -1793,7 +1797,7 @@ def write_pov(filename, scene=None, info_callback=None):
# objectNames = {}
DEF_OBJ_NAME = "Default"
- def exportMeshes(scene, sel):
+ def exportMeshes(scene, sel, csg):
# obmatslist = []
# def hasUniqueMaterial():
# # Grab materials attached to object instances ...
@@ -2416,7 +2420,7 @@ def write_pov(filename, scene=None, info_callback=None):
tabWrite("#declare %s = plane{ <0,0,1>,1\n"%povdataname)
povMatName = "Default_texture"
if ob.active_material:
- #povMatName = string_strip_hyphen(bpy.path.clean_name(ob.active_material.name))
+ #povMatName = string_strip_hyphen(bpy.path.clean_name(ob.active_material.name))
try:
material = ob.active_material
writeObjectMaterial(material, ob)
@@ -3277,39 +3281,70 @@ def write_pov(filename, scene=None, info_callback=None):
bpy.data.meshes.remove(me)
- duplidata_ref = []
- for ob in sel:
- #matrix = global_matrix * ob.matrix_world
- if ob.is_duplicator:
- tabWrite("\n//--DupliObjects in %s--\n\n"% ob.name)
- ob.dupli_list_create(scene)
- dup = ""
- if ob.is_modified(scene, 'RENDER'):
- #modified object always unique so using object name rather than data name
- dup = "#declare OB%s = union{\n" %(string_strip_hyphen(bpy.path.clean_name(ob.name)))
+ if csg:
+ duplidata_ref = []
+ for ob in sel:
+ #matrix = global_matrix * ob.matrix_world
+ if ob.is_duplicator:
+ tabWrite("\n//--DupliObjects in %s--\n\n"% ob.name)
+ ob.dupli_list_create(scene)
+ dup = ""
+ if ob.is_modified(scene, 'RENDER'):
+ #modified object always unique so using object name rather than data name
+ dup = "#declare OB%s = union{\n" %(string_strip_hyphen(bpy.path.clean_name(ob.name)))
+ else:
+ dup = "#declare DATA%s = union{\n" %(string_strip_hyphen(bpy.path.clean_name(ob.name)))
+ for eachduplicate in ob.dupli_list:
+ duplidataname = "OB"+string_strip_hyphen(bpy.path.clean_name(bpy.data.objects[eachduplicate.object.name].data.name))
+ dup += ("\tobject {\n\t\tDATA%s\n\t\t%s\t}\n" %(string_strip_hyphen(bpy.path.clean_name(bpy.data.objects[eachduplicate.object.name].data.name)), MatrixAsPovString(ob.matrix_world.inverted() * eachduplicate.matrix)))
+ #add object to a list so that it is not rendered for some dupli_types
+ if ob.dupli_type not in {'GROUP'} and duplidataname not in duplidata_ref:
+ duplidata_ref.append(duplidataname) #older key [string_strip_hyphen(bpy.path.clean_name("OB"+ob.name))]
+ dup += "}\n"
+ ob.dupli_list_clear()
+ tabWrite(dup)
else:
- dup = "#declare DATA%s = union{\n" %(string_strip_hyphen(bpy.path.clean_name(ob.name)))
- for eachduplicate in ob.dupli_list:
- duplidataname = "OB"+string_strip_hyphen(bpy.path.clean_name(bpy.data.objects[eachduplicate.object.name].data.name))
- dup += ("\tobject {\n\t\tDATA%s\n\t\t%s\t}\n" %(string_strip_hyphen(bpy.path.clean_name(bpy.data.objects[eachduplicate.object.name].data.name)), MatrixAsPovString(ob.matrix_world.inverted() * eachduplicate.matrix)))
- #add object to a list so that it is not rendered for some dupli_types
- if ob.dupli_type not in {'GROUP'} and duplidataname not in duplidata_ref:
- duplidata_ref.append(duplidataname) #older key [string_strip_hyphen(bpy.path.clean_name("OB"+ob.name))]
- dup += "}\n"
- ob.dupli_list_clear()
- tabWrite(dup)
- else:
- continue
- print(duplidata_ref)
- for data_name, inst in data_ref.items():
- for ob_name, matrix_str in inst:
- if ob_name not in duplidata_ref: #.items() for a dictionary
- tabWrite("\n//----Blender Object Name:%s----\n" % ob_name)
- tabWrite("object { \n")
- tabWrite("%s\n" % data_name)
- tabWrite("%s\n" % matrix_str)
- tabWrite("}\n")
-
+ continue
+ print(duplidata_ref)
+ for data_name, inst in data_ref.items():
+ for ob_name, matrix_str in inst:
+ if ob_name not in duplidata_ref: #.items() for a dictionary
+ tabWrite("\n//----Blender Object Name:%s----\n" % ob_name)
+ if ob.pov.object_as == '':
+ tabWrite("object { \n")
+ tabWrite("%s\n" % data_name)
+ tabWrite("%s\n" % matrix_str)
+ tabWrite("}\n")
+ else:
+ no_boolean = True
+ for mod in ob.modifiers:
+ if mod.type == 'BOOLEAN':
+ operation = None
+ no_boolean = False
+ if mod.operation == 'INTERSECT':
+ operation = 'intersection'
+ else:
+ operation = mod.operation.lower()
+ mod_ob_name = string_strip_hyphen(bpy.path.clean_name(mod.object.name))
+ mod_matrix = global_matrix * mod.object.matrix_world
+ mod_ob_matrix = MatrixAsPovString(mod_matrix)
+ tabWrite("%s { \n"%operation)
+ tabWrite("object { \n")
+ tabWrite("%s\n" % data_name)
+ tabWrite("%s\n" % matrix_str)
+ tabWrite("}\n")
+ tabWrite("object { \n")
+ tabWrite("%s\n" % ('DATA'+ mod_ob_name))
+ tabWrite("%s\n" % mod_ob_matrix)
+ tabWrite("}\n")
+ tabWrite("}\n")
+ break
+ if no_boolean:
+ tabWrite("object { \n")
+ tabWrite("%s\n" % data_name)
+ tabWrite("%s\n" % matrix_str)
+ tabWrite("}\n")
+
def exportWorld(world):
render = scene.render
camera = scene.camera
@@ -3444,18 +3479,33 @@ def write_pov(filename, scene=None, info_callback=None):
if mist.use_mist:
tabWrite("fog {\n")
- tabWrite("distance %.6f\n" % mist.depth)
+ if mist.falloff=='LINEAR':
+ tabWrite("distance %.6f\n" % ((mist.start+mist.depth)*0.368))
+ elif mist.falloff=='QUADRATIC': # n**2 or squrt(n)?
+ tabWrite("distance %.6f\n" % ((mist.start+mist.depth)**2*0.368))
+ elif mist.falloff=='INVERSE_QUADRATIC': # n**2 or squrt(n)?
+ tabWrite("distance %.6f\n" % ((mist.start+mist.depth)**2*0.368))
tabWrite("color rgbt<%.3g, %.3g, %.3g, %.3g>\n" % \
(*world.horizon_color, 1.0 - mist.intensity))
- #tabWrite("fog_offset %.6f\n" % mist.start)
- #tabWrite("fog_alt 5\n")
+ #tabWrite("fog_offset %.6f\n" % mist.start) #create a pov property to prepend
+ #tabWrite("fog_alt %.6f\n" % mist.height) #XXX right?
#tabWrite("turbulence 0.2\n")
#tabWrite("turb_depth 0.3\n")
- tabWrite("fog_type 1\n")
+ tabWrite("fog_type 1\n") #type2 for height
tabWrite("}\n")
if scene.pov.media_enable:
tabWrite("media {\n")
- tabWrite("scattering { 1, rgb <%.4g, %.4g, %.4g>}\n" % scene.pov.media_color[:])
+ tabWrite("scattering { %d, rgb %.12f*<%.4g, %.4g, %.4g>\n" % \
+ (int(scene.pov.media_scattering_type),
+ (scene.pov.media_diffusion_scale),
+ *(scene.pov.media_diffusion_color[:])))
+ if scene.pov.media_scattering_type == '5':
+ tabWrite("eccentricity %.3g\n" % scene.pov.media_eccentricity)
+ tabWrite("}\n")
+ tabWrite("absorption %.12f*<%.4g, %.4g, %.4g>\n" % \
+ (scene.pov.media_absorption_scale,
+ *(scene.pov.media_absorption_color[:])))
+ tabWrite("\n")
tabWrite("samples %.d\n" % scene.pov.media_samples)
tabWrite("}\n")
@@ -3559,7 +3609,7 @@ def write_pov(filename, scene=None, info_callback=None):
file.write(txt.as_string())
file.write("\n")
- sel = renderable_objects(scene)
+ #sel = renderable_objects(scene) #removed for booleans
if comments:
file.write("//----------------------------------------------\n" \
"//--Exported with POV-Ray exporter for Blender--\n" \
@@ -3602,6 +3652,20 @@ def write_pov(filename, scene=None, info_callback=None):
if comments:
file.write("\n//--Lamps--\n\n")
+ for ob in bpy.data.objects:
+ if ob.type == 'MESH':
+ for mod in ob.modifiers:
+ if mod.type == 'BOOLEAN':
+ if mod.object not in csg_list:
+ csg_list.append(mod.object)
+ if csg_list != []:
+ csg = False
+ sel = no_renderable_objects(scene)
+ exportMeshes(scene, sel, csg)
+
+ csg = True
+ sel = renderable_objects(scene)
+
exportLamps([L for L in sel if (L.type == 'LAMP' and L.pov.object_as != 'RAINBOW')])
if comments:
@@ -3655,7 +3719,7 @@ def write_pov(filename, scene=None, info_callback=None):
if comments:
file.write("//--Mesh objects--\n")
- exportMeshes(scene, sel)
+ exportMeshes(scene, sel, csg)
#What follow used to happen here:
#exportCamera()
@@ -3745,7 +3809,7 @@ def write_pov_ini(scene, filename_ini, filename_log, filename_pov, filename_imag
class PovrayRender(bpy.types.RenderEngine):
bl_idname = 'POVRAY_RENDER'
- bl_label = "POV-Ray 3.7"
+ bl_label = "Persitence Of Vision"
DELAY = 0.5
@staticmethod
@@ -4000,7 +4064,14 @@ class PovrayRender(bpy.types.RenderEngine):
# Start Rendering!
try:
- _process = subprocess.Popen([pov_binary, self._temp_file_ini] + extra_args,
+ if sys.platform[:3] != "win" and scene.pov.sdl_window_enable: #segfault on linux == False !!!
+ env = {'POV_DISPLAY_SCALED': 'off'}
+ env.update(os.environ)
+ self._process = subprocess.Popen([pov_binary, self._temp_file_ini],
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+ env=env)
+ else:
+ self._process = subprocess.Popen([pov_binary, self._temp_file_ini] + extra_args,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
except OSError:
# TODO, report api
@@ -4397,4 +4468,4 @@ class RunPovTextRender(Operator):
#empty text name property engain
scene.pov.text_block = ""
- return {'FINISHED'} \ No newline at end of file
+ return {'FINISHED'} \ No newline at end of file
diff --git a/render_povray/shading.py b/render_povray/shading.py
index 5a371707..03a63a9d 100644
--- a/render_povray/shading.py
+++ b/render_povray/shading.py
@@ -245,13 +245,11 @@ def writeMaterial(using_uberpov, DEF_MAT_NAME, scene, tabWrite, safety, comments
for t in material.texture_slots:
if t and t.use and t.texture is not None:
if (t.texture.type == 'IMAGE' and t.texture.image) or t.texture.type != 'IMAGE':
- validPath=True
- else:
- validPath=False
- if(t and t.use and validPath and
- (t.use_map_specular or t.use_map_raymir or t.use_map_normal or t.use_map_alpha)):
- special_texture_found = True
- continue # Some texture found
+ #validPath
+ if(t and t.use and
+ (t.use_map_specular or t.use_map_raymir or t.use_map_normal or t.use_map_alpha)):
+ special_texture_found = True
+ continue # Some texture found
if special_texture_found or colored_specular_found:
# Level=1 Means No specular nor Mirror reflection
@@ -1087,7 +1085,6 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
else:
if texturesDif and texturesDif.startswith("PAT_"):
tabWrite("pigment{%s %s}\n" %(texturesDif, mappingDif))
- print('XXXMEEEERDE!')
else:
tabWrite("pigment {\n")
tabWrite("uv_mapping image_map {\n")
diff --git a/render_povray/ui.py b/render_povray/ui.py
index 3d8a8870..58c69398 100644
--- a/render_povray/ui.py
+++ b/render_povray/ui.py
@@ -22,6 +22,7 @@ import bpy
import sys #really import here and in render.py?
import os #really import here and in render.py?
from os.path import isfile
+from bl_operators.presets import AddPresetBase
# Use some of the existing buttons.
from bl_ui import properties_render
@@ -41,6 +42,61 @@ properties_world.WORLD_PT_world.COMPAT_ENGINES.add('POVRAY_RENDER')
properties_world.WORLD_PT_mist.COMPAT_ENGINES.add('POVRAY_RENDER')
del properties_world
+class POV_WORLD_MT_presets(bpy.types.Menu):
+ bl_label = "World Presets"
+ preset_subdir = "pov/world"
+ preset_operator = "script.execute_preset"
+ draw = bpy.types.Menu.draw_preset
+
+
+class AddPresetWorld(AddPresetBase, bpy.types.Operator):
+ '''Add a World Preset'''
+ bl_idname = "object.world_preset_add"
+ bl_label = "Add World Preset"
+ preset_menu = "POV_WORLD_MT_presets"
+
+ # variable used for all preset values
+ preset_defines = [
+ "scene = bpy.context.scene"
+ ]
+
+ # properties to store in the preset
+ preset_values = [
+ "scene.world.use_sky_blend",
+ "scene.world.horizon_color",
+ "scene.world.zenith_color",
+ "scene.world.ambient_color",
+ "scene.world.mist_settings.use_mist",
+ "scene.world.mist_settings.intensity",
+ "scene.world.mist_settings.depth",
+ "scene.world.mist_settings.start",
+ "scene.pov.media_enable",
+ "scene.pov.media_scattering_type",
+ "scene.pov.media_samples",
+ "scene.pov.media_diffusion_scale",
+ "scene.pov.media_diffusion_color",
+ "scene.pov.media_absorption_scale",
+ "scene.pov.media_absorption_color",
+ "scene.pov.media_eccentricity",
+ ]
+
+ # where to store the preset
+ preset_subdir = "pov/world"
+
+# Draw into an existing panel
+def world_panel_func(self, context):
+ layout = self.layout
+
+ row = layout.row(align=True)
+ row.menu(POV_WORLD_MT_presets.__name__, text=POV_WORLD_MT_presets.bl_label)
+ row.operator(AddPresetWorld.bl_idname, text="", icon='ZOOMIN')
+ row.operator(AddPresetWorld.bl_idname, text="", icon='ZOOMOUT').remove_active = True
+
+
+classes = (
+ POV_WORLD_MT_presets,
+ AddPresetWorld,
+ )
# Example of wrapping every class 'as is'
from bl_ui import properties_texture
@@ -453,6 +509,52 @@ class LAMP_PT_POV_lamp(PovLampButtonsPanel, bpy.types.Panel):
draw = properties_data_lamp.DATA_PT_lamp.draw
+class POV_LAMP_MT_presets(bpy.types.Menu):
+ bl_label = "Lamp Presets"
+ preset_subdir = "pov/lamp"
+ preset_operator = "script.execute_preset"
+ draw = bpy.types.Menu.draw_preset
+
+
+class AddPresetLamp(AddPresetBase, bpy.types.Operator):
+ '''Add a Lamp Preset'''
+ bl_idname = "object.lamp_preset_add"
+ bl_label = "Add Lamp Preset"
+ preset_menu = "POV_LAMP_MT_presets"
+
+ # variable used for all preset values
+ preset_defines = [
+ "lampdata = bpy.context.object.data"
+ ]
+
+ # properties to store in the preset
+ preset_values = [
+ "lampdata.type",
+ "lampdata.color",
+ ]
+
+ # where to store the preset
+ preset_subdir = "pov/lamp"
+
+
+
+
+
+# Draw into an existing panel
+def lamp_panel_func(self, context):
+ layout = self.layout
+
+ row = layout.row(align=True)
+ row.menu(POV_LAMP_MT_presets.__name__, text=POV_LAMP_MT_presets.bl_label)
+ row.operator(AddPresetLamp.bl_idname, text="", icon='ZOOMIN')
+ row.operator(AddPresetLamp.bl_idname, text="", icon='ZOOMOUT').remove_active = True
+
+
+classes = (
+ POV_LAMP_MT_presets,
+ AddPresetLamp,
+ )
+
class LAMP_PT_POV_sunsky(PovLampButtonsPanel, bpy.types.Panel):
bl_label = properties_data_lamp.DATA_PT_sunsky.bl_label
@@ -609,7 +711,10 @@ class RENDER_PT_povray_render_settings(RenderButtonsPanel, bpy.types.Panel):
scene = context.scene
#layout.active = (scene.pov.max_trace_level != 0)
-
+
+ if sys.platform[:3] != "win":
+ layout.prop(scene.pov, "sdl_window_enable", text="POV-Ray SDL Window")
+
col = layout.column()
col.label(text="Global Settings:")
@@ -787,7 +892,71 @@ class RENDER_PT_povray_radiosity(RenderButtonsPanel, bpy.types.Panel):
col.prop(scene.pov, "radio_subsurface")
-
+
+
+
+class POV_RADIOSITY_MT_presets(bpy.types.Menu):
+ bl_label = "Radiosity Presets"
+ preset_subdir = "pov/radiosity"
+ preset_operator = "script.execute_preset"
+ draw = bpy.types.Menu.draw_preset
+
+
+class AddPresetRadiosity(AddPresetBase, bpy.types.Operator):
+ '''Add a Radiosity Preset'''
+ bl_idname = "scene.radiosity_preset_add"
+ bl_label = "Add Radiosity Preset"
+ preset_menu = "POV_RADIOSITY_MT_presets"
+
+ # variable used for all preset values
+ preset_defines = [
+ "scene = bpy.context.scene"
+ ]
+
+ # properties to store in the preset
+ preset_values = [
+ "scene.pov.radio_display_advanced",
+ "scene.pov.radio_adc_bailout",
+ "scene.pov.radio_always_sample",
+ "scene.pov.radio_brightness",
+ "scene.pov.radio_count",
+ "scene.pov.radio_error_bound",
+ "scene.pov.radio_gray_threshold",
+ "scene.pov.radio_low_error_factor",
+ "scene.pov.radio_media",
+ "scene.pov.radio_subsurface",
+ "scene.pov.radio_minimum_reuse",
+ "scene.pov.radio_maximum_reuse",
+ "scene.pov.radio_nearest_count",
+ "scene.pov.radio_normal",
+ "scene.pov.radio_recursion_limit",
+ "scene.pov.radio_pretrace_start",
+ "scene.pov.radio_pretrace_end",
+ ]
+
+ # where to store the preset
+ preset_subdir = "pov/radiosity"
+
+
+
+
+
+# Draw into an existing panel
+def rad_panel_func(self, context):
+ layout = self.layout
+
+ row = layout.row(align=True)
+ row.menu(POV_RADIOSITY_MT_presets.__name__, text=POV_RADIOSITY_MT_presets.bl_label)
+ row.operator(AddPresetRadiosity.bl_idname, text="", icon='ZOOMIN')
+ row.operator(AddPresetRadiosity.bl_idname, text="", icon='ZOOMOUT').remove_active = True
+
+
+classes = (
+ POV_RADIOSITY_MT_presets,
+ AddPresetRadiosity,
+ )
+
+
class RENDER_PT_povray_media(WorldButtonsPanel, bpy.types.Panel):
bl_label = "Atmosphere Media"
COMPAT_ENGINES = {'POVRAY_RENDER'}
@@ -804,10 +973,22 @@ class RENDER_PT_povray_media(WorldButtonsPanel, bpy.types.Panel):
layout.active = scene.pov.media_enable
- row = layout.row()
- row.prop(scene.pov, "media_samples", text="Samples")
- row.prop(scene.pov, "media_color", text="")
-
+ col = layout.column()
+ col.prop(scene.pov, "media_scattering_type", text="")
+ col = layout.column()
+ col.prop(scene.pov, "media_samples", text="Samples")
+ split = layout.split()
+ col = split.column(align=True)
+ col.label(text="Scattering:")
+ col.prop(scene.pov, "media_diffusion_scale")
+ col.prop(scene.pov, "media_diffusion_color", text="")
+ col = split.column(align=True)
+ col.label(text="Absorption:")
+ col.prop(scene.pov, "media_absorption_scale")
+ col.prop(scene.pov, "media_absorption_color", text="")
+ if scene.pov.media_scattering_type == '5':
+ col = layout.column()
+ col.prop(scene.pov, "media_eccentricity", text="Eccentricity")
##class RENDER_PT_povray_baking(RenderButtonsPanel, bpy.types.Panel):
## bl_label = "Baking"
## COMPAT_ENGINES = {'POVRAY_RENDER'}
@@ -824,7 +1005,7 @@ class RENDER_PT_povray_media(WorldButtonsPanel, bpy.types.Panel):
## rd = scene.render
##
## layout.active = scene.pov.baking_enable
-'''XXX WIP preparing for CSG
+
class MODIFIERS_PT_povray_modifiers(ModifierButtonsPanel, bpy.types.Panel):
bl_label = "POV-Ray"
COMPAT_ENGINES = {'POVRAY_RENDER'}
@@ -853,7 +1034,7 @@ class MODIFIERS_PT_povray_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col = layout.column()
# Inside Vector for CSG
col.prop(ob.pov, "inside_vector")
-'''
+
class MATERIAL_PT_povray_activate_node(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Activate Node Settings"