2.5 Buttons:
authorThomas Dinges <blender@dingto.org>
Sat, 13 Jun 2009 21:22:21 +0000 (21:22 +0000)
committerThomas Dinges <blender@dingto.org>
Sat, 13 Jun 2009 21:22:21 +0000 (21:22 +0000)
* Added more material buttons by William. Thanks.
I made some minor adjustments and added Specular Shader Model RNA.

* Code cleanup and some consistency tweaks of button files.
Notes: Preview render now only shows up when there is an active world, material, texture or lamp.
* Made sure initial panels with ID Datablocks are shown, even when no block is active.

17 files changed:
release/ui/buttons_data_armature.py
release/ui/buttons_data_bone.py
release/ui/buttons_data_camera.py
release/ui/buttons_data_curve.py
release/ui/buttons_data_empty.py
release/ui/buttons_data_lamp.py
release/ui/buttons_data_lattice.py
release/ui/buttons_data_mesh.py
release/ui/buttons_data_modifier.py
release/ui/buttons_data_text.py
release/ui/buttons_material.py
release/ui/buttons_objects.py
release/ui/buttons_physic_cloth.py
release/ui/buttons_scene.py
release/ui/buttons_texture.py
release/ui/buttons_world.py
source/blender/makesrna/intern/rna_material.c

index 0b02eee9f7b8fa05a83ae1f749fb3e6ef62bb41c..1086e77c3f79ac7fbbc47b952fff246476eab4f7 100644 (file)
@@ -12,12 +12,16 @@ class DataButtonsPanel(bpy.types.Panel):
 class DATA_PT_skeleton(DataButtonsPanel):
        __idname__ = "DATA_PT_skeleton"
        __label__ = "Skeleton"
+       
+       def poll(self, context):
+               return (context.object.type == 'ARMATURE' or context.armature)
 
        def draw(self, context):
+               layout = self.layout
+               
                ob = context.object
                arm = context.armature
                space = context.space_data
-               layout = self.layout
 
                split = layout.split(percentage=0.65)
 
@@ -54,8 +58,8 @@ class DATA_PT_display(DataButtonsPanel):
        __label__ = "Display"
        
        def draw(self, context):
-               arm = context.armature
                layout = self.layout
+               arm = context.armature
 
                split = layout.split()
 
@@ -74,8 +78,8 @@ class DATA_PT_paths(DataButtonsPanel):
        __label__ = "Paths"
 
        def draw(self, context):
-               arm = context.armature
                layout = self.layout
+               arm = context.armature
 
                split = layout.split()
                
@@ -102,8 +106,8 @@ class DATA_PT_ghost(DataButtonsPanel):
        __label__ = "Ghost"
 
        def draw(self, context):
-               arm = context.armature
                layout = self.layout
+               arm = context.armature
 
                split = layout.split()
 
@@ -123,4 +127,4 @@ class DATA_PT_ghost(DataButtonsPanel):
 bpy.types.register(DATA_PT_skeleton)
 bpy.types.register(DATA_PT_display)
 bpy.types.register(DATA_PT_paths)
-bpy.types.register(DATA_PT_ghost)
+bpy.types.register(DATA_PT_ghost)
\ No newline at end of file
index 3f36a3d4909653ab2d57516c7109dc2e4e6d3db4..2abe76b93c162e24f0503cd4dd57c76b264d0ca1 100644 (file)
@@ -14,8 +14,8 @@ class BONE_PT_bone(BoneButtonsPanel):
        __label__ = "Bone"
 
        def draw(self, context):
-               bone = context.bone
                layout = self.layout
+               bone = context.bone
 
                split = layout.split()
 
@@ -50,5 +50,4 @@ class BONE_PT_bone(BoneButtonsPanel):
                
                sub.itemR(bone, "cyclic_offset")
 
-bpy.types.register(BONE_PT_bone)
-
+bpy.types.register(BONE_PT_bone)
\ No newline at end of file
index 362e4f96aa241aa059cb185a71dd34db97ec5b65..57abafb95c85e02b7b8b45ff56a2b44bc918c795 100644 (file)
@@ -12,12 +12,16 @@ class DataButtonsPanel(bpy.types.Panel):
 class DATA_PT_camera(DataButtonsPanel):
        __idname__ = "DATA_PT_camera"
        __label__ = "Lens"
+       
+       def poll(self, context):
+               return (context.object.type == 'CAMERA')
 
        def draw(self, context):
+               layout = self.layout
+               
                ob = context.object
                cam = context.camera
                space = context.space_data
-               layout = self.layout
 
                split = layout.split(percentage=0.65)
 
@@ -62,7 +66,7 @@ class DATA_PT_camera(DataButtonsPanel):
 class DATA_PT_camera_display(DataButtonsPanel):
        __idname__ = "DATA_PT_camera_display"
        __label__ = "Display"
-       
+
        def draw(self, context):
                cam = context.camera
                layout = self.layout
