UI:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 3 Jun 2009 00:17:35 +0000 (00:17 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 3 Jun 2009 00:17:35 +0000 (00:17 +0000)
* Add Lamp Fallof Curve and Texture Color Ramp panels.
* Use button space context data.
* A few other minor python layout script updates.

18 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_object_constraint.py
release/ui/buttons_objects.py
release/ui/buttons_particle.py
release/ui/buttons_physic_cloth.py
release/ui/buttons_scene.py
release/ui/buttons_texture.py
release/ui/buttons_world.py

index 1d0043a5179df34c02a996b9a9a98bccb954aaf0..46a077ebfdb7b51db74b616e490040afd52df940 100644 (file)
@@ -7,15 +7,14 @@ class DataButtonsPanel(bpy.types.Panel):
        __context__ = "data"
        
        def poll(self, context):
-               ob = context.active_object
-               return (ob and ob.type == 'ARMATURE')
+               return (context.armature != None)
 
 class DATA_PT_skeleton(DataButtonsPanel):
        __idname__ = "DATA_PT_skeleton"
        __label__ = "Skeleton"
 
        def draw(self, context):
-               arm = context.active_object.data
+               arm = context.armature
                layout = self.layout
                
                layout.itemR(arm, "rest_position")
@@ -42,7 +41,7 @@ class DATA_PT_display(DataButtonsPanel):
        __label__ = "Display"
        
        def draw(self, context):
-               arm = context.active_object.data
+               arm = context.armature
                layout = self.layout
 
                split = layout.split()
@@ -62,7 +61,7 @@ class DATA_PT_paths(DataButtonsPanel):
        __label__ = "Paths"
 
        def draw(self, context):
-               arm = context.active_object.data
+               arm = context.armature
                layout = self.layout
 
                split = layout.split()
@@ -90,7 +89,7 @@ class DATA_PT_ghost(DataButtonsPanel):
        __label__ = "Ghost"
 
        def draw(self, context):
-               arm = context.active_object.data
+               arm = context.armature
                layout = self.layout
 
                split = layout.split()
@@ -111,4 +110,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)
\ No newline at end of file
+bpy.types.register(DATA_PT_ghost)
index a4e0fe4e2fb5caca20b5b7d74bf0692937bc6545..75c201f015e7856175d015570615571f1c675a04 100644 (file)
@@ -7,15 +7,14 @@ class BoneButtonsPanel(bpy.types.Panel):
        __context__ = "bone"
        
        def poll(self, context):
-               ob = context.active_object
-               return (ob and ob.type == 'ARMATURE')
+               return (context.bone != None)
 
 class BONE_PT_bone(BoneButtonsPanel):
        __idname__ = "BONE_PT_bone"
        __label__ = "Bone"
 
        def draw(self, context):
-               bone = context.active_object.data.bones[0]
+               bone = context.bone
                layout = self.layout
 
                split = layout.split()
index d4dabea94803f9a72fd7be994ef8d757ded3fed3..7f3682b1c942545ef0be79a8c3af8b895d3cc648 100644 (file)
@@ -7,15 +7,14 @@ class DataButtonsPanel(bpy.types.Panel):
        __context__ = "data"
 
        def poll(self, context):
-               ob = context.active_object
-               return (ob and ob.type == 'CAMERA')
+               return (context.camera != None)
                
 class DATA_PT_cameralens(DataButtonsPanel):
        __idname__ = "DATA_PT_camera"
        __label__ = "Lens"
 
        def draw(self, context):
-               cam = context.active_object.data
+               cam = context.camera
                layout = self.layout
 
                layout.itemR(cam, "type", expand=True)
@@ -52,7 +51,7 @@ class DATA_PT_cameradisplay(DataButtonsPanel):
        __label__ = "Display"
        
        def draw(self, context):
-               cam = context.active_object.data
+               cam = context.camera
                layout = self.layout
 
                split = layout.split()
@@ -71,4 +70,4 @@ class DATA_PT_cameradisplay(DataButtonsPanel):
                col.itemR(cam, "draw_size", text="Size")
                
 bpy.types.register(DATA_PT_cameralens)
-bpy.types.register(DATA_PT_cameradisplay)
\ No newline at end of file
+bpy.types.register(DATA_PT_cameradisplay)
index 754c26aa3e68067a5df7c5227771be475c4fa3e9..9baee5516bed9c7a4e5599ff334cec3f3d30f1f0 100644 (file)
@@ -7,15 +7,15 @@ class DataButtonsPanel(bpy.types.Panel):
        __context__ = "data"
        
        def poll(self, context):
-               ob = context.active_object
-               return (ob and ob.type == 'CURVE')
+               ob = context.object
+               return (ob and ob.type == 'CURVE' and context.curve)
 
 class DATA_PT_shape_curve(DataButtonsPanel):
                __idname__ = "DATA_PT_shape_curve"
                __label__ = "Shape"
 
                def draw(self, context):
-                       curve = context.active_object.data
+                       curve = context.curve
                        layout = self.layout
 
                        layout.itemR(curve, "curve_2d")                 
@@ -50,7 +50,7 @@ class DATA_PT_geometry(DataButtonsPanel):
                __label__ = "Geometry"
 
                def draw(self, context):
-                       curve = context.active_object.data
+                       curve = context.curve
                        layout = self.layout
 
                        split = layout.split()
