diff options
Diffstat (limited to 'release/ui/buttons_material.py')
-rw-r--r-- | release/ui/buttons_material.py | 336 |
1 files changed, 154 insertions, 182 deletions
diff --git a/release/ui/buttons_material.py b/release/ui/buttons_material.py index 30b107d452f..dc11731d7a9 100644 --- a/release/ui/buttons_material.py +++ b/release/ui/buttons_material.py @@ -8,18 +8,16 @@ class MaterialButtonsPanel(bpy.types.Panel): # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here def poll(self, context): - return (context.material) and (context.scene.render_data.engine in self.COMPAT_ENGINES) + mat = context.material + engine = context.scene.render_data.engine + return mat and (engine in self.COMPAT_ENGINES) class MATERIAL_PT_preview(MaterialButtonsPanel): __label__ = "Preview" COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME']) def draw(self, context): - layout = self.layout - - mat = context.material - - layout.template_preview(mat) + self.layout.template_preview(context.material) class MATERIAL_PT_context_material(MaterialButtonsPanel): __show_header__ = False @@ -83,32 +81,27 @@ class MATERIAL_PT_shading(MaterialButtonsPanel): layout = self.layout mat = context.material - ob = context.object - slot = context.material_slot - space = context.space_data - - if mat: - if mat.type in ('SURFACE', 'WIRE'): - split = layout.split() + if mat.type in ('SURFACE', 'WIRE'): + split = layout.split() - col = split.column() - sub = col.column() - sub.active = not mat.shadeless - sub.itemR(mat, "emit") - sub.itemR(mat, "ambient") - sub = col.column() - sub.itemR(mat, "translucency") + col = split.column() + sub = col.column() + sub.active = not mat.shadeless + sub.itemR(mat, "emit") + sub.itemR(mat, "ambient") + sub = col.column() + sub.itemR(mat, "translucency") - col = split.column() - col.itemR(mat, "shadeless") - sub = col.column() - sub.active = not mat.shadeless - sub.itemR(mat, "tangent_shading") - sub.itemR(mat, "cubic") + col = split.column() + col.itemR(mat, "shadeless") + sub = col.column() + sub.active = not mat.shadeless + sub.itemR(mat, "tangent_shading") + sub.itemR(mat, "cubic") - elif mat.type == 'HALO': - layout.itemR(mat, "alpha") + elif mat.type == 'HALO': + layout.itemR(mat, "alpha") class MATERIAL_PT_strand(MaterialButtonsPanel): __label__ = "Strand" @@ -130,8 +123,8 @@ class MATERIAL_PT_strand(MaterialButtonsPanel): col = split.column(align=True) col.itemL(text="Size:") - col.itemR(tan, "start_size", text="Root") - col.itemR(tan, "end_size", text="Tip") + col.itemR(tan, "root_size", text="Root") + col.itemR(tan, "tip_size", text="Tip") col.itemR(tan, "min_size", text="Minimum") col.itemR(tan, "blender_units") sub = col.column() @@ -158,8 +151,7 @@ class MATERIAL_PT_physics(MaterialButtonsPanel): def draw(self, context): layout = self.layout - mat = context.material - phys = mat.physics + phys = context.material.physics split = layout.split() @@ -231,7 +223,7 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel): col = split.column() col.itemR(mat, "shadows", text="Receive") - col.itemR(mat, "transparent_shadows", text="Receive Transparent") + col.itemR(mat, "receive_transparent_shadows", text="Receive Transparent") col.itemR(mat, "only_shadow", text="Shadows Only") col.itemR(mat, "cast_shadows_only", text="Cast Only") col.itemR(mat, "shadow_casting_alpha", text="Casting Alpha") @@ -266,7 +258,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel): col.itemR(mat, "diffuse_color", text="") sub = col.column() sub.active = (not mat.shadeless) - sub.itemR(mat, "diffuse_reflection", text="Intensity") + sub.itemR(mat, "diffuse_intensity", text="Intensity") col = split.column() col.active = (not mat.shadeless) @@ -320,7 +312,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel): col = split.column() col.itemR(mat, "specular_color", text="") - col.itemR(mat, "specular_reflection", text="Intensity") + col.itemR(mat, "specular_intensity", text="Intensity") col = split.column() col.itemR(mat, "specular_shader", text="") @@ -363,12 +355,11 @@ class MATERIAL_PT_sss(MaterialButtonsPanel): return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES) def draw_header(self, context): - layout = self.layout sss = context.material.subsurface_scattering mat = context.material - layout.active = (not mat.shadeless) - layout.itemR(sss, "enabled", text="") + self.layout.active = (not mat.shadeless) + self.layout.itemR(sss, "enabled", text="") def draw(self, context): layout = self.layout @@ -408,12 +399,10 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel): 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 - + def draw_header(self, context): raym = context.material.raytrace_mirror - layout.itemR(raym, "enabled", text="") + self.layout.itemR(raym, "enabled", text="") def draw(self, context): layout = self.layout @@ -426,7 +415,7 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel): split = layout.split() col = split.column() - col.itemR(raym, "reflect", text="Reflectivity") + col.itemR(raym, "reflect_factor") col.itemR(mat, "mirror_color", text="") col = split.column() @@ -448,9 +437,9 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel): col = split.column() col.itemL(text="Gloss:") - col.itemR(raym, "gloss", text="Amount") + col.itemR(raym, "gloss_factor", text="Amount") sub = col.column() - sub.active = raym.gloss < 1 + sub.active = raym.gloss_factor < 1.0 sub.itemR(raym, "gloss_threshold", text="Threshold") sub.itemR(raym, "gloss_samples", text="Samples") sub.itemR(raym, "gloss_anisotropic", text="Anisotropic") @@ -465,11 +454,9 @@ class MATERIAL_PT_transp(MaterialButtonsPanel): 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 - + def draw_header(self, context): mat = context.material - layout.itemR(mat, "transparency", text="") + self.layout.itemR(mat, "transparency", text="") def draw(self, context): layout = self.layout @@ -477,15 +464,14 @@ class MATERIAL_PT_transp(MaterialButtonsPanel): mat = context.material rayt = context.material.raytrace_transparency - row= layout.row() - row.itemR(mat, "transparency_method", expand=True) + row = layout.row() row.active = mat.transparency and (not mat.shadeless) + row.itemR(mat, "transparency_method", expand=True) split = layout.split() col = split.column() - row = col.row() - row.itemR(mat, "alpha") + col.itemR(mat, "alpha") row = col.row() row.active = mat.transparency and (not mat.shadeless) row.itemR(mat, "specular_alpha", text="Specular") @@ -511,35 +497,136 @@ class MATERIAL_PT_transp(MaterialButtonsPanel): col = split.column() col.itemL(text="Gloss:") - col.itemR(rayt, "gloss", text="Amount") + col.itemR(rayt, "gloss_factor", text="Amount") sub = col.column() - sub.active = rayt.gloss < 1 + sub.active = rayt.gloss_factor < 1.0 sub.itemR(rayt, "gloss_threshold", text="Threshold") sub.itemR(rayt, "gloss_samples", text="Samples") -class MATERIAL_PT_volume_shading(MaterialButtonsPanel): - __label__ = "Shading" - __default_closed__ = False +class MATERIAL_PT_halo(MaterialButtonsPanel): + __label__= "Halo" COMPAT_ENGINES = set(['BLENDER_RENDER']) def poll(self, context): mat = context.material engine = context.scene.render_data.engine - return mat and (mat.type == 'VOLUME') and (engine in self.COMPAT_ENGINES) + return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES) def draw(self, context): layout = self.layout + + mat = context.material + halo = mat.halo + + split = layout.split() + + col = split.column() + col.itemR(mat, "diffuse_color", text="") + col.itemR(halo, "size") + col.itemR(halo, "hardness") + col.itemR(halo, "add") + col.itemL(text="Options:") + col.itemR(halo, "texture") + col.itemR(halo, "vertex_normal") + col.itemR(halo, "xalpha") + col.itemR(halo, "shaded") + col.itemR(halo, "soft") + col = split.column() + col.itemR(halo, "ring") + sub = col.column() + sub.active = halo.ring + sub.itemR(halo, "rings") + sub.itemR(mat, "mirror_color", text="") + col.itemS() + col.itemR(halo, "lines") + sub = col.column() + sub.active = halo.lines + sub.itemR(halo, "line_number", text="Lines") + sub.itemR(mat, "specular_color", text="") + col.itemS() + col.itemR(halo, "star") + sub = col.column() + sub.active = halo.star + sub.itemR(halo, "star_tips") + +class MATERIAL_PT_flare(MaterialButtonsPanel): + __label__= "Flare" + COMPAT_ENGINES = set(['BLENDER_RENDER']) + + def poll(self, context): mat = context.material - vol = context.material.volume + 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 + + mat = context.material + halo = mat.halo + layout.itemR(halo, "flare_mode", text="") + + def draw(self, context): + layout = self.layout + + mat = context.material + halo = mat.halo + + layout.active = halo.flare_mode split = layout.split() - row = split.row() + col = split.column() + col.itemR(halo, "flare_size", text="Size") + col.itemR(halo, "flare_boost", text="Boost") + col.itemR(halo, "flare_seed", text="Seed") + col = split.column() + col.itemR(halo, "flares_sub", text="Subflares") + col.itemR(halo, "flare_subsize", text="Subsize") + +bpy.types.register(MATERIAL_PT_context_material) +bpy.types.register(MATERIAL_PT_preview) +bpy.types.register(MATERIAL_PT_diffuse) +bpy.types.register(MATERIAL_PT_specular) +bpy.types.register(MATERIAL_PT_shading) +bpy.types.register(MATERIAL_PT_transp) +bpy.types.register(MATERIAL_PT_mirror) +bpy.types.register(MATERIAL_PT_sss) +bpy.types.register(MATERIAL_PT_halo) +bpy.types.register(MATERIAL_PT_flare) +bpy.types.register(MATERIAL_PT_physics) +bpy.types.register(MATERIAL_PT_strand) +bpy.types.register(MATERIAL_PT_options) +bpy.types.register(MATERIAL_PT_shadow) + +# Volumetrics +class VolumeButtonsPanel(bpy.types.Panel): + __space_type__ = 'PROPERTIES' + __region_type__ = 'WINDOW' + __context__ = "material" + + def poll(self, context): + mat = context.material + engine = context.scene.render_data.engine + return mat and (mat.type == 'VOLUME') and (engine in self.COMPAT_ENGINES) + +class MATERIAL_PT_volume_shading(VolumeButtonsPanel): + __label__ = "Shading" + __default_closed__ = False + COMPAT_ENGINES = set(['BLENDER_RENDER']) + + def draw(self, context): + layout = self.layout + + mat = context.material + vol = context.material.volume + + row = layout.row() row.itemR(vol, "density") row.itemR(vol, "scattering") - + split = layout.split() + col = split.column() col.itemR(vol, "absorption") col.itemR(vol, "absorption_color", text="") @@ -548,20 +635,14 @@ class MATERIAL_PT_volume_shading(MaterialButtonsPanel): col.itemR(vol, "emission") col.itemR(vol, "emission_color", text="") -class MATERIAL_PT_volume_scattering(MaterialButtonsPanel): +class MATERIAL_PT_volume_scattering(VolumeButtonsPanel): __label__ = "Scattering" __default_closed__ = False COMPAT_ENGINES = set(['BLENDER_RENDER']) - - def poll(self, context): - 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 - mat = context.material vol = context.material.volume split = layout.split() @@ -587,17 +668,9 @@ class MATERIAL_PT_volume_scattering(MaterialButtonsPanel): if vol.phase_function in ('SCHLICK', 'HENYEY-GREENSTEIN'): col.itemR(vol, "asymmetry") -class MATERIAL_PT_volume_transp(MaterialButtonsPanel): +class MATERIAL_PT_volume_transp(VolumeButtonsPanel): __label__= "Transparency" COMPAT_ENGINES = set(['BLENDER_RENDER']) - - def poll(self, context): - mat = context.material - 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 def draw(self, context): layout = self.layout @@ -609,16 +682,11 @@ class MATERIAL_PT_volume_transp(MaterialButtonsPanel): row.itemR(mat, "transparency_method", expand=True) row.active = mat.transparency and (not mat.shadeless) -class MATERIAL_PT_volume_integration(MaterialButtonsPanel): +class MATERIAL_PT_volume_integration(VolumeButtonsPanel): __label__ = "Integration" __default_closed__ = False COMPAT_ENGINES = set(['BLENDER_RENDER']) - - def poll(self, context): - 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 @@ -638,104 +706,8 @@ class MATERIAL_PT_volume_integration(MaterialButtonsPanel): col.itemL() col.itemR(vol, "depth_cutoff") col.itemR(vol, "density_scale") - - -class MATERIAL_PT_halo(MaterialButtonsPanel): - __label__= "Halo" - COMPAT_ENGINES = set(['BLENDER_RENDER']) - - def poll(self, context): - mat = context.material - 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 - - mat = context.material - halo = mat.halo - - split = layout.split() - - col = split.column() - col.itemR(mat, "diffuse_color", text="") - col.itemR(halo, "size") - col.itemR(halo, "hardness") - col.itemR(halo, "add") - col.itemL(text="Options:") - col.itemR(halo, "use_texture", text="Texture") - col.itemR(halo, "use_vertex_normal", text="Vertex Normal") - col.itemR(halo, "xalpha") - col.itemR(halo, "shaded") - col.itemR(halo, "soft") - - col = split.column() - col.itemR(halo, "ring") - sub = col.column() - sub.active = halo.ring - sub.itemR(halo, "rings") - sub.itemR(mat, "mirror_color", text="") - col.itemS() - col.itemR(halo, "lines") - sub = col.column() - sub.active = halo.lines - sub.itemR(halo, "line_number", text="Lines") - sub.itemR(mat, "specular_color", text="") - col.itemS() - col.itemR(halo, "star") - sub = col.column() - sub.active = halo.star - sub.itemR(halo, "star_tips") - -class MATERIAL_PT_flare(MaterialButtonsPanel): - __label__= "Flare" - COMPAT_ENGINES = set(['BLENDER_RENDER']) - - def poll(self, context): - mat = context.material - 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 - - mat = context.material - halo = mat.halo - layout.itemR(halo, "flare_mode", text="") - - def draw(self, context): - layout = self.layout - - mat = context.material - halo = mat.halo - layout.active = halo.flare_mode - - split = layout.split() - - col = split.column() - col.itemR(halo, "flare_size", text="Size") - col.itemR(halo, "flare_boost", text="Boost") - col.itemR(halo, "flare_seed", text="Seed") - col = split.column() - col.itemR(halo, "flares_sub", text="Subflares") - col.itemR(halo, "flare_subsize", text="Subsize") - -bpy.types.register(MATERIAL_PT_context_material) -bpy.types.register(MATERIAL_PT_preview) -bpy.types.register(MATERIAL_PT_diffuse) -bpy.types.register(MATERIAL_PT_specular) -bpy.types.register(MATERIAL_PT_shading) -bpy.types.register(MATERIAL_PT_transp) -bpy.types.register(MATERIAL_PT_mirror) -bpy.types.register(MATERIAL_PT_sss) bpy.types.register(MATERIAL_PT_volume_shading) bpy.types.register(MATERIAL_PT_volume_scattering) bpy.types.register(MATERIAL_PT_volume_transp) bpy.types.register(MATERIAL_PT_volume_integration) -bpy.types.register(MATERIAL_PT_halo) -bpy.types.register(MATERIAL_PT_flare) -bpy.types.register(MATERIAL_PT_physics) -bpy.types.register(MATERIAL_PT_strand) -bpy.types.register(MATERIAL_PT_options) -bpy.types.register(MATERIAL_PT_shadow) |