@@ -83,4 +87,4 @@ class DATA_PT_camera_display(DataButtonsPanel):
                col.itemR(cam, "draw_size", text="Size")
                
 bpy.types.register(DATA_PT_camera)
-bpy.types.register(DATA_PT_camera_display)
+bpy.types.register(DATA_PT_camera_display)
\ No newline at end of file
index b8b7d6a324f2126305282131751982d6af292a1b..f42c991a36fbc619d48ed7f7a0c69951f77f3476 100644 (file)
@@ -7,18 +7,21 @@ class DataButtonsPanel(bpy.types.Panel):
        __context__ = "data"
        
        def poll(self, context):
-               ob = context.object
-               return (ob and ob.type == 'CURVE' and context.curve)
+               return (context.object.type == 'CURVE' and context.curve)
 
 class DATA_PT_shape_curve(DataButtonsPanel):
        __idname__ = "DATA_PT_shape_curve"
        __label__ = "Shape"
+       
+       def poll(self, context):
+               return (context.object.type == 'CURVE')
 
        def draw(self, context):
+               layout = self.layout
+               
                ob = context.object
                curve = context.curve
                space = context.space_data
-               layout = self.layout
 
                split = layout.split(percentage=0.65)
 
@@ -63,8 +66,8 @@ class DATA_PT_geometry(DataButtonsPanel):
        __label__ = "Geometry"
 
        def draw(self, context):
-               curve = context.curve
                layout = self.layout
+               curve = context.curve
 
                split = layout.split()
        
@@ -85,9 +88,9 @@ class DATA_PT_pathanim(DataButtonsPanel):
        __label__ = "Path Animation"
        
        def draw_header(self, context):
+               layout = self.layout
                curve = context.curve
 
-               layout = self.layout
                layout.itemR(curve, "path", text="")
 
        def draw(self, context):
@@ -110,8 +113,8 @@ class DATA_PT_current_curve(DataButtonsPanel):
        __label__ = "Current Curve"
 
        def draw(self, context):
-               currentcurve = context.curve.curves[0] # XXX
                layout = self.layout
+               currentcurve = context.curve.curves[0] # XXX
 
                split = layout.split()
        
@@ -141,4 +144,4 @@ class DATA_PT_current_curve(DataButtonsPanel):
 bpy.types.register(DATA_PT_shape_curve)
 bpy.types.register(DATA_PT_geometry)
 bpy.types.register(DATA_PT_pathanim)
-bpy.types.register(DATA_PT_current_curve)
+bpy.types.register(DATA_PT_current_curve)
\ No newline at end of file
index 7f994c94a07e28dc70c041b21fe6080c7661d2a9..7eed54d1db6346e5eaa8464a83024c4cb30e7f03 100644 (file)
@@ -7,18 +7,17 @@ class DataButtonsPanel(bpy.types.Panel):
        __context__ = "data"
        
        def poll(self, context):
-               ob = context.object
-               return (ob and ob.type == 'EMPTY')
+               return (context.object.type == 'EMPTY')
        
 class DATA_PT_empty(DataButtonsPanel):
        __idname__ = "DATA_PT_empty"
        __label__ = "Empty"
 
        def draw(self, context):
-               ob = context.object
                layout = self.layout
+               ob = context.object
 
                layout.itemR(ob, "empty_draw_type")
                layout.itemR(ob, "empty_draw_size")
                
-bpy.types.register(DATA_PT_empty)
+bpy.types.register(DATA_PT_empty)
\ No newline at end of file
index f626eb45ed66360f4b94d1688e142e29c69d985f..7328abc7c35f90476cb5c8e3d014f3c185916941 100644 (file)
@@ -22,12 +22,16 @@ class DATA_PT_preview(DataButtonsPanel):
 class DATA_PT_lamp(DataButtonsPanel):
        __idname__ = "DATA_PT_lamp"
        __label__ = "Lamp"
+       
+       def poll(self, context):
+               return (context.object.type == 'LAMP')
 
        def draw(self, context):
+               layout = self.layout
+               
                ob = context.object
                lamp = context.lamp
                space = context.space_data
-               layout = self.layout
 
                split = layout.split(percentage=0.65)
 
@@ -82,8 +86,8 @@ class DATA_PT_sunsky(DataButtonsPanel):
                return (lamp and lamp.type == 'SUN')
 
        def draw(self, context):
-               lamp = context.lamp.sky
                layout = self.layout
+               lamp = context.lamp.sky
 
                row = layout.row()
                row.itemR(lamp, "sky")
@@ -96,7 +100,6 @@ class DATA_PT_sunsky(DataButtonsPanel):
                split = layout.split()
 
                col = split.column()
-               
                sub = col.column()
                sub.active = lamp.sky
                sub.itemR(lamp, "sky_blend_type", text="Blend Type")
@@ -125,8 +128,8 @@ class DATA_PT_shadow(DataButtonsPanel):
                return (lamp and lamp.type in ('POINT','SUN', 'SPOT', 'AREA'))
 
        def draw(self, context):