@@ -72,13 +72,13 @@ class DATA_PT_pathanim(DataButtonsPanel):
                __label__ = "Path Animation"
                
                def draw_header(self, context):
-                       curve = context.active_object.data
+                       curve = context.curve
 
                        layout = self.layout
                        layout.itemR(curve, "path", text="")
 
                def draw(self, context):
-                       curve = context.active_object.data
+                       curve = context.curve
                        layout = self.layout
                        layout.active = curve.path      
                        
@@ -97,7 +97,7 @@ class DATA_PT_current_curve(DataButtonsPanel):
                __label__ = "Current Curve"
 
                def draw(self, context):
-                       currentcurve = context.active_object.data.curves[0]
+                       currentcurve = context.curve.curves[0] # XXX
                        layout = self.layout
 
                        split = layout.split()
@@ -128,4 +128,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)
\ No newline at end of file
+bpy.types.register(DATA_PT_current_curve)
index 94caa4ed700551f5c800e1456447e3c4d6edab88..7f994c94a07e28dc70c041b21fe6080c7661d2a9 100644 (file)
@@ -7,7 +7,7 @@ class DataButtonsPanel(bpy.types.Panel):
        __context__ = "data"
        
        def poll(self, context):
-               ob = context.active_object
+               ob = context.object
                return (ob and ob.type == 'EMPTY')
        
 class DATA_PT_empty(DataButtonsPanel):
@@ -15,10 +15,10 @@ class DATA_PT_empty(DataButtonsPanel):
        __label__ = "Empty"
 
        def draw(self, context):
-               ob = context.active_object
+               ob = context.object
                layout = self.layout
 
                layout.itemR(ob, "empty_draw_type")
                layout.itemR(ob, "empty_draw_size")
                
-bpy.types.register(DATA_PT_empty)
\ No newline at end of file
+bpy.types.register(DATA_PT_empty)
index a2a6ad0426c5acfde1457c07e65517cd6e3b39e5..86be9cd1a68b5ee600c27db8544eb8029ba941ad 100644 (file)
@@ -7,15 +7,14 @@ class DataButtonsPanel(bpy.types.Panel):
        __context__ = "data"
        
        def poll(self, context):
-               ob = context.active_object
-               return (ob and ob.type == 'LAMP')
+               return (context.lamp != None)
        
 class DATA_PT_lamp(DataButtonsPanel):
        __idname__ = "DATA_PT_lamp"
        __label__ = "Lamp"
 
        def draw(self, context):
-               lamp = context.active_object.data
+               lamp = context.lamp
                layout = self.layout
 
                layout.itemR(lamp, "type", expand=True)
@@ -56,11 +55,11 @@ class DATA_PT_sunsky(DataButtonsPanel):
        __label__ = "Sun/Sky"
        
        def poll(self, context):
-               ob = context.active_object
-               return (ob.type == 'LAMP' and ob.data.type == 'SUN')
+               lamp = context.lamp
+               return (lamp and lamp.type == 'SUN')
 
        def draw(self, context):
-               lamp = context.active_object.data.sky
+               lamp = context.lamp.sky
                layout = self.layout
 
                row = layout.row()
@@ -99,11 +98,11 @@ class DATA_PT_shadow(DataButtonsPanel):
        __label__ = "Shadow"
        
        def poll(self, context):
-               ob = context.active_object
-               return (ob.type == 'LAMP' and ob.data.type in ('POINT','SUN', 'SPOT', 'AREA'))
+               lamp = context.lamp
+               return (lamp and lamp.type in ('POINT','SUN', 'SPOT', 'AREA'))
 
        def draw(self, context):
-               lamp = context.active_object.data
+               lamp = context.lamp
                layout = self.layout
 
                layout.itemR(lamp, "shadow_method", expand=True)
@@ -178,11 +177,11 @@ class DATA_PT_spot(DataButtonsPanel):
        __label__ = "Spot"
        
        def poll(self, context):
-               ob = context.active_object
-               return (ob.type == 'LAMP' and ob.data.type == 'SPOT')
+               lamp = context.lamp
+               return (lamp and lamp.type == 'SPOT')
 
        def draw(self, context):
-               lamp = context.active_object.data
+               lamp = context.lamp
                layout = self.layout
 
                split = layout.split()
@@ -200,7 +199,28 @@ class DATA_PT_spot(DataButtonsPanel):
                if lamp.shadow_method == 'BUFFER_SHADOW':
                        colsub.itemR(lamp, "halo_step", text="Step")
 
+class DATA_PT_falloff_curve(DataButtonsPanel):
+       __idname__ = "DATA_PT_falloff_curve"
+       __label__ = "Falloff Curve"
+       
+       def poll(self, context):
+               lamp = context.lamp
+
+               if lamp and lamp.type in ('POINT', 'SPOT'):
+                       if lamp.falloff_type == 'CUSTOM_CURVE':
+                               return True
+
+               return False
+
+       def draw(self, context):
+               lamp = context.lamp
+               layout = self.layout
+
+               layout.template_curve_mapping(lamp.falloff_curve)
+
 bpy.types.register(DATA_PT_lamp)
 bpy.types.register(DATA_PT_shadow)
 bpy.types.register(DATA_PT_sunsky)
