[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20978] branches/blender2.5/blender: UI:
Brecht Van Lommel
brecht at blender.org
Thu Jun 18 16:20:25 CEST 2009
Revision: 20978
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20978
Author: blendix
Date: 2009-06-18 16:20:25 +0200 (Thu, 18 Jun 2009)
Log Message:
-----------
UI:
* Fix context.cloth, was not being set correct.
* Fix errors with context pinning, scripts should
not assume context.object to be there.
* Always show preview even if e.g. the material is not
set, to keep ID buttons from jumping while you're
using them.
Modified Paths:
--------------
branches/blender2.5/blender/release/ui/buttons_data_armature.py
branches/blender2.5/blender/release/ui/buttons_data_camera.py
branches/blender2.5/blender/release/ui/buttons_data_curve.py
branches/blender2.5/blender/release/ui/buttons_data_empty.py
branches/blender2.5/blender/release/ui/buttons_data_lamp.py
branches/blender2.5/blender/release/ui/buttons_data_lattice.py
branches/blender2.5/blender/release/ui/buttons_data_mesh.py
branches/blender2.5/blender/release/ui/buttons_data_text.py
branches/blender2.5/blender/release/ui/buttons_material.py
branches/blender2.5/blender/release/ui/buttons_physic_cloth.py
branches/blender2.5/blender/release/ui/buttons_texture.py
branches/blender2.5/blender/release/ui/buttons_world.py
branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_context.c
Modified: branches/blender2.5/blender/release/ui/buttons_data_armature.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_armature.py 2009-06-18 13:13:37 UTC (rev 20977)
+++ branches/blender2.5/blender/release/ui/buttons_data_armature.py 2009-06-18 14:20:25 UTC (rev 20978)
@@ -14,7 +14,7 @@
__label__ = "Skeleton"
def poll(self, context):
- return (context.object.type == 'ARMATURE' or context.armature)
+ return ((context.object and context.object.type == 'ARMATURE') or context.armature)
def draw(self, context):
layout = self.layout
@@ -127,4 +127,4 @@
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)
Modified: branches/blender2.5/blender/release/ui/buttons_data_camera.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_camera.py 2009-06-18 13:13:37 UTC (rev 20977)
+++ branches/blender2.5/blender/release/ui/buttons_data_camera.py 2009-06-18 14:20:25 UTC (rev 20978)
@@ -14,7 +14,7 @@
__label__ = "Lens"
def poll(self, context):
- return (context.object.type == 'CAMERA')
+ return (context.object and context.object.type == 'CAMERA')
def draw(self, context):
layout = self.layout
@@ -87,4 +87,4 @@
col.itemR(cam, "draw_size", text="Size")
bpy.types.register(DATA_PT_camera)
-bpy.types.register(DATA_PT_camera_display)
\ No newline at end of file
+bpy.types.register(DATA_PT_camera_display)
Modified: branches/blender2.5/blender/release/ui/buttons_data_curve.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_curve.py 2009-06-18 13:13:37 UTC (rev 20977)
+++ branches/blender2.5/blender/release/ui/buttons_data_curve.py 2009-06-18 14:20:25 UTC (rev 20978)
@@ -7,14 +7,14 @@
__context__ = "data"
def poll(self, context):
- return (context.object.type == 'CURVE' and context.curve)
+ return (context.object and 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')
+ return (context.object and context.object.type == 'CURVE')
def draw(self, context):
layout = self.layout
@@ -144,4 +144,4 @@
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)
Modified: branches/blender2.5/blender/release/ui/buttons_data_empty.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_empty.py 2009-06-18 13:13:37 UTC (rev 20977)
+++ branches/blender2.5/blender/release/ui/buttons_data_empty.py 2009-06-18 14:20:25 UTC (rev 20978)
@@ -7,7 +7,7 @@
__context__ = "data"
def poll(self, context):
- return (context.object.type == 'EMPTY')
+ return (context.object and context.object.type == 'EMPTY')
class DATA_PT_empty(DataButtonsPanel):
__idname__ = "DATA_PT_empty"
@@ -20,4 +20,4 @@
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)
Modified: branches/blender2.5/blender/release/ui/buttons_data_lamp.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_lamp.py 2009-06-18 13:13:37 UTC (rev 20977)
+++ branches/blender2.5/blender/release/ui/buttons_data_lamp.py 2009-06-18 14:20:25 UTC (rev 20978)
@@ -24,7 +24,7 @@
__label__ = "Lamp"
def poll(self, context):
- return (context.object.type == 'LAMP')
+ return ((context.object and context.object.type == 'LAMP') or context.lamp)
def draw(self, context):
layout = self.layout
@@ -249,4 +249,4 @@
bpy.types.register(DATA_PT_shadow)
bpy.types.register(DATA_PT_sunsky)
bpy.types.register(DATA_PT_spot)
-bpy.types.register(DATA_PT_falloff_curve)
\ No newline at end of file
+bpy.types.register(DATA_PT_falloff_curve)
Modified: branches/blender2.5/blender/release/ui/buttons_data_lattice.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_lattice.py 2009-06-18 13:13:37 UTC (rev 20977)
+++ branches/blender2.5/blender/release/ui/buttons_data_lattice.py 2009-06-18 14:20:25 UTC (rev 20978)
@@ -14,7 +14,7 @@
__label__ = "Lattice"
def poll(self, context):
- return (context.object.type == 'LATTICE')
+ return (context.object and context.object.type == 'LATTICE')
def draw(self, context):
layout = self.layout
@@ -51,4 +51,4 @@
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)
Modified: branches/blender2.5/blender/release/ui/buttons_data_mesh.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_mesh.py 2009-06-18 13:13:37 UTC (rev 20977)
+++ branches/blender2.5/blender/release/ui/buttons_data_mesh.py 2009-06-18 14:20:25 UTC (rev 20978)
@@ -14,7 +14,7 @@
__label__ = "Mesh"
def poll(self, context):
- return (context.object.type == 'MESH')
+ return (context.object and context.object.type == 'MESH')
def draw(self, context):
layout = self.layout
@@ -48,4 +48,4 @@
layout.itemR(mesh, "texco_mesh")
-bpy.types.register(DATA_PT_mesh)
\ No newline at end of file
+bpy.types.register(DATA_PT_mesh)
Modified: branches/blender2.5/blender/release/ui/buttons_data_text.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_text.py 2009-06-18 13:13:37 UTC (rev 20977)
+++ branches/blender2.5/blender/release/ui/buttons_data_text.py 2009-06-18 14:20:25 UTC (rev 20978)
@@ -7,7 +7,7 @@
__context__ = "data"
def poll(self, context):
- return (context.object.type == 'TEXT' and context.curve)
+ return (context.object and context.object.type == 'TEXT' and context.curve)
class DATA_PT_shape_text(DataButtonsPanel):
__idname__ = "DATA_PT_shape_text"
@@ -15,7 +15,7 @@
def poll(self, context):
ob = context.object
- return (context.object.type == 'TEXT')
+ return (context.object and context.object.type == 'TEXT')
def draw(self, context):
layout = self.layout
Modified: branches/blender2.5/blender/release/ui/buttons_material.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_material.py 2009-06-18 13:13:37 UTC (rev 20977)
+++ branches/blender2.5/blender/release/ui/buttons_material.py 2009-06-18 14:20:25 UTC (rev 20978)
@@ -13,6 +13,9 @@
__idname__= "MATERIAL_PT_preview"
__label__ = "Preview"
+ def poll(self, context):
+ return (context.material or context.material_slot)
+
def draw(self, context):
layout = self.layout
mat = context.material
@@ -24,7 +27,7 @@
__label__ = "Material"
def poll(self, context):
- return (context.object != None)
+ return (context.material or context.material_slot)
def draw(self, context):
layout = self.layout
@@ -419,4 +422,4 @@
bpy.types.register(MATERIAL_PT_sss)
bpy.types.register(MATERIAL_PT_halo)
bpy.types.register(MATERIAL_PT_strand)
-bpy.types.register(MATERIAL_PT_options)
\ No newline at end of file
+bpy.types.register(MATERIAL_PT_options)
Modified: branches/blender2.5/blender/release/ui/buttons_physic_cloth.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_physic_cloth.py 2009-06-18 13:13:37 UTC (rev 20977)
+++ branches/blender2.5/blender/release/ui/buttons_physic_cloth.py 2009-06-18 14:20:25 UTC (rev 20978)
@@ -50,13 +50,13 @@
def draw_header(self, context):
layout = self.layout
- cloth = context.cloth.settings
+ cloth = context.cloth.collision_settings
layout.itemR(cloth, "enable_collision", text="")
def draw(self, context):
layout = self.layout
- cloth = context.cloth.settings
+ cloth = context.cloth.collision_settings
layout.active = cloth.enable_collision
@@ -103,4 +103,4 @@
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)
Modified: branches/blender2.5/blender/release/ui/buttons_texture.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_texture.py 2009-06-18 13:13:37 UTC (rev 20977)
+++ branches/blender2.5/blender/release/ui/buttons_texture.py 2009-06-18 14:20:25 UTC (rev 20978)
@@ -13,6 +13,9 @@
__idname__= "TEXTURE_PT_preview"
__label__ = "Preview"
+ def poll(self, context):
+ return (context.material or context.world or context.lamp or context.texture)
+
def draw(self, context):
layout = self.layout
tex = context.texture
@@ -24,7 +27,7 @@
__label__ = "Texture"
def poll(self, context):
- return (context.material or context.world or context.lamp)
+ return (context.material or context.world or context.lamp or context.texture)
def draw(self, context):
layout = self.layout
Modified: branches/blender2.5/blender/release/ui/buttons_world.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_world.py 2009-06-18 13:13:37 UTC (rev 20977)
+++ branches/blender2.5/blender/release/ui/buttons_world.py 2009-06-18 14:20:25 UTC (rev 20978)
@@ -12,6 +12,9 @@
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
@@ -176,4 +179,4 @@
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)
Modified: branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_context.c
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list