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>2011-02-16 22:39:45 +0300
committerThomas Dinges <blender@dingto.org>2011-02-16 22:39:45 +0300
commit878c8f47d8104b425d2004f60449f4f45e946d2d (patch)
treecbb4388dfde8bd20caeb11142941986b085ed978 /release
parent9d168f733719c3abeba245a92cb37530db2a98f4 (diff)
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.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/ui/properties_material.py186
1 files changed, 106 insertions, 80 deletions
diff --git a/release/scripts/ui/properties_material.py b/release/scripts/ui/properties_material.py
index 82c3e840420..4586dc8bdd7 100644
--- a/release/scripts/ui/properties_material.py
+++ b/release/scripts/ui/properties_material.py
@@ -34,6 +34,16 @@ def active_node_mat(mat):
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 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel):
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 @@ class MATERIAL_PT_preview(MaterialButtonsPanel, bpy.types.Panel):
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 @@ class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel):
@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 @@ class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel):
@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 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
@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)
-
- def draw_header(self, context):
- mat = active_node_mat(context.material)
-
- self.layout.prop(mat, "use_transparency", text="")
+ return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
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 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
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 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
@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 @@ class MATERIAL_PT_sss(MaterialButtonsPanel, bpy.types.Panel):
@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 @@ class MATERIAL_PT_options(MaterialButtonsPanel, bpy.types.Panel):
@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 @@ class MATERIAL_PT_options(MaterialButtonsPanel, bpy.types.Panel):
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 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel):
@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 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel):
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 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel):
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,29 +763,15 @@ class MATERIAL_PT_transp_game(MaterialButtonsPanel, bpy.types.Panel):
@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)
-
- def draw_header(self, context):
- mat = active_node_mat(context.material)
-
- self.layout.prop(mat, "use_transparency", text="")
+ return check_material(mat) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
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")
+ layout.prop(mat, "alpha")
class VolumeButtonsPanel():
@@ -830,18 +864,6 @@ class MATERIAL_PT_volume_lighting(VolumeButtonsPanel, bpy.types.Panel):
sub.prop(vol, "ms_intensity")
-class MATERIAL_PT_volume_transp(VolumeButtonsPanel, bpy.types.Panel):
- bl_label = "Transparency"
- COMPAT_ENGINES = {'BLENDER_RENDER'}
-
- def draw(self, context):
- layout = self.layout
-
- mat = context.material # dont use node material
-
- layout.prop(mat, "transparency_method", expand=True)
-
-
class MATERIAL_PT_volume_integration(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Integration"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -868,7 +890,13 @@ class MATERIAL_PT_volume_options(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Options"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
bl_options = {'DEFAULT_CLOSED'}
-
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return check_material(mat) and (mat.type == 'VOLUME') and (engine in cls.COMPAT_ENGINES)
+
def draw(self, context):
layout = self.layout
@@ -877,8 +905,6 @@ class MATERIAL_PT_volume_options(VolumeButtonsPanel, bpy.types.Panel):
split = layout.split()
col = split.column()
- col.prop(mat, "use_raytrace")
- col.prop(mat, "use_full_oversampling")
col.prop(mat, "use_mist")
col = split.column()