-bpy.types.register(DATA_PT_spot)
\ No newline at end of file
+bpy.types.register(DATA_PT_spot)
+bpy.types.register(DATA_PT_falloff_curve)
+
index 4bcff9f53892f75f0c4ba1d47dc93ae8b9f66a00..6172c255d154c89d21bf82668385c5d7fbf8bb9b 100644 (file)
@@ -7,15 +7,14 @@ class DataButtonsPanel(bpy.types.Panel):
        __context__ = "data"
        
        def poll(self, context):
-               ob = context.active_object
-               return (ob and ob.type == 'LATTICE')
+               return (context.lattice != None)
        
 class DATA_PT_lattice(DataButtonsPanel):
        __idname__ = "DATA_PT_lattice"
        __label__ = "Lattice"
 
        def draw(self, context):
-               lat = context.active_object.data
+               lat = context.lattice
                layout = self.layout
 
                row = layout.row()
@@ -34,4 +33,4 @@ class DATA_PT_lattice(DataButtonsPanel):
                row.itemR(lat, "outside")
                row.itemR(lat, "shape_keys")
 
-bpy.types.register(DATA_PT_lattice)
\ No newline at end of file
+bpy.types.register(DATA_PT_lattice)
index 6e9a30cefbcfc5e6046590b4df0b6c94fbcdc0d9..fceb235343a5471da7c7f4ad3d15b492b9d14773 100644 (file)
@@ -7,15 +7,14 @@ class DataButtonsPanel(bpy.types.Panel):
        __context__ = "data"
        
        def poll(self, context):
-               ob = context.active_object
-               return (ob and ob.type == 'MESH')
+               return (context.mesh != None)
 
 class DATA_PT_surface(DataButtonsPanel):
                __idname__ = "DATA_PT_surface"
                __label__ = "Mesh"
 
                def draw(self, context):
-                       mesh = context.active_object.data
+                       mesh = context.mesh
                        layout = self.layout
 
                        split = layout.split()
@@ -31,4 +30,4 @@ class DATA_PT_surface(DataButtonsPanel):
                        
                        layout.itemR(mesh, "texco_mesh")                        
                                                
-bpy.types.register(DATA_PT_surface)
\ No newline at end of file
+bpy.types.register(DATA_PT_surface)
index c087e5f5e36d627e6347af4ff23df0868e0abf3c..0f5d446f889b2f788214cb02159d4fb4d70f94dd 100644 (file)
@@ -7,7 +7,7 @@ class DataButtonsPanel(bpy.types.Panel):
        __context__ = "modifier"
 
        def poll(self, context):
-               ob = context.active_object
+               ob = context.object
                return (ob and ob.type in ('MESH', 'CURVE', 'SURFACE', 'TEXT', 'LATTICE'))
                
 class DATA_PT_modifiers(DataButtonsPanel):
@@ -15,7 +15,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
        __label__ = "Modifiers"
 
        def draw(self, context):
-               ob = context.active_object
+               ob = context.object
                layout = self.layout
 
                row = layout.row()
@@ -61,7 +61,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
                                if md.type == 'MASK':
                                        self.mask(box, md)
                                if md.type == 'MESH_DEFORM':
-                                       self.meshdeform(box, md)
+                                       self.mesh_deform(box, md)
                                if md.type == 'MIRROR':
                                        self.mirror(box, md)
                                if md.type == 'MULTIRES':
@@ -104,6 +104,8 @@ class DATA_PT_modifiers(DataButtonsPanel):
                        layout.itemR(md, "length")
                if md.fit_type == 'FIT_CURVE':
                        layout.itemR(md, "curve")
+
+               layout.itemS()
                
                split = layout.split()
                
@@ -112,7 +114,10 @@ class DATA_PT_modifiers(DataButtonsPanel):
                col.itemR(md, "constant_offset")
                colsub = col.column()
                colsub.active = md.constant_offset
-               colsub.itemR(md, "constant_offset_displacement", text="Displacement")
+               colsub.itemR(md, "constant_offset_displacement", text="")
+
+               col.itemS()
+
                sub = col.row().itemR(md, "merge_adjacent_vertices", text="Merge")
                colsub = col.column()
                colsub.active = md.merge_adjacent_vertices
@@ -124,12 +129,17 @@ class DATA_PT_modifiers(DataButtonsPanel):
                col.itemR(md, "relative_offset")
                colsub = col.column()
                colsub.active = md.relative_offset
-               colsub.itemR(md, "relative_offset_displacement", text="Displacement")
+               colsub.itemR(md, "relative_offset_displacement", text="")
+
+               col.itemS()
+
                col = col.column()
                col.itemR(md, "add_offset_object")
                colsub = col.column()
                colsub.active = md.add_offset_object
-               colsub.itemR(md, "offset_object")
+               colsub.itemR(md, "offset_object", text="")
+
+               layout.itemS()
                
                col = layout.column()
                col.itemR(md, "start_cap")
@@ -249,13 +259,16 @@ class DATA_PT_modifiers(DataButtonsPanel):
                        layout.itemR(md, "vertex_group")
                layout.itemR(md, "inverse")
                
-       def meshdeform(self, layout, md):
+       def mesh_deform(self, layout, md):
                layout.itemR(md, "object")
                layout.itemR(md, "vertex_group")
                layout.itemR(md, "invert")
-               layout.itemR(md, "precision")
-               layout.itemR(md, "dynamic")
-               # Missing: "Bind"
+
+               layout.itemS()
+               layout.itemO("OBJECT_OT_modifier_mdef_bind", text="Bind")
+               row = layout.row()
+               row.itemR(md, "precision")
+               row.itemR(md, "dynamic")
                
        def mirror(self, layout, md):
                layout.itemR(md, "merge_limit")
