[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22924] branches/blender2.5/blender/ release/ui: 2.5: Layout Python Files:

Thomas Dinges dingto at gmx.de
Tue Sep 1 02:33:42 CEST 2009


Revision: 22924
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22924
Author:   dingto
Date:     2009-09-01 02:33:39 +0200 (Tue, 01 Sep 2009)

Log Message:
-----------
2.5: Layout Python Files:
* Code cleanup.
* Made some files match the code guidelines, should be all now.
Please everybody use them: http://wiki.blender.org/index.php/Dev:Py/Blender2.5/Layouts/Guidelines
* Made polls and header_draw functions as small as possible. 

* Small fixes here and there.

Modified Paths:
--------------
    branches/blender2.5/blender/release/ui/buttons_data_armature.py
    branches/blender2.5/blender/release/ui/buttons_data_bone.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_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_modifier.py
    branches/blender2.5/blender/release/ui/buttons_data_text.py
    branches/blender2.5/blender/release/ui/buttons_game.py
    branches/blender2.5/blender/release/ui/buttons_material.py
    branches/blender2.5/blender/release/ui/buttons_physics_cloth.py
    branches/blender2.5/blender/release/ui/buttons_physics_field.py
    branches/blender2.5/blender/release/ui/buttons_physics_smoke.py
    branches/blender2.5/blender/release/ui/buttons_physics_softbody.py
    branches/blender2.5/blender/release/ui/buttons_scene.py
    branches/blender2.5/blender/release/ui/buttons_world.py
    branches/blender2.5/blender/release/ui/space_image.py
    branches/blender2.5/blender/release/ui/space_info.py
    branches/blender2.5/blender/release/ui/space_node.py
    branches/blender2.5/blender/release/ui/space_text.py
    branches/blender2.5/blender/release/ui/space_view3d_toolbar.py

Modified: branches/blender2.5/blender/release/ui/buttons_data_armature.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_armature.py	2009-08-31 23:07:05 UTC (rev 22923)
+++ branches/blender2.5/blender/release/ui/buttons_data_armature.py	2009-09-01 00:33:39 UTC (rev 22924)
@@ -83,7 +83,7 @@
 		layout = self.layout
 		
 		ob = context.object
-		pose= ob.pose
+		pose = ob.pose
 		
 		row = layout.row()
 		row.template_list(pose, "bone_groups", pose, "active_bone_group_index")

Modified: branches/blender2.5/blender/release/ui/buttons_data_bone.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_bone.py	2009-08-31 23:07:05 UTC (rev 22923)
+++ branches/blender2.5/blender/release/ui/buttons_data_bone.py	2009-09-01 00:33:39 UTC (rev 22924)
@@ -77,6 +77,7 @@
 		ob = context.object
 		bone = context.bone
 		arm = context.armature
+		
 		if not bone:
 			bone = context.edit_bone
 		else:
@@ -192,18 +193,18 @@
 	__default_closed__ = True
 
 	def draw_header(self, context):
-		layout = self.layout
+		bone = context.bone
 		
-		bone = context.bone
 		if not bone:
 			bone = context.edit_bone
 			
-		layout.itemR(bone, "deform", text="")
+		self.layout.itemR(bone, "deform", text="")
 
 	def draw(self, context):
 		layout = self.layout
 		
 		bone = context.bone
+		
 		if not bone:
 			bone = context.edit_bone
 	

Modified: branches/blender2.5/blender/release/ui/buttons_data_camera.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_camera.py	2009-08-31 23:07:05 UTC (rev 22923)
+++ branches/blender2.5/blender/release/ui/buttons_data_camera.py	2009-09-01 00:33:39 UTC (rev 22924)
@@ -7,7 +7,7 @@
 	__context__ = "data"
 
 	def poll(self, context):
-		return (context.camera != None)
+		return (context.camera)
 		
 class DATA_PT_context_camera(DataButtonsPanel):
 	__show_header__ = False
@@ -49,7 +49,7 @@
 		elif cam.type == 'ORTHO':
 			row.itemR(cam, "ortho_scale")
 
-		layout.itemR(cam, "panorama");
+		layout.itemR(cam, "panorama")
 				
 		split = layout.split()
 			

Modified: branches/blender2.5/blender/release/ui/buttons_data_curve.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_curve.py	2009-08-31 23:07:05 UTC (rev 22923)
+++ branches/blender2.5/blender/release/ui/buttons_data_curve.py	2009-09-01 00:33:39 UTC (rev 22924)
@@ -38,33 +38,34 @@
 		curve = context.curve
 		space = context.space_data
 
-		if curve:
-			layout.itemR(curve, "curve_2d")			
+		layout.itemR(curve, "curve_2d")			
 							
