[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22769] branches/blender2.5/blender/ release/ui/buttons_material.py: 2.5 Material Buttons:
Thomas Dinges
dingto at gmx.de
Tue Aug 25 16:26:27 CEST 2009
Revision: 22769
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22769
Author: dingto
Date: 2009-08-25 16:26:27 +0200 (Tue, 25 Aug 2009)
Log Message:
-----------
2.5 Material Buttons:
* Fixed some poll checks, they showed empty panels when there was no active material.
* Some minor code/whitespace cleanup.
Modified Paths:
--------------
branches/blender2.5/blender/release/ui/buttons_material.py
Modified: branches/blender2.5/blender/release/ui/buttons_material.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_material.py 2009-08-25 13:54:56 UTC (rev 22768)
+++ branches/blender2.5/blender/release/ui/buttons_material.py 2009-08-25 14:26:27 UTC (rev 22769)
@@ -29,7 +29,8 @@
# An exception, dont call the parent poll func because
# this manages materials for all engine types
- return (context.object) and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+ engine = context.scene.render_data.engine
+ return (context.object) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -74,7 +75,9 @@
COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
def poll(self, context):
- return (context.material.type in ('SURFACE', 'WIRE', 'HALO'))
+ mat = context.material
+ engine = context.scene.render_data.engine
+ return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -114,11 +117,9 @@
def poll(self, context):
mat = context.material
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+ engine = context.scene.render_data.engine
+ return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES)
- def poll(self, context):
- return context.material.type in ('SURFACE', 'WIRE', 'HALO')
-
def draw(self, context):
layout = self.layout
@@ -177,7 +178,9 @@
COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
def poll(self, context):
- return (context.material.type in ('SURFACE', 'WIRE', 'HALO'))
+ mat = context.material
+ engine = context.scene.render_data.engine
+ return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -215,7 +218,9 @@
COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
def poll(self, context):
- return context.material.type in ('SURFACE', 'WIRE')
+ mat = context.material
+ engine = context.scene.render_data.engine
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -240,7 +245,6 @@
sub = col.column()
sub.active = (not mat.ray_shadow_bias)
sub.itemR(mat, "shadow_ray_bias", text="Ray Bias")
-
class MATERIAL_PT_diffuse(MaterialButtonsPanel):
__label__ = "Diffuse"
@@ -248,7 +252,8 @@
def poll(self, context):
mat = context.material
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+ engine = context.scene.render_data.engine
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -294,15 +299,15 @@
split = row.split(percentage=0.3)
split.itemL(text="Blend:")
split.itemR(mat, "diffuse_ramp_blend", text="")
-
-
+
class MATERIAL_PT_specular(MaterialButtonsPanel):
__label__ = "Specular"
COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
def poll(self, context):
mat = context.material
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+ engine = context.scene.render_data.engine
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -354,7 +359,8 @@
def poll(self, context):
mat = context.material
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+ engine = context.scene.render_data.engine
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
def draw_header(self, context):
layout = self.layout
@@ -399,7 +405,8 @@
def poll(self, context):
mat = context.material
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+ engine = context.scene.render_data.engine
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
def draw_header(self, context):
layout = self.layout
@@ -421,8 +428,7 @@
col = split.column()
col.itemR(raym, "reflect", text="Reflectivity")
col.itemR(mat, "mirror_color", text="")
-
-
+
col = split.column()
col.itemR(raym, "fresnel")
sub = col.column()
@@ -448,8 +454,7 @@
sub.itemR(raym, "gloss_threshold", text="Threshold")
sub.itemR(raym, "gloss_samples", text="Samples")
sub.itemR(raym, "gloss_anisotropic", text="Anisotropic")
-
-
+
class MATERIAL_PT_transp(MaterialButtonsPanel):
__label__= "Transparency"
__default_closed__ = True
@@ -457,7 +462,8 @@
def poll(self, context):
mat = context.material
- return mat and (mat.type in ('SURFACE', 'WIRE')) and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+ engine = context.scene.render_data.engine
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
def draw_header(self, context):
layout = self.layout
@@ -483,8 +489,7 @@
row = col.row()
row.active = mat.transparency and (not mat.shadeless)
row.itemR(mat, "specular_alpha", text="Specular")
-
-
+
col = split.column()
col.active = (not mat.shadeless)
col.itemR(rayt, "fresnel")
@@ -518,7 +523,9 @@
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def poll(self, context):
- return (context.material.type == 'VOLUME') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+ mat = context.material
+ engine = context.scene.render_data.engine
+ return mat and (mat.type == 'VOLUME') and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -536,13 +543,10 @@
col = split.column()
col.itemR(vol, "absorption")
col.itemR(vol, "absorption_color", text="")
-
-
+
col = split.column()
col.itemR(vol, "emission")
col.itemR(vol, "emission_color", text="")
-
-
class MATERIAL_PT_volume_scattering(MaterialButtonsPanel):
__label__ = "Scattering"
@@ -550,7 +554,9 @@
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def poll(self, context):
- return (context.material.type == 'VOLUME') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+ mat = context.material
+ engine = context.scene.render_data.engine
+ return mat and (mat.type == 'VOLUME') and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -587,7 +593,8 @@
def poll(self, context):
mat = context.material
- return mat and (mat.type == 'VOLUME') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+ engine = context.scene.render_data.engine
+ return mat and (mat.type == 'VOLUME') and (engine in self.COMPAT_ENGINES)
def draw_header(self, context):
layout = self.layout
@@ -608,7 +615,9 @@
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def poll(self, context):
- return (context.material.type == 'VOLUME') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+ mat = context.material
+ engine = context.scene.render_data.engine
+ return mat and (mat.type == 'VOLUME') and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -637,7 +646,8 @@
def poll(self, context):
mat = context.material
- return mat and (mat.type == 'HALO') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+ engine = context.scene.render_data.engine
+ return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -683,7 +693,8 @@
def poll(self, context):
mat = context.material
- return mat and (mat.type == 'HALO') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+ engine = context.scene.render_data.engine
+ return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES)
def draw_header(self, context):
layout = self.layout
@@ -728,4 +739,3 @@
bpy.types.register(MATERIAL_PT_strand)
bpy.types.register(MATERIAL_PT_options)
bpy.types.register(MATERIAL_PT_shadow)
-
More information about the Bf-blender-cvs
mailing list