svn merge -r 22628:22714 https://svn.blender.org/svnroot/bf-blender/branches/blender2...
[blender.git] / release / ui / buttons_material.py
index eaba26c7e5177b8a86a29c2390cb0f617a2c904c..21201166edaf6fef10a274b79c2f75e4d3a3363e 100644 (file)
@@ -73,6 +73,9 @@ class MATERIAL_PT_shading(MaterialButtonsPanel):
        __label__ = "Shading"
        COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
 
+       def poll(self, context):
+               return (context.material.type in ('SURFACE', 'WIRE', 'HALO'))
+
        def draw(self, context):
                layout = self.layout
                
@@ -83,7 +86,7 @@ class MATERIAL_PT_shading(MaterialButtonsPanel):
 
                if mat:
 
-                       if mat.type in ('SURFACE', 'WIRE', 'VOLUME'):
+                       if mat.type in ('SURFACE', 'WIRE'):
                                split = layout.split()
        
                                col = split.column()
@@ -113,6 +116,9 @@ class MATERIAL_PT_strand(MaterialButtonsPanel):
                mat = context.material
                return mat and (mat.type in ('SURFACE', 'WIRE')) and (context.scene.render_data.engine in self.COMPAT_ENGINES)
        
+       def poll(self, context):
+               return context.material.type in ('SURFACE', 'WIRE', 'HALO')
+       
        def draw(self, context):
                layout = self.layout
                
@@ -170,6 +176,9 @@ class MATERIAL_PT_options(MaterialButtonsPanel):
        __label__ = "Options"
        COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
 
+       def poll(self, context):
+               return (context.material.type in ('SURFACE', 'WIRE', 'HALO'))
+
        def draw(self, context):
                layout = self.layout
                
@@ -204,6 +213,9 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel):
        __label__ = "Shadow"
        __default_closed__ = True
        COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
+       
+       def poll(self, context):
+               return context.material.type in ('SURFACE', 'WIRE')
 
        def draw(self, context):
                layout = self.layout
@@ -236,7 +248,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel):
 
        def poll(self, context):
                mat = context.material
-               return mat and (mat.type != 'HALO') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+               return mat and (mat.type in ('SURFACE', 'WIRE')) and (context.scene.render_data.engine in self.COMPAT_ENGINES)
 
        def draw(self, context):
                layout = self.layout
@@ -290,7 +302,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel):
 
        def poll(self, context):
                mat = context.material
-               return mat and (mat.type != 'HALO') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+               return mat and (mat.type in ('SURFACE', 'WIRE')) and (context.scene.render_data.engine in self.COMPAT_ENGINES)
 
        def draw(self, context):
                layout = self.layout
@@ -499,6 +511,125 @@ class MATERIAL_PT_transp(MaterialButtonsPanel):
                        sub.active = rayt.gloss < 1
                        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
+       COMPAT_ENGINES = set(['BLENDER_RENDER'])
+       
+       def poll(self, context):
+               return (context.material.type == 'VOLUME') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+       
+       def draw(self, context):
+               layout = self.layout
+
+               mat = context.material
+               vol = context.material.volume
+               
+               split = layout.split()
+               
+               row = split.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="")
+               
+                               
+               col = split.column()
+               col.itemR(vol, "emission")
+               col.itemR(vol, "emission_color", text="")
+               
+               
+
+class MATERIAL_PT_volume_scattering(MaterialButtonsPanel):
+       __label__ = "Scattering"
+       __default_closed__ = False
+       COMPAT_ENGINES = set(['BLENDER_RENDER'])
+       
+       def poll(self, context):
+               return (context.material.type == 'VOLUME') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+       
+       def draw(self, context):
+               layout = self.layout
+               
+               mat = context.material
+               vol = context.material.volume
+               
+               split = layout.split()
+               
+               col = split.column()
+               col.itemR(vol, "scattering_mode", text="")
+               if vol.scattering_mode == 'SINGLE_SCATTERING':
+                       col.itemR(vol, "light_cache")
+                       sub = col.column()
+                       sub.active = vol.light_cache
+                       sub.itemR(vol, "cache_resolution")
+               elif vol.scattering_mode in ('MULTIPLE_SCATTERING', 'SINGLE_PLUS_MULTIPLE_SCATTERING'):
+                       col.itemR(vol, "cache_resolution")
+                       
+                       col = col.column(align=True)
+                       col.itemR(vol, "ms_diffusion")
+                       col.itemR(vol, "ms_spread")
+                       col.itemR(vol, "ms_intensity")
+               
+               col = split.column()
+               # col.itemL(text="Anisotropic Scattering:")
+               col.itemR(vol, "phase_function", text="")
+               if vol.phase_function in ('SCHLICK', 'HENYEY-GREENSTEIN'):
+                       col.itemR(vol, "asymmetry")
+
+class MATERIAL_PT_volume_transp(MaterialButtonsPanel):
+       __label__= "Transparency"
+       COMPAT_ENGINES = set(['BLENDER_RENDER'])
+               
+       def poll(self, context):
+               mat = context.material
+               return mat and (mat.type == 'VOLUME') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+
+       def draw_header(self, context):
+               layout = self.layout
+
+       def draw(self, context):
+               layout = self.layout
+               
+               mat = context.material
+               rayt = context.material.raytrace_transparency
+               
+               row= layout.row()
+               row.itemR(mat, "transparency_method", expand=True)
+               row.active = mat.transparency and (not mat.shadeless)
+               
+class MATERIAL_PT_volume_integration(MaterialButtonsPanel):
+       __label__ = "Integration"
+       __default_closed__ = False
+       COMPAT_ENGINES = set(['BLENDER_RENDER'])
+       
+       def poll(self, context):
+               return (context.material.type == 'VOLUME') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+       
+       def draw(self, context):
+               layout = self.layout
+               
+               mat = context.material
+               vol = context.material.volume
+               
+               split = layout.split()
+               
+               col = split.column()
+               col.itemL(text="Step Calculation:")
+               col.itemR(vol, "step_calculation", text="")
+               col = col.column(align=True)
+               col.itemR(vol, "step_size")
+               col.itemR(vol, "shading_step_size")
+               
+               col = split.column()
+               col.itemL()
+               col.itemR(vol, "depth_cutoff")
+               col.itemR(vol, "density_scale")
+               
                
 class MATERIAL_PT_halo(MaterialButtonsPanel):
        __label__= "Halo"
@@ -587,6 +718,10 @@ 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)