-			split = layout.split()
+		split = layout.split()
 		
-			col = split.column()
-			colsub = col.column()
-			colsub.active = curve.curve_2d
-			colsub.itemL(text="Caps:")
-			colsub.itemR(curve, "front")
-			colsub.itemR(curve, "back")
+		col = split.column()
+		sub = col.column()
+		sub.active = curve.curve_2d
+		sub.itemL(text="Caps:")
+		sub.itemR(curve, "front")
+		sub.itemR(curve, "back")
 			
-			col.itemL(text="Textures:")
-#			col.itemR(curve, "uv_orco")
-			col.itemR(curve, "auto_texspace")
+		col.itemL(text="Textures:")
+#		col.itemR(curve, "uv_orco")
+		col.itemR(curve, "auto_texspace")
 			
-			sub = split.column()	
-			sub.itemL(text="Resolution:")
-			sub.itemR(curve, "resolution_u", text="Preview U")
-			sub.itemR(curve, "resolution_v", text="Preview V")
-			sub.itemR(curve, "render_resolution_u", text="Render U")
-			sub.itemR(curve, "render_resolution_v", text="Render V")
+		col = split.column()	
+		col.itemL(text="Resolution:")
+		sub = col.column(align=True)
+		sub.itemR(curve, "resolution_u", text="Preview U")
+		sub.itemR(curve, "render_resolution_u", text="Render U")
+		sub = col.column(align=True)
+		sub.itemR(curve, "resolution_v", text="Preview V")
+		sub.itemR(curve, "render_resolution_v", text="Render V")
 
-#			sub.itemL(text="Display:")
-#			sub.itemL(text="HANDLES")
-#			sub.itemL(text="NORMALS")
-#			sub.itemR(curve, "vertex_normal_flip")
+#		col.itemL(text="Display:")
+#		col.itemL(text="HANDLES")
+#		col.itemL(text="NORMALS")
+#		col.itemR(curve, "vertex_normal_flip")
 
 class DATA_PT_geometry_curve(DataButtonsPanel):
 	__label__ = "Geometry "
@@ -76,27 +77,25 @@
 
 		split = layout.split()
 	
-		sub = split.column()
-		sub.itemL(text="Modification:")
-		sub.itemR(curve, "width")
-		sub.itemR(curve, "extrude")
-		sub.itemR(curve, "taper_object", icon='ICON_OUTLINER_OB_CURVE')
+		col = split.column()
+		col.itemL(text="Modification:")
+		col.itemR(curve, "width")
+		col.itemR(curve, "extrude")
+		col.itemR(curve, "taper_object", icon='ICON_OUTLINER_OB_CURVE')
 		
-		sub = split.column()
-		sub.itemL(text="Bevel:")
-		sub.itemR(curve, "bevel_depth", text="Depth")
-		sub.itemR(curve, "bevel_resolution", text="Resolution")
-		sub.itemR(curve, "bevel_object", icon='ICON_OUTLINER_OB_CURVE')
+		col = split.column()
+		col.itemL(text="Bevel:")
+		col.itemR(curve, "bevel_depth", text="Depth")
+		col.itemR(curve, "bevel_resolution", text="Resolution")
+		col.itemR(curve, "bevel_object", icon='ICON_OUTLINER_OB_CURVE')
 	
 class DATA_PT_pathanim(DataButtonsPanel):
 	__label__ = "Path Animation"
 	
 	def draw_header(self, context):
-		layout = self.layout
-		
 		curve = context.curve
 
-		layout.itemR(curve, "path", text="")
+		self.layout.itemR(curve, "path", text="")
 
 	def draw(self, context):
 		layout = self.layout

Modified: branches/blender2.5/blender/release/ui/buttons_data_lamp.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_lamp.py	2009-08-31 23:07:05 UTC (rev 22923)
+++ branches/blender2.5/blender/release/ui/buttons_data_lamp.py	2009-09-01 00:33:39 UTC (rev 22924)
@@ -13,9 +13,7 @@
 	__label__ = "Preview"
 
 	def draw(self, context):
-		layout = self.layout
-
-		layout.template_preview(context.lamp)
+		self.layout.template_preview(context.lamp)
 	
 class DATA_PT_context_lamp(DataButtonsPanel):
 	__show_header__ = False
@@ -69,8 +67,7 @@
 		if lamp.type == 'AREA':
 			col.itemR(lamp, "distance")
 			col.itemR(lamp, "gamma")
-
-			
+	
 		col = split.column()
 		col.itemR(lamp, "negative")
 		col.itemR(lamp, "layer", text="This Layer Only")