-               lamp = context.lamp
                layout = self.layout
+               lamp = context.lamp
 
                layout.itemR(lamp, "shadow_method", expand=True)
                
@@ -204,8 +207,8 @@ class DATA_PT_spot(DataButtonsPanel):
                return (lamp and lamp.type == 'SPOT')
 
        def draw(self, context):
-               lamp = context.lamp
                layout = self.layout
+               lamp = context.lamp
 
                split = layout.split()
                
@@ -236,8 +239,8 @@ class DATA_PT_falloff_curve(DataButtonsPanel):
                return False
 
        def draw(self, context):
-               lamp = context.lamp
                layout = self.layout
+               lamp = context.lamp
 
                layout.template_curve_mapping(lamp.falloff_curve)
 
index 8f83cbb45f9a3a391b9fc9b2b6198e51b972eaaa..9382ee3525cb9d5eb57469ef748a367f7b2fa7b1 100644 (file)
@@ -12,12 +12,16 @@ class DataButtonsPanel(bpy.types.Panel):
 class DATA_PT_lattice(DataButtonsPanel):
        __idname__ = "DATA_PT_lattice"
        __label__ = "Lattice"
+       
+       def poll(self, context):
+               return (context.object.type == 'LATTICE')
 
        def draw(self, context):
+               layout = self.layout
+               
                ob = context.object
                lat = context.lattice
                space = context.space_data
-               layout = self.layout
 
                split = layout.split(percentage=0.65)
 
@@ -47,4 +51,4 @@ class DATA_PT_lattice(DataButtonsPanel):
                        row.itemR(lat, "outside")
                        row.itemR(lat, "shape_keys")
 
-bpy.types.register(DATA_PT_lattice)
+bpy.types.register(DATA_PT_lattice)
\ No newline at end of file
index c3742b38cc17ec9834d12a3b687a38b959cf4abb..5e4fb203944c9fd1bc7e0142352e9eeefbe77cb5 100644 (file)
@@ -12,12 +12,16 @@ class DataButtonsPanel(bpy.types.Panel):
 class DATA_PT_mesh(DataButtonsPanel):
        __idname__ = "DATA_PT_mesh"
        __label__ = "Mesh"
+       
+       def poll(self, context):
+               return (context.object.type == 'MESH')
 
        def draw(self, context):
+               layout = self.layout
+               
                ob = context.object
                mesh = context.mesh
                space = context.space_data
-               layout = self.layout
 
                split = layout.split(percentage=0.65)
 
@@ -44,4 +48,4 @@ class DATA_PT_mesh(DataButtonsPanel):
                        
                        layout.itemR(mesh, "texco_mesh")                        
                                        
-bpy.types.register(DATA_PT_mesh)
+bpy.types.register(DATA_PT_mesh)
\ No newline at end of file
index 0f5d446f889b2f788214cb02159d4fb4d70f94dd..adc448b20b5e929b566c4e975a04333a07e1548c 100644 (file)
@@ -5,11 +5,7 @@ class DataButtonsPanel(bpy.types.Panel):
        __space_type__ = "BUTTONS_WINDOW"
        __region_type__ = "WINDOW"
        __context__ = "modifier"
-
-       def poll(self, context):
-               ob = context.object
-               return (ob and ob.type in ('MESH', 'CURVE', 'SURFACE', 'TEXT', 'LATTICE'))
-               
+       
 class DATA_PT_modifiers(DataButtonsPanel):
        __idname__ = "DATA_PT_modifiers"
        __label__ = "Modifiers"
@@ -415,4 +411,4 @@ class DATA_PT_modifiers(DataButtonsPanel):
                col.itemR(md, "width", slider=True)
                col.itemR(md, "narrowness", slider=True)
 
-bpy.types.register(DATA_PT_modifiers)
+bpy.types.register(DATA_PT_modifiers)
\ No newline at end of file
index 20503d8d2fd45d30cfb6c09b085e49679c42c032..d6f6feaa389cac799d07b6493bcea156b52a2fdf 100644 (file)
@@ -7,18 +7,22 @@ class DataButtonsPanel(bpy.types.Panel):
        __context__ = "data"
        
        def poll(self, context):
-               ob = context.object
-               return (ob and ob.type == 'TEXT')
+               return (context.object.type == 'TEXT' and context.curve)
                
 class DATA_PT_shape_text(DataButtonsPanel):
        __idname__ = "DATA_PT_shape_text"
-       __label__ = "Shape"
+       __label__ = "Shape Text"
+       
+       def poll(self, context):
+               ob = context.object
+               return (context.object.type == 'TEXT')
 
        def draw(self, context):
+               layout = self.layout
+               
                ob = context.object
                curve = context.curve
                space = context.space_data
-               layout = self.layout
 
                split = layout.split(percentage=0.65)
 
@@ -59,8 +63,8 @@ class DATA_PT_font(DataButtonsPanel):
        __label__ = "Font"
 
        def draw(self, context):
-               text = context.curve
                layout = self.layout