@@ -402,4 +415,4 @@ class DATA_PT_modifiers(DataButtonsPanel):
                col.itemR(md, "width", slider=True)
                col.itemR(md, "narrowness", slider=True)
 
-bpy.types.register(DATA_PT_modifiers)
\ No newline at end of file
+bpy.types.register(DATA_PT_modifiers)
index 96147270209dd9bfc56d4428f687e53e95860165..9683dbee22bc84c09b536c1a7c89d59c247677e6 100644 (file)
@@ -7,7 +7,7 @@ class DataButtonsPanel(bpy.types.Panel):
        __context__ = "data"
        
        def poll(self, context):
-               ob = context.active_object
+               ob = context.object
                return (ob and ob.type == 'TEXT')
                
 class DATA_PT_shape_text(DataButtonsPanel):
@@ -15,7 +15,7 @@ class DATA_PT_shape_text(DataButtonsPanel):
                __label__ = "Shape"
 
                def draw(self, context):
-                       curve = context.active_object.data
+                       curve = context.curve
                        layout = self.layout
 
                        layout.itemR(curve, "curve_2d")                 
@@ -46,7 +46,7 @@ class DATA_PT_font(DataButtonsPanel):
        __label__ = "Font"
 
        def draw(self, context):
-               text = context.active_object.data
+               text = context.curve
                layout = self.layout
 
                layout.row()
@@ -77,7 +77,7 @@ class DATA_PT_paragraph(DataButtonsPanel):
        __label__ = "Paragraph"
 
        def draw(self, context):
-               text = context.active_object.data
+               text = context.curve
                layout = self.layout
 
                layout.itemL(text="Align:")
@@ -102,10 +102,10 @@ class DATA_PT_textboxes(DataButtonsPanel):
                __label__ = "Text Boxes"
 
                def draw(self, context):
-                       text = context.active_object.data
+                       text = context.curve
                        layout = self.layout
 
 bpy.types.register(DATA_PT_shape_text) 
 bpy.types.register(DATA_PT_font)
 bpy.types.register(DATA_PT_paragraph)
-#bpy.types.register(DATA_PT_textboxes)
\ No newline at end of file
+#bpy.types.register(DATA_PT_textboxes)
index c9a5fa6db0680e35ca6fd365f854ff6458a618b3..7cffb5b18cf9b11c5e07c6a9d6ca84d7e76dee75 100644 (file)
@@ -7,8 +7,7 @@ class MaterialButtonsPanel(bpy.types.Panel):
        __context__ = "material"
 
        def poll(self, context):
-               ob = context.active_object
-               return (ob and ob.active_material)
+               return (context.material != None)
 
 class MATERIAL_PT_preview(MaterialButtonsPanel):
        __idname__= "MATERIAL_PT_preview"
@@ -17,7 +16,7 @@ class MATERIAL_PT_preview(MaterialButtonsPanel):
        def draw(self, context):
                layout = self.layout
 
-               mat = context.active_object.active_material
+               mat = context.material
                layout.template_preview(mat)
        
 class MATERIAL_PT_material(MaterialButtonsPanel):
@@ -26,7 +25,7 @@ class MATERIAL_PT_material(MaterialButtonsPanel):
 
        def draw(self, context):
                layout = self.layout
-               mat = context.active_object.active_material
+               mat = context.material
        
                layout.itemR(mat, "type", expand=True)
 
@@ -42,18 +41,18 @@ class MATERIAL_PT_sss(MaterialButtonsPanel):
        __label__ = "Subsurface Scattering"
 
        def poll(self, context):
-               ob = context.active_object
-               return (ob and ob.active_material and ob.active_material.type == "SURFACE")
+               mat = context.material
+               return (mat and mat.type == "SURFACE")
 
        def draw_header(self, context):
-               sss = context.active_object.active_material.subsurface_scattering
+               sss = context.material.subsurface_scattering
 
                layout = self.layout
                layout.itemR(sss, "enabled", text="")
        
        def draw(self, context):
                layout = self.layout
-               sss = context.active_object.active_material.subsurface_scattering
+               sss = context.material.subsurface_scattering
                layout.active = sss.enabled     
                
                flow = layout.column_flow()
@@ -76,18 +75,18 @@ class MATERIAL_PT_raymir(MaterialButtonsPanel):
        __label__ = "Ray Mirror"
        
        def poll(self, context):
-               ob = context.active_object
-               return (ob and ob.active_material and ob.active_material.type == "SURFACE")
+               mat = context.material
+               return (mat and mat.type == "SURFACE")
        
        def draw_header(self, context):
-               raym = context.active_object.active_material.raytrace_mirror
+               raym = context.material.raytrace_mirror
 
                layout = self.layout
                layout.itemR(raym, "enabled", text="")
        
        def draw(self, context):
                layout = self.layout
-               raym = context.active_object.active_material.raytrace_mirror
+               raym = context.material.raytrace_mirror
                layout.active = raym.enabled    
                split = layout.split()
                
@@ -113,18 +112,18 @@ class MATERIAL_PT_raytransp(MaterialButtonsPanel):
        __label__= "Ray Transparency"
        
        def poll(self, context):
-               ob = context.active_object
-               return (ob and ob.active_material and ob.active_material.type == "SURFACE")
+               mat = context.material
+               return (mat and mat.type == "SURFACE")
 
        def draw_header(self, context):
