[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24746] trunk/blender/release/scripts: SSS presets, Thomas and I added these at the same time, however I meant to make this a more general system.
Campbell Barton
ideasman42 at gmail.com
Sun Nov 22 01:22:31 CET 2009
Revision: 24746
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24746
Author: campbellbarton
Date: 2009-11-22 01:22:29 +0100 (Sun, 22 Nov 2009)
Log Message:
-----------
SSS presets, Thomas and I added these at the same time, however I meant to make this a more general system.
this commit shows how to add a preset using the base preset class and menu with minimal effort.
Modified Paths:
--------------
trunk/blender/release/scripts/op/presets.py
trunk/blender/release/scripts/ui/properties_material.py
Modified: trunk/blender/release/scripts/op/presets.py
===================================================================
--- trunk/blender/release/scripts/op/presets.py 2009-11-22 00:18:43 UTC (rev 24745)
+++ trunk/blender/release/scripts/op/presets.py 2009-11-22 00:22:29 UTC (rev 24746)
@@ -25,7 +25,6 @@
class AddPresetRender(AddPresetBase):
bl_idname = "render.preset_add"
bl_label = "Add Render Preset"
-
name = AddPresetBase.name
preset_values = [
@@ -41,6 +40,30 @@
preset_path = os.path.join("presets", "render")
+class AddPresetSSS(AddPresetBase):
+ bl_idname = "material.sss_preset_add"
+ bl_label = "Add Render Preset"
+ name = AddPresetBase.name
+
+ preset_values = [
+ "bpy.context.material.subsurface_scattering.back",
+ "bpy.context.material.subsurface_scattering.color[0]",
+ "bpy.context.material.subsurface_scattering.color[1]",
+ "bpy.context.material.subsurface_scattering.color[2]",
+ "bpy.context.material.subsurface_scattering.color_factor",
+ "bpy.context.material.subsurface_scattering.error_tolerance",
+ "bpy.context.material.subsurface_scattering.front",
+ "bpy.context.material.subsurface_scattering.ior",
+ "bpy.context.material.subsurface_scattering.radius[0]",
+ "bpy.context.material.subsurface_scattering.radius[1]",
+ "bpy.context.material.subsurface_scattering.radius[2]",
+ "bpy.context.material.subsurface_scattering.scale",
+ "bpy.context.material.subsurface_scattering.texture_factor",
+ ]
+
+ preset_path = os.path.join("presets", "sss")
+
bpy.ops.add(AddPresetRender)
+bpy.ops.add(AddPresetSSS)
Modified: trunk/blender/release/scripts/ui/properties_material.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_material.py 2009-11-22 00:18:43 UTC (rev 24745)
+++ trunk/blender/release/scripts/ui/properties_material.py 2009-11-22 00:22:29 UTC (rev 24746)
@@ -22,18 +22,6 @@
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
@@ -47,6 +35,15 @@
return None
+class MATERIAL_MT_sss_presets(bpy.types.Menu):
+ bl_label = "SSS 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")
+
+
class MaterialButtonsPanel(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@@ -487,15 +484,15 @@
sss = mat.subsurface_scattering
wide_ui = context.region.width > narrowui
- 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()
+ sub.itemM("MATERIAL_MT_sss_presets", text="Presets")
+ sub.itemO("material.sss_preset_add", text="Add")
+ layout.active = sss.enabled
+
split = layout.split()
+ split.active = (not mat.shadeless)
col = split.column()
col.itemR(sss, "ior")
@@ -878,9 +875,9 @@
col = split.column()
col.itemL()
col.itemR(vol, "depth_cutoff")
-
-bpy.types.register(SSS_MT_presets)
+bpy.types.register(MATERIAL_MT_sss_presets)
+
bpy.types.register(MATERIAL_PT_volume_density)
bpy.types.register(MATERIAL_PT_volume_shading)
bpy.types.register(MATERIAL_PT_volume_lighting)
More information about the Bf-blender-cvs
mailing list