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:
authorThomas Dinges <blender@dingto.org>2009-11-22 03:03:42 +0300
committerThomas Dinges <blender@dingto.org>2009-11-22 03:03:42 +0300
commit4f6b95480f54d7525982c3c38ab771fba6773b3f (patch)
tree68d72b2cda647a1b036450f2e475c066e89948ab /release
parent573be3e687c9db985b1cfdb670e038370ba30628 (diff)
* Added Subsurface Scattering Presets.
Note: Add doesn't work, it writes some text into the file, not the values. (Maybe because the values are arrays?!) Campbell, please check :)
Diffstat (limited to 'release')
-rw-r--r--release/scripts/op/preset_sss.py60
-rw-r--r--release/scripts/presets/sss/Apple.py2
-rw-r--r--release/scripts/presets/sss/Chicken.py2
-rw-r--r--release/scripts/presets/sss/Cream.py2
-rw-r--r--release/scripts/presets/sss/Ketchup.py2
-rw-r--r--release/scripts/presets/sss/Marble.py2
-rw-r--r--release/scripts/presets/sss/Potato.py2
-rw-r--r--release/scripts/presets/sss/Skin1.py2
-rw-r--r--release/scripts/presets/sss/Skin2.py2
-rw-r--r--release/scripts/presets/sss/Skin_Milk.py2
-rw-r--r--release/scripts/presets/sss/Whole_Milk.py2
-rw-r--r--release/scripts/ui/properties_material.py23
12 files changed, 101 insertions, 2 deletions
diff --git a/release/scripts/op/preset_sss.py b/release/scripts/op/preset_sss.py
new file mode 100644
index 00000000000..3d9285820e8
--- /dev/null
+++ b/release/scripts/op/preset_sss.py
@@ -0,0 +1,60 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+import bpy
+import os
+
+class AddPreset(bpy.types.Operator):
+ '''Add a Subsurface Scattering Preset'''
+ bl_idname = "sss.preset_add"
+ bl_label = "Add Subsurface Scattering Preset"
+
+ name = bpy.props.StringProperty(name="Name", description="Name of the preset, used to make the path name", maxlen= 64, default= "New Preset")
+
+ _preset_values = [
+ "bpy.context.active_object.active_material.subsurface_scattering.radius",
+ "bpy.context.active_object.active_material.subsurface_scattering.color",
+ ]
+
+ _last_preset = "" # hack to avoid remaking
+
+ def _as_filename(self, name): # could reuse for other presets
+ for char in " !@#$%^&*(){}:\";'[]<>,./?":
+ name = name.replace('.', '_')
+ return name.lower()
+
+ def execute(self, context):
+ filename = self._as_filename(self.properties.name) + ".py"
+
+ target_path = os.path.join(os.path.dirname(__file__), os.path.pardir, "presets", "sss", filename)
+ print(target_path)
+ file_preset = open(target_path, 'w')
+
+ for rna_path in self._preset_values:
+ file_preset.write("%s = %s\n" % (rna_path, eval(rna_path)))
+
+ file_preset.close()
+
+ return ('FINISHED',)
+
+ def invoke(self, context, event):
+ wm = context.manager
+ wm.invoke_props_popup(self, event)
+ return ('RUNNING_MODAL',)
+
+bpy.ops.add(AddPreset)
diff --git a/release/scripts/presets/sss/Apple.py b/release/scripts/presets/sss/Apple.py
new file mode 100644
index 00000000000..474769cd36f
--- /dev/null
+++ b/release/scripts/presets/sss/Apple.py
@@ -0,0 +1,2 @@
+bpy.context.active_object.active_material.subsurface_scattering.radius = 11.605, 3.884, 1.754
+bpy.context.active_object.active_material.subsurface_scattering.color = 0.430, 0.210, 0.168
diff --git a/release/scripts/presets/sss/Chicken.py b/release/scripts/presets/sss/Chicken.py
new file mode 100644
index 00000000000..6253de09376
--- /dev/null
+++ b/release/scripts/presets/sss/Chicken.py
@@ -0,0 +1,2 @@
+bpy.context.active_object.active_material.subsurface_scattering.radius = 9.436, 3.348, 1.790
+bpy.context.active_object.active_material.subsurface_scattering.color = 0.439, 0.216, 0.141
diff --git a/release/scripts/presets/sss/Cream.py b/release/scripts/presets/sss/Cream.py
new file mode 100644
index 00000000000..f0a5292b85c
--- /dev/null
+++ b/release/scripts/presets/sss/Cream.py
@@ -0,0 +1,2 @@
+bpy.context.active_object.active_material.subsurface_scattering.radius = 15.028, 4.664, 2.541
+bpy.context.active_object.active_material.subsurface_scattering.color = 0.987, 0.943, 0.827
diff --git a/release/scripts/presets/sss/Ketchup.py b/release/scripts/presets/sss/Ketchup.py
new file mode 100644
index 00000000000..caece1ea7ca
--- /dev/null
+++ b/release/scripts/presets/sss/Ketchup.py
@@ -0,0 +1,2 @@
+bpy.context.active_object.active_material.subsurface_scattering.radius = 4.762, 0.575, 0.394
+bpy.context.active_object.active_material.subsurface_scattering.color = 0.222, 0.008, 0.002
diff --git a/release/scripts/presets/sss/Marble.py b/release/scripts/presets/sss/Marble.py
new file mode 100644
index 00000000000..ea894f69800
--- /dev/null
+++ b/release/scripts/presets/sss/Marble.py
@@ -0,0 +1,2 @@
+bpy.context.active_object.active_material.subsurface_scattering.radius = 8.509, 5.566, 3.951
+bpy.context.active_object.active_material.subsurface_scattering.color = 0.925, 0.905, 0.884
diff --git a/release/scripts/presets/sss/Potato.py b/release/scripts/presets/sss/Potato.py
new file mode 100644
index 00000000000..89407dff427
--- /dev/null
+++ b/release/scripts/presets/sss/Potato.py
@@ -0,0 +1,2 @@
+bpy.context.active_object.active_material.subsurface_scattering.radius = 14.266, 7.228, 2.036
+bpy.context.active_object.active_material.subsurface_scattering.color = 0.855, 0.740, 0.292
diff --git a/release/scripts/presets/sss/Skin1.py b/release/scripts/presets/sss/Skin1.py
new file mode 100644
index 00000000000..42fb1fac43a
--- /dev/null
+++ b/release/scripts/presets/sss/Skin1.py
@@ -0,0 +1,2 @@
+bpy.context.active_object.active_material.subsurface_scattering.radius = 3.673, 1.367, 0.683
+bpy.context.active_object.active_material.subsurface_scattering.color = 0.574, 0.313, 0.174
diff --git a/release/scripts/presets/sss/Skin2.py b/release/scripts/presets/sss/Skin2.py
new file mode 100644
index 00000000000..52b649ecd8f
--- /dev/null
+++ b/release/scripts/presets/sss/Skin2.py
@@ -0,0 +1,2 @@
+bpy.context.active_object.active_material.subsurface_scattering.radius = 4.821, 1.694, 1.090
+bpy.context.active_object.active_material.subsurface_scattering.color = 0.749, 0.571, 0.467
diff --git a/release/scripts/presets/sss/Skin_Milk.py b/release/scripts/presets/sss/Skin_Milk.py
new file mode 100644
index 00000000000..2e5b19d4f53
--- /dev/null
+++ b/release/scripts/presets/sss/Skin_Milk.py
@@ -0,0 +1,2 @@
+bpy.context.active_object.active_material.subsurface_scattering.radius = 18.424, 10.443, 3.502
+bpy.context.active_object.active_material.subsurface_scattering.color = 0.889, 0.888, 0.796
diff --git a/release/scripts/presets/sss/Whole_Milk.py b/release/scripts/presets/sss/Whole_Milk.py
new file mode 100644
index 00000000000..4cb6ccf3dcf
--- /dev/null
+++ b/release/scripts/presets/sss/Whole_Milk.py
@@ -0,0 +1,2 @@
+bpy.context.active_object.active_material.subsurface_scattering.radius = 10.899, 6.575, 2.508
+bpy.context.active_object.active_material.subsurface_scattering.color = 0.947, 0.931, 0.852
diff --git a/release/scripts/ui/properties_material.py b/release/scripts/ui/properties_material.py
index e85ad30e6f6..15e9df3443f 100644
--- a/release/scripts/ui/properties_material.py
+++ b/release/scripts/ui/properties_material.py
@@ -22,6 +22,18 @@ import bpy
narrowui = 180
+class SSS_MT_presets(bpy.types.Menu):
+ '''
+ Creates the menu items by scanning scripts/templates
+ '''
+ bl_label = "Subsurface Scattering Presets"
+
+ def draw(self, context):
+ import os
+ template_dir = os.path.join(os.path.dirname(__file__), os.path.pardir, "presets", "sss")
+ self.path_menu(template_dir, "script.python_file_run")
+
+
def active_node_mat(mat):
# TODO, 2.4x has a pipeline section, for 2.5 we need to communicate
# which settings from node-materials are used
@@ -475,10 +487,15 @@ class MATERIAL_PT_sss(MaterialButtonsPanel):
sss = mat.subsurface_scattering
wide_ui = context.region.width > narrowui
- layout.active = sss.enabled
+ layout.active = (sss.enabled) and (not mat.shadeless)
+
+ row = layout.row().split()
+ sub = row.row(align=True).split(percentage=0.75)
+ sub.itemM("SSS_MT_presets", text="Presets")
+ sub.itemO("sss.preset_add", text="Add")
+ row.itemL()
split = layout.split()
- split.active = (not mat.shadeless)
col = split.column()
col.itemR(sss, "ior")
@@ -861,6 +878,8 @@ class MATERIAL_PT_volume_integration(VolumeButtonsPanel):
col = split.column()
col.itemL()
col.itemR(vol, "depth_cutoff")
+
+bpy.types.register(SSS_MT_presets)
bpy.types.register(MATERIAL_PT_volume_density)
bpy.types.register(MATERIAL_PT_volume_shading)