+               text = context.curve
 
                layout.row()
                layout.itemR(text, "font")
@@ -90,8 +94,8 @@ class DATA_PT_paragraph(DataButtonsPanel):
        __label__ = "Paragraph"
 
        def draw(self, context):
-               text = context.curve
                layout = self.layout
+               text = context.curve
 
                layout.itemL(text="Align:")
                layout.itemR(text, "spacemode", expand=True)
@@ -109,14 +113,16 @@ class DATA_PT_paragraph(DataButtonsPanel):
                sub.itemR(text, "x_offset", text="X")
                sub.itemR(text, "y_offset", text="Y")
                sub.itemR(text, "wrap")
-                       
+
+"""            
 class DATA_PT_textboxes(DataButtonsPanel):
                __idname__ = "DATA_PT_textboxes"
                __label__ = "Text Boxes"
 
                def draw(self, context):
-                       text = context.curve
                        layout = self.layout
+                       text = context.curve
+"""
 
 bpy.types.register(DATA_PT_shape_text) 
 bpy.types.register(DATA_PT_font)
index b9816e36dd78e149703dcb067b13380a49ec8c6c..ca1eba03881a1e891eb654bcb5fca4e7a6bd9ca4 100644 (file)
@@ -13,13 +13,10 @@ class MATERIAL_PT_preview(MaterialButtonsPanel):
        __idname__= "MATERIAL_PT_preview"
        __label__ = "Preview"
 
-       def poll(self, context):
-               return (context.material or context.object)
-
        def draw(self, context):
                layout = self.layout
-
                mat = context.material
+               
                layout.template_preview(mat)
        
 class MATERIAL_PT_material(MaterialButtonsPanel):
@@ -27,10 +24,11 @@ class MATERIAL_PT_material(MaterialButtonsPanel):
        __label__ = "Material"
 
        def poll(self, context):
-               return (context.material or context.object)
+               return (context.object != None)
 
        def draw(self, context):
                layout = self.layout
+               
                mat = context.material
                ob = context.object
                slot = context.material_slot
@@ -56,7 +54,127 @@ class MATERIAL_PT_material(MaterialButtonsPanel):
                        row.column().itemR(mat, "mirror_color")
                        
                        layout.itemR(mat, "alpha", slider=True)
-                       
+
+class MATERIAL_PT_tangent(MaterialButtonsPanel):
+       __idname__= "MATERIAL_PT_tangent"
+       __label__ = "Tangent Shading"
+
+       def draw_header(self, context):
+               layout = self.layout
+               mat = context.material
+               
+               layout.itemR(mat, "tangent_shading", text="",)
+       
+       def draw(self, context):
+               layout = self.layout
+               tan = context.material.strand
+               
+               split = layout.split()
+               
+               sub = split.column()
+               sub.itemL(text="Size:")
+               sub.itemR(tan, "start_size", text="Root")
+               sub.itemR(tan, "end_size", text="Tip")
+               sub.itemR(tan, "min_size", text="Minimum")
+               sub.itemR(tan, "blend_distance")
+               sub.itemR(tan, "blender_units")
+               
+               sub = split.column()
+               sub.itemR(tan, "surface_diffuse")
+               sub.itemR(tan, "shape")
+               sub.itemR(tan, "width_fade")
+               sub.itemR(tan, "uv_layer")
+               
+class MATERIAL_PT_options(MaterialButtonsPanel):
+       __idname__= "MATERIAL_PT_options"
+       __label__ = "Options"
+
+       def draw(self, context):
+               layout = self.layout
+               mat = context.material
+               
+               split = layout.split()
+               
+               sub = split.column()
+               sub.itemR(mat, "traceable")
+               sub.itemR(mat, "full_oversampling")
+               sub.itemR(mat, "sky")
+               sub.itemR(mat, "exclude_mist")
+               sub.itemR(mat, "face_texture")
+               colsub = sub.column()
+               colsub.active = mat.face_texture
+               colsub.itemR(mat, "face_texture_alpha")
+               sub.itemR(mat, "invert_z")
+               sub.itemR(mat, "light_group")
+               sub.itemR(mat, "light_group_exclusive")
+               
+               sub = split.column()
+               sub.itemL(text="Shadows:")
+               sub.itemR(mat, "shadows", text="Recieve")
+               sub.itemR(mat, "only_shadow", text="Render Shadows Only")
+               sub.itemR(mat, "cast_shadows_only", text="Cast Only")
+               sub.itemR(mat, "shadow_casting_alpha", text="Alpha", slider=True)
+               sub.itemR(mat, "transparent_shadows")
+               sub.itemR(mat, "ray_shadow_bias")
+               colsub = sub.column()
+               colsub.active = mat.ray_shadow_bias
+               colsub.itemR(mat, "shadow_ray_bias", text="Raytracing Bias")
+               sub.itemR(mat, "cast_buffer_shadows")
+               colsub = sub.column()
+               colsub.active = mat.cast_buffer_shadows
+               colsub.itemR(mat, "shadow_buffer_bias", text="Buffer Bias")
+
+class MATERIAL_PT_shading(MaterialButtonsPanel):
+       __idname__= "MATERIAL_PT_shading"
+       __label__ = "Shading"
+
+       def poll(self, context):
+               mat = context.material
+               return (mat and mat.type != "HALO")
+
+       def draw(self, context):
+               layout = self.layout
+               mat = context.material
+               
+               row = layout.row()
+               row.itemR(mat, "shadeless")     
+               row.itemR(mat, "wireframe")
+               
+               #Diffuse
+               layout.itemL(text="Diffuse:")
+               layout.itemR(mat, "diffuse_shader", text="Shader")
+               layout.itemR(mat, "diffuse_ramp", text="Ramp")
+               
+               split = layout.split()
+               
+               sub = split.column()
+               sub.itemR(mat, "diffuse_reflection", text="Reflection")
+               sub.itemR(mat, "roughness")
+               sub.itemR(mat, "params1_4")
+               
+               sub = split.column()
+               sub.itemR(mat, "darkness")
+               sub.itemR(mat, "emit")
+               sub.itemR(mat, "ambient", slider=True)
+               sub.itemR(mat, "translucency", slider=True)
+               sub.itemR(mat, "object_color")
+               sub.itemR(mat, "vertex_color_light")
+               sub.itemR(mat, "vertex_color_paint")
+               sub.itemR(mat, "cubic")
+               
+               layout.itemS()
+               
+               #Specular
+               layout.itemL(text="Specular:")
+               layout.itemR(mat, "spec_shader", text="Shader")
+               layout.itemR(mat, "specular_ramp", text="Ramp")
+
+               flow = layout.column_flow()
+               flow.itemR(mat, "specularity", text="Intensity")
+               flow.itemR(mat, "specular_hardness", text="Hardness")
+               flow.itemR(mat, "specular_refraction", text="IOR")
+               flow.itemR(mat, "specular_slope", text="Slope")
+
 class MATERIAL_PT_sss(MaterialButtonsPanel):
        __idname__= "MATERIAL_PT_sss"
        __label__ = "Subsurface Scattering"
