diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-05-20 17:34:04 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-05-20 17:34:04 +0400 |
commit | a47c673b5525fde6484d4392160fbb5101f2c108 (patch) | |
tree | cb05981d656de969d91e12d8f74a34bfaf2ed810 /release/ui | |
parent | 56b726917d35ac51c86c3fd10580ac740124494d (diff) |
2.5 Material:
* Added material "type" property, with Surface/Volume/Halo
options, compatible with sim_physics, as requested for
material buttons layout. Obviously the Volume setting
does nothing currently.
* Deprecated MA_HALO flag in favor of this.
Diffstat (limited to 'release/ui')
-rw-r--r-- | release/ui/buttons_material.py | 138 |
1 files changed, 66 insertions, 72 deletions
diff --git a/release/ui/buttons_material.py b/release/ui/buttons_material.py index 551a62cfc84..af24bba57c7 100644 --- a/release/ui/buttons_material.py +++ b/release/ui/buttons_material.py @@ -5,40 +5,41 @@ class MaterialButtonsPanel(bpy.types.Panel): __space_type__ = "BUTTONS_WINDOW" __region_type__ = "WINDOW" __context__ = "material" + + def poll(self, context): + ob = context.active_object + return (ob and ob.active_material) class MATERIAL_PT_material(MaterialButtonsPanel): __idname__= "MATERIAL_PT_material" __label__ = "Material" - + def draw(self, context): layout = self.layout - try: - mat = context.active_object.active_material - except: - mat = None - - if not mat: - return + mat = context.active_object.active_material row = layout.row() + row.itemR(mat, "type", expand=True) + + row = layout.row() row.column().itemR(mat, "diffuse_color") row.column().itemR(mat, "specular_color") row.column().itemR(mat, "mirror_color") row = layout.row() - row.itemR(mat, "color_model") row.itemR(mat, "alpha") class MATERIAL_PT_sss(MaterialButtonsPanel): __idname__= "MATERIAL_PT_sss" __label__ = "Subsurface Scattering" + + def poll(self, context): + ob = context.active_object + return (ob and ob.active_material and ob.active_material.type == "SURFACE") def draw(self, context): layout = self.layout - try: - sss = context.active_object.active_material.subsurface_scattering - except: - sss = None + sss = context.active_object.active_material.subsurface_scattering if not sss: return @@ -66,7 +67,7 @@ class MATERIAL_PT_raymir(MaterialButtonsPanel): def poll(self, context): ob = context.active_object - return (ob and ob.active_material) + return (ob and ob.active_material and ob.active_material.type == "SURFACE") def draw_header(self, context): raym = context.active_object.active_material.raytrace_mirror @@ -99,16 +100,14 @@ class MATERIAL_PT_raymir(MaterialButtonsPanel): class MATERIAL_PT_raytransp(MaterialButtonsPanel): __idname__= "MATERIAL_PT_raytransp" __label__= "Ray Transparency" + + def poll(self, context): + ob = context.active_object + return (ob and ob.active_material and ob.active_material.type == "SURFACE") def draw(self, context): layout = self.layout - try: - rayt = context.active_object.active_material.raytrace_transparency - except: - rayt = None - - if not rayt: - return + rayt = context.active_object.active_material.raytrace_transparency layout.itemR(rayt, "enabled", text="Enable") @@ -135,61 +134,56 @@ class MATERIAL_PT_halo(MaterialButtonsPanel): __idname__= "MATERIAL_PT_halo" __label__= "Halo" + def poll(self, context): + ob = context.active_object + return (ob and ob.active_material and ob.active_material.type == "HALO") + def draw(self, context): layout = self.layout - try: - halo = context.active_object.active_material.halo - except: - halo = None + mat = context.active_object.active_material + halo = mat.halo - if not halo: - return - - layout.itemR(halo, "enabled", text="Enable Halo") - - if halo.enabled: - - split = layout.split() - - sub = split.column() - sub.itemL(text="General Settings:") - sub.itemR(halo, "size") - sub.itemR(halo, "hardness") - sub.itemR(halo, "add") - - sub = split.column() - sub.itemL(text="Elements:") - sub.itemR(halo, "ring") - sub.itemR(halo, "lines") - sub.itemR(halo, "star") - sub.itemR(halo, "flare_mode") + split = layout.split() + + sub = split.column() + sub.itemL(text="General Settings:") + sub.itemR(halo, "size") + sub.itemR(halo, "hardness") + sub.itemR(halo, "add") + + sub = split.column() + sub.itemL(text="Elements:") + sub.itemR(halo, "ring") + sub.itemR(halo, "lines") + sub.itemR(halo, "star") + sub.itemR(halo, "flare_mode") - row = layout.row() - - sub = row.column() - sub.itemL(text="Options:") - sub.itemR(halo, "use_texture", text="Texture") - sub.itemR(halo, "use_vertex_normal", text="Vertex Normal") - sub.itemR(halo, "xalpha") - sub.itemR(halo, "shaded") - sub.itemR(halo, "soft") - - sub = row.column() - if (halo.ring): - sub.itemR(halo, "rings") - if (halo.lines): - sub.itemR(halo, "line_number") - if (halo.ring or halo.lines): - sub.itemR(halo, "seed") - if (halo.star): - sub.itemR(halo, "star_tips") - if (halo.flare_mode): - sub.itemL(text="Flare:") - sub.itemR(halo, "flare_size", text="Size") - sub.itemR(halo, "flare_subsize", text="Subsize") - sub.itemR(halo, "flare_boost", text="Boost") - sub.itemR(halo, "flare_seed", text="Seed") - sub.itemR(halo, "flares_sub", text="Sub") + row = layout.row() + + sub = row.column() + sub.itemL(text="Options:") + sub.itemR(halo, "use_texture", text="Texture") + sub.itemR(halo, "use_vertex_normal", text="Vertex Normal") + sub.itemR(halo, "xalpha") + sub.itemR(halo, "shaded") + sub.itemR(halo, "soft") + + sub = row.column() + if (halo.ring): + sub.itemR(halo, "rings") + if (halo.lines): + sub.itemR(halo, "line_number") + if (halo.ring or halo.lines): + sub.itemR(halo, "seed") + if (halo.star): + sub.itemR(halo, "star_tips") + if (halo.flare_mode): + sub.itemL(text="Flare:") + sub.itemR(halo, "flare_size", text="Size") + sub.itemR(halo, "flare_subsize", text="Subsize") + sub.itemR(halo, "flare_boost", text="Boost") + sub.itemR(halo, "flare_seed", text="Seed") + sub.itemR(halo, "flares_sub", text="Sub") bpy.types.register(MATERIAL_PT_material) bpy.types.register(MATERIAL_PT_raymir) |