-               rayt = context.active_object.active_material.raytrace_transparency
+               rayt = context.material.raytrace_transparency
 
                layout = self.layout
                layout.itemR(rayt, "enabled", text="")
 
        def draw(self, context):
                layout = self.layout
-               rayt = context.active_object.active_material.raytrace_transparency
+               rayt = context.material.raytrace_transparency
                layout.active = rayt.enabled    
                
                split = layout.split()
@@ -151,12 +150,12 @@ class MATERIAL_PT_halo(MaterialButtonsPanel):
        __label__= "Halo"
        
        def poll(self, context):
-               ob = context.active_object
-               return (ob and ob.active_material and ob.active_material.type == "HALO")
+               mat = context.material
+               return (mat and mat.type == "HALO")
        
        def draw(self, context):
                layout = self.layout
-               mat = context.active_object.active_material
+               mat = context.material
                halo = mat.halo
 
                split = layout.split()
@@ -202,4 +201,5 @@ bpy.types.register(MATERIAL_PT_material)
 bpy.types.register(MATERIAL_PT_raymir)
 bpy.types.register(MATERIAL_PT_raytransp)
 bpy.types.register(MATERIAL_PT_sss)
-bpy.types.register(MATERIAL_PT_halo)
\ No newline at end of file
+bpy.types.register(MATERIAL_PT_halo)
+
index 593010128a2d109848a4c43ad91208ca627cdfad..5b32124ff334b5321b7e3b32c79d8f7f3f42eb0d 100644 (file)
@@ -43,8 +43,8 @@ class ConstraintButtonsPanel(bpy.types.Panel):
                                self.stretch_to(box, con)
                        elif con.type == "FLOOR":
                                self.floor(box, con)
-                       #elif con.type == "RIGID_BODY_JOINT":
-                       #       self.rigid_body(box, con)
+                       elif con.type == "RIGID_BODY_JOINT":
+                               self.rigid_body(box, con)
                        elif con.type == "CLAMP_TO":
                                self.clamp_to(box, con)
                        elif con.type == "TRANSFORM":
@@ -512,11 +512,10 @@ class OBJECT_PT_constraints(ConstraintButtonsPanel):
        __context__ = "object"
 
        def poll(self, context):
-               ob = context.active_object
-               return (ob != None)
+               return (context.object != None)
                
        def draw(self, context):
-               ob = context.active_object
+               ob = context.object
                layout = self.layout
 
                row = layout.row()
@@ -532,12 +531,12 @@ class BONE_PT_constraints(ConstraintButtonsPanel):
        __context__ = "bone"
 
        def poll(self, context):
-               ob = context.active_object
+               ob = context.object
                return (ob and ob.type == "ARMATURE")
                
        def draw(self, context):
-               ob = context.active_object
-               pchan = ob.pose.pose_channels[0]
+               ob = context.object
+               pchan = ob.pose.pose_channels[0] # XXX
                layout = self.layout
 
                #row = layout.row()
@@ -548,4 +547,5 @@ class BONE_PT_constraints(ConstraintButtonsPanel):
                        self.draw_constraint(con)
 
 bpy.types.register(OBJECT_PT_constraints)
-bpy.types.register(BONE_PT_constraints)
\ No newline at end of file
+bpy.types.register(BONE_PT_constraints)
+
index a5074614515880906bbba711d7ce492296b6aa14..6d75146fe5ffb11436e3a30687d9b1dcefb9fbe2 100644 (file)
@@ -7,14 +7,14 @@ class ObjectButtonsPanel(bpy.types.Panel):
        __context__ = "object"
 
        def poll(self, context):
-               return (context.active_object != None)
+               return (context.object != None)
 
 class OBJECT_PT_transform(ObjectButtonsPanel):
        __idname__ = "OBJECT_PT_transform"
        __label__ = "Transform"
 
        def draw(self, context):
-               ob = context.active_object
+               ob = context.object
                layout = self.layout
 
                row = layout.row()
@@ -27,7 +27,7 @@ class OBJECT_PT_groups(ObjectButtonsPanel):
        __label__ = "Groups"
 
        def draw(self, context):
-               ob = context.active_object
+               ob = context.object
                layout = self.layout
 
                row = layout.row()
@@ -54,7 +54,7 @@ class OBJECT_PT_display(ObjectButtonsPanel):
        __label__ = "Display"
 
        def draw(self, context):
-               ob = context.active_object
+               ob = context.object
                layout = self.layout
                        
                row = layout.row()
@@ -74,7 +74,7 @@ class OBJECT_PT_duplication(ObjectButtonsPanel):
        __label__ = "Duplication"
 
        def draw(self, context):
-               ob = context.active_object
+               ob = context.object
                layout = self.layout
 
                layout.itemR(ob, "dupli_type", expand=True)
@@ -108,7 +108,7 @@ class OBJECT_PT_animation(ObjectButtonsPanel):
        __label__ = "Animation"
 
        def draw(self, context):
-               ob = context.active_object
+               ob = context.object
                layout = self.layout
                
                split = layout.split()
@@ -132,3 +132,4 @@ bpy.types.register(OBJECT_PT_groups)
 bpy.types.register(OBJECT_PT_display)
 bpy.types.register(OBJECT_PT_duplication)
 bpy.types.register(OBJECT_PT_animation)