@@ -66,9 +184,9 @@ class MATERIAL_PT_sss(MaterialButtonsPanel):
                return (mat and mat.type == "SURFACE")
 
        def draw_header(self, context):
+               layout = self.layout
                sss = context.material.subsurface_scattering
 
-               layout = self.layout
                layout.itemR(sss, "enabled", text="")
        
        def draw(self, context):
@@ -100,15 +218,17 @@ class MATERIAL_PT_raymir(MaterialButtonsPanel):
                return (mat and mat.type == "SURFACE")
        
        def draw_header(self, context):
+               layout = self.layout
                raym = context.material.raytrace_mirror
 
-               layout = self.layout
                layout.itemR(raym, "enabled", text="")
        
        def draw(self, context):
                layout = self.layout
                raym = context.material.raytrace_mirror
-               layout.active = raym.enabled    
+               
+               layout.active = raym.enabled
+               
                split = layout.split()
                
                sub = split.column()
@@ -137,14 +257,15 @@ class MATERIAL_PT_raytransp(MaterialButtonsPanel):
                return (mat and mat.type == "SURFACE")
 
        def draw_header(self, context):
+               layout = self.layout
                rayt = context.material.raytrace_transparency
 
-               layout = self.layout
                layout.itemR(rayt, "enabled", text="")
 
        def draw(self, context):
                layout = self.layout
                rayt = context.material.raytrace_transparency
+               
                layout.active = rayt.enabled    
                
                split = layout.split()
@@ -163,7 +284,7 @@ class MATERIAL_PT_raytransp(MaterialButtonsPanel):
                flow.itemR(rayt, "filter", slider=True)
                flow.itemR(rayt, "limit")
                flow.itemR(rayt, "falloff")
-               flow.itemR(rayt, "specular_opacity", slider=True)
+               flow.itemR(rayt, "specular_opacity", slider=True, text="Spec Opacity")
                flow.itemR(rayt, "depth")
                
 class MATERIAL_PT_halo(MaterialButtonsPanel):
@@ -176,12 +297,13 @@ class MATERIAL_PT_halo(MaterialButtonsPanel):
        
        def draw(self, context):
                layout = self.layout
+               
                mat = context.material
                halo = mat.halo
 
                split = layout.split()
                
-               col = split.column(align=True)
+               col = split.column()
                col.itemL(text="General Settings:")
                col.itemR(halo, "size")
                col.itemR(halo, "hardness")
@@ -219,8 +341,10 @@ class MATERIAL_PT_halo(MaterialButtonsPanel):
 
 bpy.types.register(MATERIAL_PT_preview)
 bpy.types.register(MATERIAL_PT_material)
+bpy.types.register(MATERIAL_PT_shading)
 bpy.types.register(MATERIAL_PT_raymir)
 bpy.types.register(MATERIAL_PT_raytransp)
 bpy.types.register(MATERIAL_PT_sss)
 bpy.types.register(MATERIAL_PT_halo)
