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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/scripts/op/presets.py34
-rw-r--r--release/scripts/presets/sunsky/classic.py14
-rw-r--r--release/scripts/presets/sunsky/desert.py14
-rw-r--r--release/scripts/presets/sunsky/mountain.py14
-rw-r--r--release/scripts/ui/properties_data_lamp.py26
-rw-r--r--release/scripts/ui/properties_material.py2
-rw-r--r--source/blender/makesrna/intern/rna_lamp.c4
-rw-r--r--source/blender/makesrna/intern/rna_material.c2
8 files changed, 98 insertions, 12 deletions
diff --git a/release/scripts/op/presets.py b/release/scripts/op/presets.py
index 76d84bc8b3d..feeb35d8659 100644
--- a/release/scripts/op/presets.py
+++ b/release/scripts/op/presets.py
@@ -49,7 +49,11 @@ class AddPresetBase(bpy.types.Operator):
file_preset = open(os.path.join(target_path, filename), 'w')
for rna_path in self.preset_values:
- file_preset.write("%s = %s\n" % (rna_path, eval(rna_path)))
+ value = eval(rna_path)
+ if type(value) == str:
+ value = "'%s'" % value
+
+ file_preset.write("%s = %s\n" % (rna_path, value))
file_preset.close()
@@ -125,6 +129,34 @@ class AddPresetCloth(AddPresetBase):
preset_subdir = "cloth"
+
+class AddPresetSunSky(AddPresetBase):
+ '''Add a Cloth Preset.'''
+ bl_idname = "lamp.sunsky_preset_add"
+ bl_label = "Add Sunsky Preset"
+ name = AddPresetBase.name
+
+ preset_values = [
+ "bpy.context.object.data.sky.atmosphere_turbidity",
+ "bpy.context.object.data.sky.sky_blend_type",
+ "bpy.context.object.data.sky.sky_blend",
+ "bpy.context.object.data.sky.horizon_brightness",
+ "bpy.context.object.data.sky.spread",
+ "bpy.context.object.data.sky.sky_color_space",
+ "bpy.context.object.data.sky.sky_exposure",
+ "bpy.context.object.data.sky.sun_brightness",
+ "bpy.context.object.data.sky.sun_size",
+ "bpy.context.object.data.sky.backscattered_light",
+ "bpy.context.object.data.sky.sun_intensity",
+ "bpy.context.object.data.sky.atmosphere_distance_factor",
+ "bpy.context.object.data.sky.atmosphere_inscattering",
+ "bpy.context.object.data.sky.atmosphere_extinction",
+ ]
+
+ preset_subdir = "sunsky"
+
+
bpy.types.register(AddPresetRender)
bpy.types.register(AddPresetSSS)
bpy.types.register(AddPresetCloth)
+bpy.types.register(AddPresetSunSky)
diff --git a/release/scripts/presets/sunsky/classic.py b/release/scripts/presets/sunsky/classic.py
new file mode 100644
index 00000000000..e673b503cb2
--- /dev/null
+++ b/release/scripts/presets/sunsky/classic.py
@@ -0,0 +1,14 @@
+bpy.context.object.data.sky.atmosphere_turbidity = 4.0
+bpy.context.object.data.sky.sky_blend_type = 'ADD'
+bpy.context.object.data.sky.sky_blend = 1.0
+bpy.context.object.data.sky.horizon_brightness = 10.0
+bpy.context.object.data.sky.spread = 1.49011614159e-09
+bpy.context.object.data.sky.sky_color_space = 'SMPTE'
+bpy.context.object.data.sky.sky_exposure = 1.0
+bpy.context.object.data.sky.sun_brightness = 1.00000011921
+bpy.context.object.data.sky.sun_size = 1.00000166893
+bpy.context.object.data.sky.backscattered_light = 0.0
+bpy.context.object.data.sky.sun_intensity = 4.0
+bpy.context.object.data.sky.atmosphere_distance_factor = 0.0
+bpy.context.object.data.sky.atmosphere_inscattering = 1.0
+bpy.context.object.data.sky.atmosphere_extinction = 1.0
diff --git a/release/scripts/presets/sunsky/desert.py b/release/scripts/presets/sunsky/desert.py
new file mode 100644
index 00000000000..f971571d281
--- /dev/null
+++ b/release/scripts/presets/sunsky/desert.py
@@ -0,0 +1,14 @@
+bpy.context.object.data.sky.atmosphere_turbidity = 6.0
+bpy.context.object.data.sky.sky_blend_type = 'ADD'
+bpy.context.object.data.sky.sky_blend = 1.0
+bpy.context.object.data.sky.horizon_brightness = 4.99999761581
+bpy.context.object.data.sky.spread = 1.49011614159e-09
+bpy.context.object.data.sky.sky_color_space = 'SMPTE'
+bpy.context.object.data.sky.sky_exposure = 1.0
+bpy.context.object.data.sky.sun_brightness = 1.00000011921
+bpy.context.object.data.sky.sun_size = 4.0
+bpy.context.object.data.sky.backscattered_light = 1.0
+bpy.context.object.data.sky.sun_intensity = 1.0
+bpy.context.object.data.sky.atmosphere_distance_factor = 0.0
+bpy.context.object.data.sky.atmosphere_inscattering = 1.0
+bpy.context.object.data.sky.atmosphere_extinction = 1.0
diff --git a/release/scripts/presets/sunsky/mountain.py b/release/scripts/presets/sunsky/mountain.py
new file mode 100644
index 00000000000..65564541657
--- /dev/null
+++ b/release/scripts/presets/sunsky/mountain.py
@@ -0,0 +1,14 @@
+bpy.context.object.data.sky.atmosphere_turbidity = 2.00000023842
+bpy.context.object.data.sky.sky_blend_type = 'ADD'
+bpy.context.object.data.sky.sky_blend = 1.0
+bpy.context.object.data.sky.horizon_brightness = 0.100000016391
+bpy.context.object.data.sky.spread = 1.0
+bpy.context.object.data.sky.sky_color_space = 'SMPTE'
+bpy.context.object.data.sky.sky_exposure = 1.0
+bpy.context.object.data.sky.sun_brightness = 1.99999988079
+bpy.context.object.data.sky.sun_size = 4.0
+bpy.context.object.data.sky.backscattered_light = -1.0
+bpy.context.object.data.sky.sun_intensity = 10.0
+bpy.context.object.data.sky.atmosphere_distance_factor = 0.0
+bpy.context.object.data.sky.atmosphere_inscattering = 1.0
+bpy.context.object.data.sky.atmosphere_extinction = 1.0
diff --git a/release/scripts/ui/properties_data_lamp.py b/release/scripts/ui/properties_data_lamp.py
index d12138e64b9..8d32eeaed98 100644
--- a/release/scripts/ui/properties_data_lamp.py
+++ b/release/scripts/ui/properties_data_lamp.py
@@ -23,6 +23,13 @@ from rna_prop_ui import PropertyPanel
narrowui = 180
+class LAMP_MT_sunsky_presets(bpy.types.Menu):
+ bl_label = "Render Presets"
+ preset_subdir = "sunsky"
+ preset_operator = "script.python_file_run"
+ draw = bpy.types.Menu.draw_preset
+
+
class DataButtonsPanel(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@@ -129,16 +136,19 @@ class DATA_PT_sunsky(DataButtonsPanel):
lamp = context.lamp.sky
wide_ui = context.region.width > narrowui
- layout.prop(lamp, "sky")
+ row = layout.row(align=True)
+ row.prop(lamp, "use_sky")
+ row.menu("LAMP_MT_sunsky_presets", text="Presets")
+ row.operator("lamp.sunsky_preset_add", text="Add")
row = layout.row()
- row.active = lamp.sky or lamp.atmosphere
+ row.active = lamp.use_sky or lamp.use_atmosphere
row.prop(lamp, "atmosphere_turbidity", text="Turbidity")
split = layout.split()
col = split.column()
- col.active = lamp.sky
+ col.active = lamp.use_sky
col.label(text="Blending:")
sub = col.column()
sub.prop(lamp, "sky_blend_type", text="")
@@ -151,7 +161,7 @@ class DATA_PT_sunsky(DataButtonsPanel):
if wide_ui:
col = split.column()
- col.active = lamp.sky
+ col.active = lamp.use_sky
col.label(text="Horizon:")
sub = col.column()
sub.prop(lamp, "horizon_brightness", text="Brightness")
@@ -165,19 +175,19 @@ class DATA_PT_sunsky(DataButtonsPanel):
layout.separator()
- layout.prop(lamp, "atmosphere")
+ layout.prop(lamp, "use_atmosphere")
split = layout.split()
col = split.column()
- col.active = lamp.atmosphere
+ col.active = lamp.use_atmosphere
col.label(text="Intensity:")
col.prop(lamp, "sun_intensity", text="Sun")
col.prop(lamp, "atmosphere_distance_factor", text="Distance")
if wide_ui:
col = split.column()
- col.active = lamp.atmosphere
+ col.active = lamp.use_atmosphere
col.label(text="Scattering:")
sub = col.column(align=True)
sub.prop(lamp, "atmosphere_inscattering", slider=True, text="Inscattering")
@@ -381,6 +391,8 @@ class DATA_PT_falloff_curve(DataButtonsPanel):
self.layout.template_curve_mapping(lamp, "falloff_curve")
+bpy.types.register(LAMP_MT_sunsky_presets)
+
bpy.types.register(DATA_PT_context_lamp)
bpy.types.register(DATA_PT_preview)
bpy.types.register(DATA_PT_lamp)
diff --git a/release/scripts/ui/properties_material.py b/release/scripts/ui/properties_material.py
index 46f43014d62..ca7edf1e3ee 100644
--- a/release/scripts/ui/properties_material.py
+++ b/release/scripts/ui/properties_material.py
@@ -274,7 +274,7 @@ class MATERIAL_PT_options(MaterialButtonsPanel):
col = split.column()
col.prop(mat, "traceable")
col.prop(mat, "full_oversampling")
- col.prop(mat, "sky")
+ col.prop(mat, "use_sky")
col.prop(mat, "exclude_mist")
col.prop(mat, "invert_z")
sub = col.row()
diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c
index c0ebc2abdf9..c1d274f6cca 100644
--- a/source/blender/makesrna/intern/rna_lamp.c
+++ b/source/blender/makesrna/intern/rna_lamp.c
@@ -307,12 +307,12 @@ static void rna_def_lamp_sky_settings(BlenderRNA *brna)
/* boolean */
- prop= RNA_def_property(srna, "sky", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "sun_effect_type", LA_SUN_EFFECT_SKY);
RNA_def_property_ui_text(prop, "Sky", "Apply sun effect on sky.");
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
- prop= RNA_def_property(srna, "atmosphere", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_atmosphere", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "sun_effect_type", LA_SUN_EFFECT_AP);
RNA_def_property_ui_text(prop, "Atmosphere", "Apply sun effect on atmosphere.");
RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index ea750e94fba..b8c0c29c4ba 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -1599,7 +1599,7 @@ void RNA_def_material(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Z Offset", "Gives faces an artificial offset in the Z buffer for Z transparency.");
RNA_def_property_update(prop, 0, "rna_Material_update");
- prop= RNA_def_property(srna, "sky", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ENV);
RNA_def_property_ui_text(prop, "Sky", "Renders this material with zero alpha, with sky background in place (scanline only).");
RNA_def_property_update(prop, 0, "rna_Material_update");