+
index 52e20b03538f982cfd97f01019fcdc0b1771ee1d..737aa1a4393b2bb9c1e02a2bf49d12ccabe7d775 100644 (file)
@@ -7,8 +7,7 @@ class ParticleButtonsPanel(bpy.types.Panel):
        __context__ = "particle"
 
        def poll(self, context):
-               ob = context.active_object
-               return (ob and ob.active_particle_system)
+               return (context.particle_system != None)
 
 class PARTICLE_PT_particles(ParticleButtonsPanel):
        __idname__= "PARTICLE_PT_particles"
@@ -17,7 +16,7 @@ class PARTICLE_PT_particles(ParticleButtonsPanel):
        def draw(self, context):
                layout = self.layout
 
-               psys = context.active_object.active_particle_system
+               psys = context.particle_system
                part = psys.settings
 
                layout.itemR(part, "amount")
index 6dab2bcf57c8df41a25d01e7cd4362297fa2433f..1b114871453aac3897802ebe8058d5bd1a3b4e0e 100644 (file)
@@ -6,17 +6,8 @@ class PhysicButtonsPanel(bpy.types.Panel):
        __region_type__ = "WINDOW"
        __context__ = "physics"
 
-       def cloth_modifier(self, context):
-               ob = context.active_object
-               for md in ob.modifiers:
-                       if md.type == 'CLOTH':
-                               return md
-
-               return None
-       
        def poll(self, context):
-               md = self.cloth_modifier(context)
-               return (md != None)
+               return (context.cloth != None)
                
 class Physic_PT_cloth(PhysicButtonsPanel):
        __idname__ = "Physic_PT_cloth"
@@ -24,7 +15,7 @@ class Physic_PT_cloth(PhysicButtonsPanel):
 
        def draw(self, context):
                layout = self.layout
-               md = self.cloth_modifier(context)
+               md = context.cloth
                cloth = md.settings
                
                split = layout.split()
@@ -60,7 +51,7 @@ class Physic_PT_cloth_collision(PhysicButtonsPanel):
        
        def draw_header(self, context):
                layout = self.layout
-               md = self.cloth_modifier(context)                       
+               md = context.cloth
                cloth = md.collision_settings
        
                layout.itemR(cloth, "enable_collision", text="")
@@ -91,7 +82,7 @@ class Physic_PT_cloth_stiffness(PhysicButtonsPanel):
        
        def draw_header(self, context):
                layout = self.layout
-               md = self.cloth_modifier(context)
+               md = context.cloth
                cloth = md.settings
        
                layout.itemR(cloth, "stiffness_scaling", text="")
@@ -99,7 +90,7 @@ class Physic_PT_cloth_stiffness(PhysicButtonsPanel):
        def draw(self, context):
                layout = self.layout
                
-               md = self.cloth_modifier(context)
+               md = context.cloth
                cloth = md.settings
                layout.active = cloth.stiffness_scaling 
                
@@ -117,4 +108,4 @@ class Physic_PT_cloth_stiffness(PhysicButtonsPanel):
                
 bpy.types.register(Physic_PT_cloth)
 bpy.types.register(Physic_PT_cloth_collision)
-bpy.types.register(Physic_PT_cloth_stiffness)
\ No newline at end of file
+bpy.types.register(Physic_PT_cloth_stiffness)
index 561e5b94e3ee17ad0c462866dba7a092653466fe..d7f215f2297e4847ed92bb92d8c8d28ddcd59a65 100644 (file)
@@ -218,4 +218,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)
\ No newline at end of file
+bpy.types.register(RENDER_PT_stamp)
index ccdbda5d54dddeda610ace8dfab840bbf84248dc..7d0ef9371d7563f69bd8c5d46a0438a788bb5d64 100644 (file)
@@ -7,8 +7,7 @@ class TextureButtonsPanel(bpy.types.Panel):
        __context__ = "texture"
        
        def poll(self, context):
-               try:    return (context.active_object.active_material.active_texture.texture != None)
-               except:return False
+               return (context.texture != None)
 
 class TEXTURE_PT_preview(TextureButtonsPanel):
        __idname__= "TEXTURE_PT_preview"
@@ -17,7 +16,7 @@ class TEXTURE_PT_preview(TextureButtonsPanel):
        def draw(self, context):
                layout = self.layout
 
-               tex = context.active_object.active_material.active_texture.texture
+               tex = context.texture
                layout.template_preview(tex)
 
 class TEXTURE_PT_texture(TextureButtonsPanel):
@@ -26,21 +25,38 @@ class TEXTURE_PT_texture(TextureButtonsPanel):
 
        def draw(self, context):
                layout = self.layout
-               tex = context.active_object.active_material.active_texture.texture
+               tex = context.texture
                
                layout.itemR(tex, "type")
 
+class TEXTURE_PT_colors(TextureButtonsPanel):
+       __idname__= "TEXTURE_PT_colors"
+       __label__ = "Colors"
+
+       def draw(self, context):
+               layout = self.layout
+               tex = context.texture
+
+               if tex.color_ramp:
+                       layout.template_color_ramp(tex.color_ramp, expand=True)
+               else:
+                       layout.itemR(tex, "rgb_factor")
+
+               row = layout.row()
+               row.itemR(tex, "brightness")
+               row.itemR(tex, "contrast")
+
 class TEXTURE_PT_clouds(TextureButtonsPanel):
        __idname__= "TEXTURE_PT_clouds"
        __label__ = "Clouds"
        
        def poll(self, context):