-
+bpy.types.register(MATERIAL_PT_tangent)
+bpy.types.register(MATERIAL_PT_options)
\ No newline at end of file
index 6d75146fe5ffb11436e3a30687d9b1dcefb9fbe2..48ab0d2d755e0fadd07c6e0487a285ec69cfd8be 100644 (file)
@@ -6,16 +6,13 @@ class ObjectButtonsPanel(bpy.types.Panel):
        __region_type__ = "WINDOW"
        __context__ = "object"
 
-       def poll(self, context):
-               return (context.object != None)
-
 class OBJECT_PT_transform(ObjectButtonsPanel):
        __idname__ = "OBJECT_PT_transform"
        __label__ = "Transform"
 
        def draw(self, context):
-               ob = context.object
                layout = self.layout
+               ob = context.object
 
                row = layout.row()
                row.column().itemR(ob, "location")
@@ -27,8 +24,8 @@ class OBJECT_PT_groups(ObjectButtonsPanel):
        __label__ = "Groups"
 
        def draw(self, context):
-               ob = context.object
                layout = self.layout
+               ob = context.object
 
                row = layout.row()
                row.itemR(ob, "pass_index")
@@ -54,8 +51,8 @@ class OBJECT_PT_display(ObjectButtonsPanel):
        __label__ = "Display"
 
        def draw(self, context):
-               ob = context.object
                layout = self.layout
+               ob = context.object
                        
                row = layout.row()
                row.itemR(ob, "max_draw_type", text="Type")
@@ -74,8 +71,8 @@ class OBJECT_PT_duplication(ObjectButtonsPanel):
        __label__ = "Duplication"
 
        def draw(self, context):
-               ob = context.object
                layout = self.layout
+               ob = context.object
 
                layout.itemR(ob, "dupli_type", expand=True)
 
@@ -108,8 +105,8 @@ class OBJECT_PT_animation(ObjectButtonsPanel):
        __label__ = "Animation"
 
        def draw(self, context):
-               ob = context.object
                layout = self.layout
+               ob = context.object
                
                split = layout.split()
                
@@ -131,5 +128,4 @@ bpy.types.register(OBJECT_PT_transform)
 bpy.types.register(OBJECT_PT_groups)
 bpy.types.register(OBJECT_PT_display)
 bpy.types.register(OBJECT_PT_duplication)
-bpy.types.register(OBJECT_PT_animation)
-
+bpy.types.register(OBJECT_PT_animation)
\ No newline at end of file
index efa796df5b029d6d2c711656671ad7b19fe5177e..09c21b4eb641d3e5714ce612cdafdd092f990fff 100644 (file)
@@ -15,8 +15,7 @@ class Physic_PT_cloth(PhysicButtonsPanel):
 
        def draw(self, context):
                layout = self.layout
-               md = context.cloth
-               cloth = md.settings
+               cloth = context.cloth.settings
                
                split = layout.split()
                
@@ -51,16 +50,14 @@ class Physic_PT_cloth_collision(PhysicButtonsPanel):
        
        def draw_header(self, context):
                layout = self.layout
-               md = context.cloth
-               cloth = md.collision_settings
+               cloth = context.cloth.settings
        
                layout.itemR(cloth, "enable_collision", text="")
 
        def draw(self, context):
                layout = self.layout
+               cloth = context.cloth.settings
                
-               md = context.cloth
-               cloth = md.collision_settings
                layout.active = cloth.enable_collision  
                
                col = layout.column_flow()
@@ -82,16 +79,14 @@ class Physic_PT_cloth_stiffness(PhysicButtonsPanel):
        
        def draw_header(self, context):
                layout = self.layout
-               md = context.cloth
-               cloth = md.settings
+               cloth = context.cloth.settings
        
                layout.itemR(cloth, "stiffness_scaling", text="")
 
        def draw(self, context):
                layout = self.layout
+               cloth = context.cloth.settings
                
-               md = context.cloth
-               cloth = md.settings
                layout.active = cloth.stiffness_scaling 
                
                split = layout.split()
index 13b7f6a8deebe0432a226659c9ca75c50bcb4c88..1252b9f8c170ea03cc0e34452ca928b1bdd12f8f 100644 (file)
@@ -10,10 +10,8 @@ class RENDER_PT_shading(RenderButtonsPanel):
        __label__ = "Shading"
 
        def draw(self, context):
-               scene = context.scene
                layout = self.layout
-
-               rd = scene.render_data
+               rd = context.scene.render_data
                
                split = layout.split()
                
@@ -34,10 +32,8 @@ class RENDER_PT_output(RenderButtonsPanel):
        __label__ = "Output"
 
        def draw(self, context):
-               scene = context.scene
                layout = self.layout
-
-               rd = scene.render_data
+               rd = context.scene.render_data
                
                layout.itemR(rd, "output_path")
                
