[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34914] trunk/blender/release/scripts/ui/ properties_material.py: Commit patch [#25939] material panel proposal by Ervin Weber (lusque).
Thomas Dinges
blender at dingto.de
Wed Feb 16 20:39:45 CET 2011
Revision: 34914
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34914
Author: dingto
Date: 2011-02-16 19:39:45 +0000 (Wed, 16 Feb 2011)
Log Message:
-----------
Commit patch [#25939] material panel proposal by Ervin Weber (lusque). Thanks!
>From the patch description:
"A new panel is proposed to bring togheter all the properties of a material that belong to the render pipeline level.
Such properties are currently not mixable with node materials, as nodes operate on a shader level."
Commiting this patch as approved in the sundy meeting.
Modified Paths:
--------------
trunk/blender/release/scripts/ui/properties_material.py
Modified: trunk/blender/release/scripts/ui/properties_material.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_material.py 2011-02-16 18:29:26 UTC (rev 34913)
+++ trunk/blender/release/scripts/ui/properties_material.py 2011-02-16 19:39:45 UTC (rev 34914)
@@ -34,6 +34,16 @@
return None
+def check_material(mat):
+ if mat is not None:
+ if mat.use_nodes:
+ if mat.active_node_material is not None:
+ return True
+ return False
+ return True
+ return False
+
+
class MATERIAL_MT_sss_presets(bpy.types.Menu):
bl_label = "SSS Presets"
preset_subdir = "sss"
@@ -116,9 +126,16 @@
elif mat:
split.template_ID(space, "pin_id")
split.separator()
-
+
if mat:
layout.prop(mat, "type", expand=True)
+ if mat.use_nodes:
+ row = layout.row()
+ row.label(text="", icon='NODETREE')
+ if mat.active_node_material:
+ row.prop(mat.active_node_material, "name", text="")
+ else:
+ row.label(text="No material node selected")
class MATERIAL_PT_preview(MaterialButtonsPanel, bpy.types.Panel):
@@ -129,16 +146,66 @@
self.layout.template_preview(context.material)
+class MATERIAL_PT_pipeline(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Render Pipeline Options"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return mat and (mat.type in ('SURFACE', 'WIRE', 'VOLUME')) and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self. layout
+
+ mat = context.material
+ #split = layout.split()
+ mat_type = mat.type in ('SURFACE', 'WIRE')
+
+ row = layout.row()
+ row.active = mat_type
+ row.prop(mat, "use_transparency")
+ sub = row.column()
+ sub.prop(mat, "offset_z")
+ sub.active = mat_type and mat.use_transparency and mat.transparency_method == 'Z_TRANSPARENCY'
+
+ row = layout.row()
+ row.active = mat.use_transparency or not mat_type
+ row.prop(mat, "transparency_method", expand=True)
+
+ layout.separator()
+
+ split = layout.split()
+ col = split.column()
+
+ col.prop(mat, "use_raytrace") #
+ col.prop(mat, "use_full_oversampling") #
+ sub = col.column()
+ sub.active = mat_type
+ sub.prop(mat, "use_sky")
+ sub.prop(mat, "invert_z")
+
+ col = split.column()
+ col.active = mat_type
+
+ col.prop(mat, "use_cast_shadows_only", text="Cast Only")
+ col.prop(mat, "shadow_cast_alpha", text="Casting Alpha")
+ col.prop(mat, "use_cast_buffer_shadows")
+ col.prop(mat, "use_cast_approximate")
+
+
class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Diffuse"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@classmethod
def poll(cls, context):
- mat = active_node_mat(context.material)
+ mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
-
+ return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+
def draw(self, context):
layout = self.layout
@@ -202,10 +269,10 @@
@classmethod
def poll(cls, context):
- mat = active_node_mat(context.material)
+ mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
-
+ return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+
def draw(self, context):
layout = self.layout
@@ -267,10 +334,10 @@
@classmethod
def poll(cls, context):
- mat = active_node_mat(context.material)
+ mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
-
+ return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+
def draw(self, context):
layout = self.layout
@@ -302,31 +369,23 @@
@classmethod
def poll(cls, context):
- mat = active_node_mat(context.material)
+ mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+ return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
- def draw_header(self, context):
- mat = active_node_mat(context.material)
-
- self.layout.prop(mat, "use_transparency", text="")
-
def draw(self, context):
layout = self.layout
-
+
+ base_mat = context.material
mat = active_node_mat(context.material)
rayt = mat.raytrace_transparency
-
- row = layout.row()
- row.active = mat.use_transparency and (not mat.use_shadeless)
- row.prop(mat, "transparency_method", expand=True)
-
+
split = layout.split()
col = split.column()
col.prop(mat, "alpha")
row = col.row()
- row.active = mat.use_transparency and (not mat.use_shadeless)
+ row.active = base_mat.use_transparency and (not mat.use_shadeless) #
row.prop(mat, "specular_alpha", text="Specular")
col = split.column()
@@ -336,10 +395,10 @@
sub.active = rayt.fresnel > 0
sub.prop(rayt, "fresnel_factor", text="Blend")
- if mat.transparency_method == 'RAYTRACE':
+ if base_mat.transparency_method == 'RAYTRACE':
layout.separator()
split = layout.split()
- split.active = mat.use_transparency
+ split.active = base_mat.use_transparency
col = split.column()
col.prop(rayt, "ior")
@@ -364,13 +423,13 @@
@classmethod
def poll(cls, context):
- mat = active_node_mat(context.material)
+ mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+ return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
raym = active_node_mat(context.material).raytrace_mirror
-
+
self.layout.prop(raym, "use", text="")
def draw(self, context):
@@ -422,9 +481,9 @@
@classmethod
def poll(cls, context):
- mat = active_node_mat(context.material)
+ mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+ return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
mat = active_node_mat(context.material)
@@ -633,10 +692,10 @@
@classmethod
def poll(cls, context):
- mat = active_node_mat(context.material)
+ mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
-
+ return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+
def draw(self, context):
layout = self.layout
@@ -645,14 +704,7 @@
split = layout.split()
col = split.column()
- col.prop(mat, "use_raytrace")
- col.prop(mat, "use_full_oversampling")
- col.prop(mat, "use_sky")
col.prop(mat, "use_mist")
- col.prop(mat, "invert_z")
- sub = col.row()
- sub.prop(mat, "offset_z")
- sub.active = mat.use_transparency and mat.transparency_method == 'Z_TRANSPARENCY'
sub = col.column(align=True)
sub.label(text="Light Group:")
sub.prop(mat, "light_group", text="")
@@ -678,10 +730,10 @@
@classmethod
def poll(cls, context):
- mat = active_node_mat(context.material)
+ mat = context.material
engine = context.scene.render.engine
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
-
+ return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
+
def draw(self, context):
layout = self.layout
@@ -693,11 +745,8 @@
col.prop(mat, "use_shadows", text="Receive")
col.prop(mat, "use_transparent_shadows", text="Receive Transparent")
col.prop(mat, "use_only_shadow", text="Shadows Only")
- col.prop(mat, "use_cast_shadows_only", text="Cast Only")
- col.prop(mat, "shadow_cast_alpha", text="Casting Alpha")
col = split.column()
- col.prop(mat, "use_cast_buffer_shadows")
sub = col.column()
sub.active = mat.use_cast_buffer_shadows
sub.prop(mat, "shadow_buffer_bias", text="Buffer Bias")
@@ -705,7 +754,6 @@
sub = col.column()
sub.active = (not mat.use_ray_shadow_bias)
sub.prop(mat, "shadow_ray_bias", text="Ray Bias")
- col.prop(mat, "use_cast_approximate")
class MATERIAL_PT_transp_game(MaterialButtonsPanel, bpy.types.Panel):
@@ -715,31 +763,17 @@
@classmethod
def poll(cls, context):
- mat = active_node_mat(context.material)
+ mat = context.material
engine = context.scene.render.engine
- return mat and (engine in cls.COMPAT_ENGINES)
+ return check_material(mat) and (engine in cls.COMPAT_ENGINES)
- def draw_header(self, context):
- mat = active_node_mat(context.material)
-
- self.layout.prop(mat, "use_transparency", text="")
-
def draw(self, context):
layout = self.layout
mat = active_node_mat(context.material)
- rayt = mat.raytrace_transparency
+ layout.prop(mat, "alpha")
- row = layout.row()
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list