-               try:    return (context.active_object.active_material.active_texture.texture.type == 'CLOUDS')
-               except:return False
+               tex = context.texture
+               return (tex and tex.type == 'CLOUDS')
 
        def draw(self, context):
                layout = self.layout
-               tex = context.active_object.active_material.active_texture.texture
+               tex = context.texture
                
                layout.itemR(tex, "stype", expand=True)
                layout.itemL(text="Noise:")
@@ -57,12 +73,12 @@ class TEXTURE_PT_wood(TextureButtonsPanel):
        __label__ = "Wood"
        
        def poll(self, context):
-               try:    return (context.active_object.active_material.active_texture.texture.type == 'WOOD')
-               except:return False
+               tex = context.texture
+               return (tex and tex.type == 'WOOD')
 
        def draw(self, context):
                layout = self.layout
-               tex = context.active_object.active_material.active_texture.texture
+               tex = context.texture
                
                layout.itemR(tex, "stype", expand=True)
                layout.itemR(tex, "noisebasis2", expand=True)
@@ -80,12 +96,12 @@ class TEXTURE_PT_marble(TextureButtonsPanel):
        __label__ = "Marble"
        
        def poll(self, context):
-               try:    return (context.active_object.active_material.active_texture.texture.type == 'MARBLE')
-               except:return False
+               tex = context.texture
+               return (tex and tex.type == 'MARBLE')
 
        def draw(self, context):
                layout = self.layout
-               tex = context.active_object.active_material.active_texture.texture
+               tex = context.texture
                
                layout.itemR(tex, "stype", expand=True)
                layout.itemR(tex, "noisebasis2", expand=True)
@@ -104,12 +120,12 @@ class TEXTURE_PT_magic(TextureButtonsPanel):
        __label__ = "Magic"
        
        def poll(self, context):
-               try:    return (context.active_object.active_material.active_texture.texture.type == 'MAGIC')
-               except:return False
+               tex = context.texture
+               return (tex and tex.type == 'MAGIC')
 
        def draw(self, context):
                layout = self.layout
-               tex = context.active_object.active_material.active_texture.texture
+               tex = context.texture
                        
                row = layout.row()
                row.itemR(tex, "noise_depth", text="Depth")
@@ -120,12 +136,12 @@ class TEXTURE_PT_blend(TextureButtonsPanel):
        __label__ = "Blend"
        
        def poll(self, context):
-               try:    return (context.active_object.active_material.active_texture.texture.type == 'BLEND')
-               except:return False
+               tex = context.texture
+               return (tex and tex.type == 'BLEND')
 
        def draw(self, context):
                layout = self.layout
-               tex = context.active_object.active_material.active_texture.texture
+               tex = context.texture
 
                layout.itemR(tex, "progression")
                layout.itemR(tex, "flip_axis")
@@ -135,12 +151,12 @@ class TEXTURE_PT_stucci(TextureButtonsPanel):
        __label__ = "Stucci"
        
        def poll(self, context):
-               try:    return (context.active_object.active_material.active_texture.texture.type == 'STUCCI')
-               except:return False
+               tex = context.texture
+               return (tex and tex.type == 'STUCCI')
 
        def draw(self, context):
                layout = self.layout
-               tex = context.active_object.active_material.active_texture.texture
+               tex = context.texture
                
                layout.itemR(tex, "stype", expand=True)
                layout.itemL(text="Noise:")
@@ -156,12 +172,12 @@ class TEXTURE_PT_image(TextureButtonsPanel):
        __label__ = "Image/Movie"
        
        def poll(self, context):
-               try:    return (context.active_object.active_material.active_texture.texture.type == 'IMAGE')
-               except:return False
+               tex = context.texture
+               return (tex and tex.type == 'IMAGE')
 
        def draw(self, context):
                layout = self.layout
-               tex = context.active_object.active_material.active_texture.texture
+               tex = context.texture
                
                split = layout.split()
                
@@ -183,12 +199,12 @@ class TEXTURE_PT_mapping(TextureButtonsPanel):
        __label__ = "Mapping"
        
        def poll(self, context):
-               try:    return (context.active_object.active_material.active_texture.texture.type == 'IMAGE')
-               except:return False
+               tex = context.texture
+               return (tex and tex.type == 'IMAGE')
 
        def draw(self, context):
                layout = self.layout
-               tex = context.active_object.active_material.active_texture.texture
+               tex = context.texture
                                
                split = layout.split()
                
@@ -226,12 +242,12 @@ class TEXTURE_PT_plugin(TextureButtonsPanel):
        __label__ = "Plugin"
        
        def poll(self, context):
-               try:    return (context.active_object.active_material.active_texture.texture.type == 'PLUGIN')
-               except:return False
+               tex = context.texture
+               return (tex and tex.type == 'PLUGIN')
 
        def draw(self, context):
                layout = self.layout
-               tex = context.active_object.active_material.active_texture.texture
+               tex = context.texture
                
                layout.itemL(text="Nothing yet")
                
@@ -240,12 +256,12 @@ class TEXTURE_PT_envmap(TextureButtonsPanel):
        __label__ = "Environment Map"
        
        def poll(self, context):
-               try:    return (context.active_object.active_material.active_texture.texture.type == 'ENVIRONMENT_MAP')
-               except:return False
+               tex = context.texture
+               return (tex and tex.type == 'ENVIRONMENT_MAP')
 
        def draw(self, context):
                layout = self.layout