@@ -133,16 +129,15 @@ class RENDER_PT_antialiasing(RenderButtonsPanel):
        __label__ = "Anti-Aliasing"
 
        def draw_header(self, context):
+               layout = self.layout
                rd = context.scene.render_data
 
-               layout = self.layout
                layout.itemR(rd, "antialiasing", text="")
 
        def draw(self, context):
-               scene = context.scene
-               rd = scene.render_data
-
                layout = self.layout
+               rd = context.scene.render_data
+
                layout.active = rd.antialiasing
 
                split = layout.split()
@@ -163,10 +158,8 @@ class RENDER_PT_render(RenderButtonsPanel):
        __label__ = "Render"
 
        def draw(self, context):
-               scene = context.scene
                layout = self.layout
-
-               rd = scene.render_data
+               rd = context.scene.render_data
 
                row = layout.row()
                row.itemO("SCREEN_OT_render", text="Render Still", icon=109)
@@ -204,9 +197,9 @@ class RENDER_PT_dimensions(RenderButtonsPanel):
        __label__ = "Dimensions"
 
        def draw(self, context):
-               scene = context.scene
                layout = self.layout
-
+               
+               scene = context.scene
                rd = scene.render_data
                
                split = layout.split()
@@ -248,10 +241,9 @@ class RENDER_PT_stamp(RenderButtonsPanel):
                layout.itemR(rd, "stamp", text="")
 
        def draw(self, context):
-               scene = context.scene
-               rd = scene.render_data
-
                layout = self.layout
+               rd = context.scene.render_data
+
                layout.active = rd.stamp
 
                split = layout.split()
@@ -282,4 +274,4 @@ bpy.types.register(RENDER_PT_dimensions)
 bpy.types.register(RENDER_PT_antialiasing)
 bpy.types.register(RENDER_PT_shading)
 bpy.types.register(RENDER_PT_output)
-bpy.types.register(RENDER_PT_stamp)
+bpy.types.register(RENDER_PT_stamp)
\ No newline at end of file
index 9652a5984dc4b6a339220f057fc92fa18ab193cf..c2829c12926e0c33017d62fb5416bf5bda4495dc 100644 (file)
@@ -7,19 +7,16 @@ class TextureButtonsPanel(bpy.types.Panel):
        __context__ = "texture"
        
        def poll(self, context):
-               return (context.texture != None)
-
+               return (context.texture != None and context.texture.type != 'NONE')
+               
 class TEXTURE_PT_preview(TextureButtonsPanel):
        __idname__= "TEXTURE_PT_preview"
        __label__ = "Preview"
 
-       def poll(self, context):
-               return (context.texture or context.material)
-
        def draw(self, context):
                layout = self.layout
-
                tex = context.texture
+               
                layout.template_preview(tex)
 
 class TEXTURE_PT_texture(TextureButtonsPanel):
@@ -27,10 +24,11 @@ class TEXTURE_PT_texture(TextureButtonsPanel):
        __label__ = "Texture"
 
        def poll(self, context):
-               return (context.texture or context.material or context.world or context.lamp)
+               return (context.material or context.world or context.lamp)
 
        def draw(self, context):
                layout = self.layout
+               
                tex = context.texture
                ma = context.material
                la = context.lamp
@@ -69,9 +67,6 @@ class TEXTURE_PT_texture(TextureButtonsPanel):
 class TEXTURE_PT_mapping(TextureButtonsPanel):
        __idname__= "TEXTURE_PT_mapping"
        __label__ = "Mapping"
-       
-       def poll(self, context):
-               return (context.texture != None and context.texture.type != 'NONE')
 
        def draw(self, context):
                layout = self.layout
@@ -116,12 +111,10 @@ class TEXTURE_PT_mapping(TextureButtonsPanel):
 class TEXTURE_PT_influence(TextureButtonsPanel):
        __idname__= "TEXTURE_PT_influence"
        __label__ = "Influence"
-       
-       def poll(self, context):
-               return (context.texture != None and context.texture.type != 'NONE')
 
        def draw(self, context):
                layout = self.layout
+               
                textype = context.texture
                tex = context.texture_slot
                
@@ -178,9 +171,6 @@ class TEXTURE_PT_influence(TextureButtonsPanel):
 class TEXTURE_PT_colors(TextureButtonsPanel):
        __idname__= "TEXTURE_PT_colors"
        __label__ = "Colors"
-       
-       def poll(self, context):
-               return (context.texture != None and context.texture.type != 'NONE')
 
        def draw(self, context):
                layout = self.layout
index 8298c0c9b13c366ea4fb1e30f540a74c4b73a095..647ef8aa65ed1cd70c5949fb37d9dcd76241e048 100644 (file)
@@ -12,26 +12,24 @@ class WorldButtonsPanel(bpy.types.Panel):
 class WORLD_PT_preview(WorldButtonsPanel):
        __label__ = "Preview"
 
-       def poll(self, context):
-               return (context.scene or context.world)
-
        def draw(self, context):
                layout = self.layout
