diff options
author | Thomas Dinges <blender@dingto.org> | 2009-07-09 20:09:44 +0400 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2009-07-09 20:09:44 +0400 |
commit | 403dc0f25ad390cd4374f46797d52f9fa1a5b1e2 (patch) | |
tree | 40efdbfb1a58137ecdcc23963cbb6a79b8be9fb7 /release | |
parent | b00409e72d04fe9e710c25fb4f076d1e960328dc (diff) |
2.5 Buttons:
* Fixed some Bugs from Commit 21458.
* Show Preview Render only when there is an active id block.
* Some Code Cleanup (especially in polls). Please try to keep it clean ;-)
Diffstat (limited to 'release')
-rw-r--r-- | release/ui/buttons_data_camera.py | 55 | ||||
-rw-r--r-- | release/ui/buttons_data_lamp.py | 10 | ||||
-rw-r--r-- | release/ui/buttons_data_lattice.py | 30 | ||||
-rw-r--r-- | release/ui/buttons_data_mesh.py | 36 | ||||
-rw-r--r-- | release/ui/buttons_data_text.py | 6 | ||||
-rw-r--r-- | release/ui/buttons_material.py | 8 | ||||
-rw-r--r-- | release/ui/buttons_objects.py | 4 | ||||
-rw-r--r-- | release/ui/buttons_texture.py | 31 | ||||
-rw-r--r-- | release/ui/buttons_world.py | 12 |
9 files changed, 57 insertions, 135 deletions
diff --git a/release/ui/buttons_data_camera.py b/release/ui/buttons_data_camera.py index 197f45f1a0c..b4b53f1c5a1 100644 --- a/release/ui/buttons_data_camera.py +++ b/release/ui/buttons_data_camera.py @@ -14,7 +14,7 @@ class DATA_PT_context_camera(DataButtonsPanel): __label__ = " " def poll(self, context): - return (context.object and context.object.type == 'CAMERA') + return (context.object.type == 'CAMERA') def draw(self, context): layout = self.layout @@ -32,51 +32,44 @@ class DATA_PT_context_camera(DataButtonsPanel): split.template_ID(space, "pin_id") split.itemS() - class DATA_PT_camera(DataButtonsPanel): __idname__ = "DATA_PT_camera" __label__ = "Lens" - - def poll(self, context): - return (context.object and context.object.type == 'CAMERA') def draw(self, context): layout = self.layout - ob = context.object cam = context.camera - space = context.space_data - if cam: - layout.itemS() - layout.itemR(cam, "type", expand=True) + layout.itemS() + layout.itemR(cam, "type", expand=True) - row = layout.row(align=True) - if cam.type == 'PERSP': - row.itemR(cam, "lens_unit", text="") - if cam.lens_unit == 'MILLIMETERS': - row.itemR(cam, "lens", text="Angle") - elif cam.lens_unit == 'DEGREES': - row.itemR(cam, "angle") + row = layout.row(align=True) + if cam.type == 'PERSP': + row.itemR(cam, "lens_unit", text="") + if cam.lens_unit == 'MILLIMETERS': + row.itemR(cam, "lens", text="Angle") + elif cam.lens_unit == 'DEGREES': + row.itemR(cam, "angle") - elif cam.type == 'ORTHO': - row.itemR(cam, "ortho_scale") + elif cam.type == 'ORTHO': + row.itemR(cam, "ortho_scale") - split = layout.split() + split = layout.split() - sub = split.column(align=True) - sub.itemL(text="Shift:") - sub.itemR(cam, "shift_x", text="X") - sub.itemR(cam, "shift_y", text="Y") + sub = split.column(align=True) + sub.itemL(text="Shift:") + sub.itemR(cam, "shift_x", text="X") + sub.itemR(cam, "shift_y", text="Y") - sub = split.column(align=True) - sub.itemL(text="Clipping:") - sub.itemR(cam, "clip_start", text="Start") - sub.itemR(cam, "clip_end", text="End") + sub = split.column(align=True) + sub.itemL(text="Clipping:") + sub.itemR(cam, "clip_start", text="Start") + sub.itemR(cam, "clip_end", text="End") - row = layout.row() - row.itemR(cam, "dof_object") - row.itemR(cam, "dof_distance") + row = layout.row() + row.itemR(cam, "dof_object") + row.itemR(cam, "dof_distance") class DATA_PT_camera_display(DataButtonsPanel): __idname__ = "DATA_PT_camera_display" diff --git a/release/ui/buttons_data_lamp.py b/release/ui/buttons_data_lamp.py index 00d54aa5b70..e6e870bad5d 100644 --- a/release/ui/buttons_data_lamp.py +++ b/release/ui/buttons_data_lamp.py @@ -24,8 +24,8 @@ class DATA_PT_context_lamp(DataButtonsPanel): __label__ = " " def poll(self, context): - return ((context.object and context.object.type == 'LAMP') or context.lamp) - + return (context.object.type == 'LAMP') + def draw(self, context): layout = self.layout @@ -42,20 +42,14 @@ class DATA_PT_context_lamp(DataButtonsPanel): split.template_ID(space, "pin_id") split.itemS() - class DATA_PT_lamp(DataButtonsPanel): __idname__ = "DATA_PT_lamp" __label__ = "Lamp" - - def poll(self, context): - return ((context.object and context.object.type == 'LAMP') or context.lamp) def draw(self, context): layout = self.layout - ob = context.object lamp = context.lamp - space = context.space_data layout.itemR(lamp, "type", expand=True) diff --git a/release/ui/buttons_data_lattice.py b/release/ui/buttons_data_lattice.py index 6636cbf533d..e9c17839abd 100644 --- a/release/ui/buttons_data_lattice.py +++ b/release/ui/buttons_data_lattice.py @@ -36,33 +36,27 @@ class DATA_PT_context_lattice(DataButtonsPanel): class DATA_PT_lattice(DataButtonsPanel): __idname__ = "DATA_PT_lattice" __label__ = "Lattice" - - def poll(self, context): - return (context.object and context.object.type == 'LATTICE') def draw(self, context): layout = self.layout - ob = context.object lat = context.lattice - space = context.space_data - if lat: - row = layout.row() - row.itemR(lat, "points_u") - row.itemR(lat, "interpolation_type_u", expand=True) + row = layout.row() + row.itemR(lat, "points_u") + row.itemR(lat, "interpolation_type_u", expand=True) - row = layout.row() - row.itemR(lat, "points_v") - row.itemR(lat, "interpolation_type_v", expand=True) + row = layout.row() + row.itemR(lat, "points_v") + row.itemR(lat, "interpolation_type_v", expand=True) - row = layout.row() - row.itemR(lat, "points_w") - row.itemR(lat, "interpolation_type_w", expand=True) + row = layout.row() + row.itemR(lat, "points_w") + row.itemR(lat, "interpolation_type_w", expand=True) - row = layout.row() - row.itemO("LATTICE_OT_make_regular") - row.itemR(lat, "outside") + row = layout.row() + row.itemO("LATTICE_OT_make_regular") + row.itemR(lat, "outside") bpy.types.register(DATA_PT_context_lattice) bpy.types.register(DATA_PT_lattice) diff --git a/release/ui/buttons_data_mesh.py b/release/ui/buttons_data_mesh.py index 1f9b958aabb..d8ffac6e859 100644 --- a/release/ui/buttons_data_mesh.py +++ b/release/ui/buttons_data_mesh.py @@ -9,7 +9,6 @@ class DataButtonsPanel(bpy.types.Panel): def poll(self, context): return (context.mesh != None) - class DATA_PT_context_mesh(DataButtonsPanel): __idname__ = "DATA_PT_context_mesh" __label__ = " " @@ -33,38 +32,28 @@ class DATA_PT_context_mesh(DataButtonsPanel): split.template_ID(space, "pin_id") split.itemS() - - - class DATA_PT_mesh(DataButtonsPanel): __idname__ = "DATA_PT_mesh" __label__ = "Mesh" - - def poll(self, context): - return (context.object and context.object.type == 'MESH') def draw(self, context): layout = self.layout - ob = context.object mesh = context.mesh - space = context.space_data - - if mesh: - split = layout.split() - col = split.column() - col.itemR(mesh, "autosmooth") - colsub = col.column() - colsub.active = mesh.autosmooth - colsub.itemR(mesh, "autosmooth_angle", text="Angle") - sub = split.column() - sub.itemR(mesh, "vertex_normal_flip") - sub.itemR(mesh, "double_sided") + split = layout.split() + + col = split.column() + col.itemR(mesh, "autosmooth") + colsub = col.column() + colsub.active = mesh.autosmooth + colsub.itemR(mesh, "autosmooth_angle", text="Angle") + sub = split.column() + sub.itemR(mesh, "vertex_normal_flip") + sub.itemR(mesh, "double_sided") - layout.itemS() - layout.itemR(mesh, "texco_mesh") - + layout.itemS() + layout.itemR(mesh, "texco_mesh") class DATA_PT_materials(DataButtonsPanel): __idname__ = "DATA_PT_materials" @@ -229,4 +218,3 @@ bpy.types.register(DATA_PT_vertex_groups) bpy.types.register(DATA_PT_shape_keys) bpy.types.register(DATA_PT_uv_texture) bpy.types.register(DATA_PT_vertex_colors) - diff --git a/release/ui/buttons_data_text.py b/release/ui/buttons_data_text.py index ee8b0dbd568..b8b0e324609 100644 --- a/release/ui/buttons_data_text.py +++ b/release/ui/buttons_data_text.py @@ -37,10 +37,6 @@ class DATA_PT_context_text(DataButtonsPanel): class DATA_PT_shape_text(DataButtonsPanel): __idname__ = "DATA_PT_shape_text" __label__ = "Shape Text" - - def poll(self, context): - ob = context.object - return (context.object and context.object.type == 'TEXT') def draw(self, context): layout = self.layout @@ -149,7 +145,7 @@ class DATA_PT_paragraph(DataButtonsPanel): sub.itemL(text="Offset:") sub.itemR(text, "x_offset", text="X") sub.itemR(text, "y_offset", text="Y") - sub.itemR(text, "wrap") + #sub.itemR(text, "wrap") """ class DATA_PT_textboxes(DataButtonsPanel): diff --git a/release/ui/buttons_material.py b/release/ui/buttons_material.py index 6cb3da470b6..ede28e6fb54 100644 --- a/release/ui/buttons_material.py +++ b/release/ui/buttons_material.py @@ -13,9 +13,6 @@ class MATERIAL_PT_preview(MaterialButtonsPanel): __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 @@ -27,7 +24,7 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel): __label__ = " " def poll(self, context): - return (context.material or context.material_slot) + return (context.object) def draw(self, context): layout = self.layout @@ -59,9 +56,6 @@ class MATERIAL_PT_material(MaterialButtonsPanel): __idname__= "MATERIAL_PT_material" __label__ = "Material" - def poll(self, context): - return (context.material or context.material_slot) - def draw(self, context): layout = self.layout diff --git a/release/ui/buttons_objects.py b/release/ui/buttons_objects.py index 15fe0378dfd..b993d789ac4 100644 --- a/release/ui/buttons_objects.py +++ b/release/ui/buttons_objects.py @@ -17,9 +17,7 @@ class OBJECT_PT_context_object(ObjectButtonsPanel): split = layout.split(percentage=0.06) split.itemL(text="", icon="ICON_OBJECT_DATA") split.itemR(ob, "name", text="") - - - + class OBJECT_PT_transform(ObjectButtonsPanel): __idname__ = "OBJECT_PT_transform" __label__ = "Transform" diff --git a/release/ui/buttons_texture.py b/release/ui/buttons_texture.py index 4d2db7d36a3..6c3ae9412b7 100644 --- a/release/ui/buttons_texture.py +++ b/release/ui/buttons_texture.py @@ -13,9 +13,6 @@ class TEXTURE_PT_preview(TextureButtonsPanel): __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 @@ -27,7 +24,7 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel): __label__ = " " def poll(self, context): - return (context.material or context.world or context.lamp or context.texture) + return (context.material or context.world or context.lamp) def draw(self, context): layout = self.layout @@ -42,20 +39,15 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel): row = layout.row() if ma: row.template_list(ma, "textures", ma, "active_texture_index") - col = row.column(align=True) - col.itemO("TEXTURE_OT_new", icon="ICON_ZOOMIN", text="") - #col.itemO("OBJECT_OT_material_slot_remove", icon="ICON_ZOOMOUT", text="") elif la: row.template_list(la, "textures", la, "active_texture_index") - col = row.column(align=True) - col.itemO("TEXTURE_OT_new", icon="ICON_ZOOMIN", text="") - #col.itemO("OBJECT_OT_material_slot_remove", icon="ICON_ZOOMOUT", text="") elif wo: row.template_list(wo, "textures", wo, "active_texture_index") + """if ma or la or wo: col = row.column(align=True) col.itemO("TEXTURE_OT_new", icon="ICON_ZOOMIN", text="") #col.itemO("OBJECT_OT_material_slot_remove", icon="ICON_ZOOMOUT", text="") - + """ split = layout.split(percentage=0.65) @@ -65,7 +57,6 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel): else: split.itemS() - elif tex: split.template_ID(space, "pin_id") split.itemS() @@ -79,21 +70,6 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel): col.itemL(text="Type:") col = split.column() col.itemR(tex, "type", text="") - - -class TEXTURE_PT_texture(TextureButtonsPanel): - __idname__= "TEXTURE_PT_texture" - __label__ = "Texture" - - 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 - - class TEXTURE_PT_mapping(TextureButtonsPanel): __idname__= "TEXTURE_PT_mapping" @@ -541,7 +517,6 @@ class TEXTURE_PT_distortednoise(TextureButtonsPanel): bpy.types.register(TEXTURE_PT_context_texture) bpy.types.register(TEXTURE_PT_preview) -bpy.types.register(TEXTURE_PT_texture) bpy.types.register(TEXTURE_PT_clouds) bpy.types.register(TEXTURE_PT_wood) bpy.types.register(TEXTURE_PT_marble) diff --git a/release/ui/buttons_world.py b/release/ui/buttons_world.py index 266e417e492..c93e37a0c6a 100644 --- a/release/ui/buttons_world.py +++ b/release/ui/buttons_world.py @@ -12,9 +12,6 @@ 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 @@ -44,17 +41,10 @@ class WORLD_PT_context_world(WorldButtonsPanel): class WORLD_PT_world(WorldButtonsPanel): __label__ = "World" - def poll(self, context): - return (context.scene != None) - def draw(self, context): layout = self.layout - - scene = context.scene - world = context.world - space = context.space_data - + world = context.world if world: |