-               tex = context.active_object.active_material.active_texture.texture
+               tex = context.texture
                
                layout.itemL(text="Nothing yet")
                
@@ -254,12 +270,12 @@ class TEXTURE_PT_musgrave(TextureButtonsPanel):
        __label__ = "Musgrave"
        
        def poll(self, context):
-               try:    return (context.active_object.active_material.active_texture.texture.type == 'MUSGRAVE')
-               except:return False
+               tex = context.texture
+               return (tex and tex.type == 'MUSGRAVE')
 
        def draw(self, context):
                layout = self.layout
-               tex = context.active_object.active_material.active_texture.texture
+               tex = context.texture
                
                layout.itemR(tex, "musgrave_type")      
                
@@ -289,13 +305,12 @@ class TEXTURE_PT_voronoi(TextureButtonsPanel):
        __label__ = "Voronoi"
        
        def poll(self, context):
-               try:    return (context.active_object.active_material.active_texture.texture.type == 'VORONOI')
-               except:return False
-
+               tex = context.texture
+               return (tex and tex.type == 'VORONOI')
 
        def draw(self, context):
                layout = self.layout
-               tex = context.active_object.active_material.active_texture.texture
+               tex = context.texture
        
                layout.itemR(tex, "distance_metric")
                layout.itemR(tex, "coloring")
@@ -321,12 +336,12 @@ class TEXTURE_PT_distortednoise(TextureButtonsPanel):
        __label__ = "Distorted Noise"
        
        def poll(self, context):
-               try:    return (context.active_object.active_material.active_texture.texture.type == 'DISTORTED_NOISE')
-               except:return False
+               tex = context.texture
+               return (tex and tex.type == 'DISTORTED_NOISE')
 
        def draw(self, context):
                layout = self.layout
-               tex = context.active_object.active_material.active_texture.texture
+               tex = context.texture
 
                layout.itemR(tex, "noise_distortion")
                layout.itemR(tex, "noise_basis", text="Basis")
@@ -342,6 +357,7 @@ class TEXTURE_PT_distortednoise(TextureButtonsPanel):
 
 bpy.types.register(TEXTURE_PT_preview)
 bpy.types.register(TEXTURE_PT_texture)
+bpy.types.register(TEXTURE_PT_colors)
 bpy.types.register(TEXTURE_PT_clouds)
 bpy.types.register(TEXTURE_PT_wood)
 bpy.types.register(TEXTURE_PT_marble)
index f12a76bfb669a269621dbad24d6780ee401bf044..79826e04dfce4d2539b0592f0b372acbedb14446 100644 (file)
@@ -7,7 +7,7 @@ class WorldButtonsPanel(bpy.types.Panel):
        __context__ = "world"
 
        def poll(self, context):
-               return (context.scene.world != None)
+               return (context.world != None)
 
 class WORLD_PT_preview(WorldButtonsPanel):
        __label__ = "Preview"
@@ -15,14 +15,14 @@ class WORLD_PT_preview(WorldButtonsPanel):
        def draw(self, context):
                layout = self.layout
 
-               world = context.scene.world
+               world = context.world
                layout.template_preview(world)
        
 class WORLD_PT_world(WorldButtonsPanel):
        __label__ = "World"
 
        def draw(self, context):
-               world = context.scene.world
+               world = context.world
                layout = self.layout
                
                row = layout.row()
@@ -32,14 +32,16 @@ class WORLD_PT_world(WorldButtonsPanel):
                
                row = layout.row()
                row.column().itemR(world, "horizon_color")
-               row.column().itemR(world, "zenith_color")
+               col = row.column()
+               col.itemR(world, "zenith_color")
+               col.active = world.blend_sky
                row.column().itemR(world, "ambient_color")
                
 class WORLD_PT_color_correction(WorldButtonsPanel):
        __label__ = "Color Correction"
 
        def draw(self, context):
-               world = context.scene.world
+               world = context.world
                layout = self.layout
 
                row = layout.row()
@@ -50,13 +52,13 @@ class WORLD_PT_mist(WorldButtonsPanel):
        __label__ = "Mist"
 
        def draw_header(self, context):
-               world = context.scene.world
+               world = context.world
 
                layout = self.layout
                layout.itemR(world.mist, "enabled", text="")
 
        def draw(self, context):
-               world = context.scene.world
+               world = context.world
                layout = self.layout
                layout.active = world.mist.enabled
 
@@ -73,13 +75,13 @@ class WORLD_PT_stars(WorldButtonsPanel):
        __label__ = "Stars"
 
        def draw_header(self, context):
-               world = context.scene.world
+               world = context.world
 
                layout = self.layout
                layout.itemR(world.stars, "enabled", text="")
 
        def draw(self, context):
-               world = context.scene.world
+               world = context.world
                layout = self.layout
                layout.active = world.stars.enabled
 
@@ -93,13 +95,13 @@ class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
        __label__ = "Ambient Occlusion"
 
        def draw_header(self, context):
-               world = context.scene.world
+               world = context.world
 
                layout = self.layout
                layout.itemR(world.ambient_occlusion, "enabled", text="")
 
        def draw(self, context):
-               world = context.scene.world
+               world = context.world
                ao = world.ambient_occlusion
                layout = self.layout
                layout.active = ao.enabled
@@ -150,4 +152,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)
\ No newline at end of file
+bpy.types.register(WORLD_PT_color_correction)