@@ -299,18 +296,12 @@
 	def poll(self, context):
 		lamp = context.lamp
 
-		if lamp and lamp.type in ('POINT', 'SPOT'):
-			if lamp.falloff_type == 'CUSTOM_CURVE':
-				return True
+		return (lamp and lamp.type in ('POINT', 'SPOT') and lamp.falloff_type == 'CUSTOM_CURVE')
 
-		return False
-
 	def draw(self, context):
-		layout = self.layout
-		
 		lamp = context.lamp
 
-		layout.template_curve_mapping(lamp.falloff_curve)
+		self.layout.template_curve_mapping(lamp.falloff_curve)
 
 bpy.types.register(DATA_PT_context_lamp)
 bpy.types.register(DATA_PT_preview)

Modified: branches/blender2.5/blender/release/ui/buttons_data_lattice.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_lattice.py	2009-08-31 23:07:05 UTC (rev 22923)
+++ branches/blender2.5/blender/release/ui/buttons_data_lattice.py	2009-09-01 00:33:39 UTC (rev 22924)
@@ -7,7 +7,7 @@
 	__context__ = "data"
 	
 	def poll(self, context):
-		return (context.lattice != None)
+		return (context.lattice)
 	
 class DATA_PT_context_lattice(DataButtonsPanel):
 	__show_header__ = False

Modified: branches/blender2.5/blender/release/ui/buttons_data_mesh.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_mesh.py	2009-08-31 23:07:05 UTC (rev 22923)
+++ branches/blender2.5/blender/release/ui/buttons_data_mesh.py	2009-09-01 00:33:39 UTC (rev 22924)
@@ -7,7 +7,7 @@
 	__context__ = "data"
 	
 	def poll(self, context):
-		return (context.mesh != None)
+		return (context.mesh)
 
 class DATA_PT_context_mesh(DataButtonsPanel):
 	__show_header__ = False

Modified: branches/blender2.5/blender/release/ui/buttons_data_modifier.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_modifier.py	2009-08-31 23:07:05 UTC (rev 22923)
+++ branches/blender2.5/blender/release/ui/buttons_data_modifier.py	2009-09-01 00:33:39 UTC (rev 22924)
@@ -27,6 +27,7 @@
 	# the mt.type enum is (ab)used for a lookup on function names
 	# ...to avoid lengthy if statements
 	# so each type must have a function here.
+
 	def ARMATURE(self, layout, ob, md):
 		layout.itemR(md, "object")
 		

Modified: branches/blender2.5/blender/release/ui/buttons_data_text.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_text.py	2009-08-31 23:07:05 UTC (rev 22923)
+++ branches/blender2.5/blender/release/ui/buttons_data_text.py	2009-09-01 00:33:39 UTC (rev 22924)
@@ -38,29 +38,29 @@
 		curve = context.curve
 		space = context.space_data
 
-		if curve:
-			layout.itemR(curve, "curve_2d")			
+
+		layout.itemR(curve, "curve_2d")			
 							
-			split = layout.split()
+		split = layout.split()
 		
-			col = split.column()
-			col.itemL(text="Caps:")
-			col.itemR(curve, "front")
-			col.itemR(curve, "back")
-			col.itemL(text="Textures:")
-			col.itemR(curve, "uv_orco")
-			col.itemR(curve, "auto_texspace")
+		col = split.column()
+		col.itemL(text="Caps:")
+		col.itemR(curve, "front")
+		col.itemR(curve, "back")
+		col.itemL(text="Textures:")
+		col.itemR(curve, "uv_orco")
+		col.itemR(curve, "auto_texspace")
 			
-			col = split.column()	
-			col.itemL(text="Resolution:")
-			sub = col.column(align=True)
-			sub.itemR(curve, "resolution_u", text="Preview U")
-			sub.itemR(curve, "render_resolution_u", text="Render U")
-			sub = col.column(align=True)
-			sub.itemR(curve, "resolution_v", text="Preview V")
-			sub.itemR(curve, "render_resolution_v", text="Render V")
-			col.itemL(text="Display:")
-			col.itemR(curve, "fast")
+		col = split.column()	
+		col.itemL(text="Resolution:")
+		sub = col.column(align=True)
+		sub.itemR(curve, "resolution_u", text="Preview U")
+		sub.itemR(curve, "render_resolution_u", text="Render U")
+		sub = col.column(align=True)
+		sub.itemR(curve, "resolution_v", text="Preview V")
+		sub.itemR(curve, "render_resolution_v", text="Render V")
+		col.itemL(text="Display:")
+		col.itemR(curve, "fast")
 
 class DATA_PT_geometry_text(DataButtonsPanel):
 	__label__ = "Geometry"


@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list