-
                world = context.world
+               
                layout.template_preview(world)
        
 class WORLD_PT_world(WorldButtonsPanel):
        __label__ = "World"
 
        def poll(self, context):
-               return (context.scene or context.world)
+               return (context.scene != None)
 
        def draw(self, context):
+               layout = self.layout
+               
                scene = context.scene
                world = context.world
                space = context.space_data
-               layout = self.layout
 
                split = layout.split(percentage=0.65)
 
@@ -61,8 +59,8 @@ class WORLD_PT_color_correction(WorldButtonsPanel):
        __label__ = "Color Correction"
 
        def draw(self, context):
-               world = context.world
                layout = self.layout
+               world = context.world
 
                row = layout.row()
                row.itemR(world, "exposure")
@@ -72,14 +70,15 @@ class WORLD_PT_mist(WorldButtonsPanel):
        __label__ = "Mist"
 
        def draw_header(self, context):
+               layout = self.layout
                world = context.world
 
-               layout = self.layout
                layout.itemR(world.mist, "enabled", text="")
 
        def draw(self, context):
-               world = context.world
                layout = self.layout
+               world = context.world
+
                layout.active = world.mist.enabled
 
                flow = layout.column_flow()
@@ -95,14 +94,15 @@ class WORLD_PT_stars(WorldButtonsPanel):
        __label__ = "Stars"
 
        def draw_header(self, context):
+               layout = self.layout
                world = context.world
 
-               layout = self.layout
                layout.itemR(world.stars, "enabled", text="")
 
        def draw(self, context):
-               world = context.world
                layout = self.layout
+               world = context.world
+
                layout.active = world.stars.enabled
 
                flow = layout.column_flow()
@@ -115,24 +115,26 @@ class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
        __label__ = "Ambient Occlusion"
 
        def draw_header(self, context):
+               layout = self.layout
                world = context.world
 
-               layout = self.layout
                layout.itemR(world.ambient_occlusion, "enabled", text="")
 
        def draw(self, context):
-               world = context.world
-               ao = world.ambient_occlusion
                layout = self.layout
+               ao = context.world.ambient_occlusion
+               
                layout.active = ao.enabled
                
                layout.itemR(ao, "gather_method", expand=True)
                
                if ao.gather_method == 'RAYTRACE':
                        split = layout.split()
+                       
                        col = split.column()
                        col.itemR(ao, "samples")
                        col.itemR(ao, "distance")
+                       
                        col = split.column()
                        col.itemR(ao, "falloff")
                        colsub = col.column()
@@ -151,10 +153,12 @@ class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
                                                
                if ao.gather_method == 'APPROXIMATE':
                        split = layout.split()
+                       
                        col = split.column()
                        col.itemR(ao, "passes")
                        col.itemR(ao, "error_tolerance", text="Error")
                        col.itemR(ao, "correction")
+                       
                        col = split.column() 
                        col.itemR(ao, "falloff")
                        colsub = col.column()
@@ -172,4 +176,4 @@ bpy.types.register(WORLD_PT_world)
 bpy.types.register(WORLD_PT_ambient_occlusion)
 bpy.types.register(WORLD_PT_mist)
 bpy.types.register(WORLD_PT_stars)
-bpy.types.register(WORLD_PT_color_correction)
+bpy.types.register(WORLD_PT_color_correction)
\ No newline at end of file
index a5dbb63adf2b03754b1532f5263d3733d7040ca1..780985707833bf54237a0ec26f83a2b9d3d5296e 100644 (file)
@@ -734,13 +734,28 @@ static void rna_def_material_sss(BlenderRNA *brna)
 void rna_def_material_specularity(StructRNA *srna)
 {
        PropertyRNA *prop;
-
+       
+       static EnumPropertyItem prop_spec_shader_items[] = {
+               {MA_SPEC_COOKTORR, "COOKTORR", "CookTorr", ""},
+               {MA_SPEC_PHONG, "PHONG", "Phong", ""},
+               {MA_SPEC_BLINN, "BLINN", "Blinn", ""},
+               {MA_SPEC_TOON, "TOON", "Toon", ""},
+               {MA_SPEC_WARDISO, "WARDISO", "WardIso", ""},
+               {0, NULL, NULL, NULL}};
+       
+       prop= RNA_def_property(srna, "spec_shader", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "spec_shader");
+       RNA_def_property_enum_items(prop, prop_spec_shader_items);
+       RNA_def_property_ui_text(prop, "Specular Shader Model", "");
+       RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
+       
        prop= RNA_def_property(srna, "specularity", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "spec");
        RNA_def_property_range(prop, 0, 1);
        RNA_def_property_ui_text(prop, "Specularity Intensity", "");
 
        /* XXX: this field is also used for Halo hardness. should probably be fixed in DNA */
+       /* I guess it's fine. Specular is disabled when mat type is Halo. --DingTo */
        prop= RNA_def_property(srna, "specular_hardness", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "har");
        RNA_def_property_range(prop, 1, 511);