[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21948] branches/blender2.5/blender/ release/ui: 2.5 Part 1 of Layout Code Cleanup:

Thomas Dinges dingto at gmx.de
Mon Jul 27 22:39:10 CEST 2009


Revision: 21948
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21948
Author:   dingto
Date:     2009-07-27 22:39:10 +0200 (Mon, 27 Jul 2009)

Log Message:
-----------
2.5 Part 1 of Layout Code Cleanup:

* Again, some layout code cleaning. 
* Made assignments more consistent. 

I started to write code guidelines in the wiki:
http://wiki.blender.org/index.php/LayoutFiles-Code_Guidelines

Matt/William: You are welcome to change them or add new infos, I will continue on improving them as well in the next few days. 

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_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

Modified: branches/blender2.5/blender/release/ui/buttons_data_armature.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_armature.py	2009-07-27 20:13:47 UTC (rev 21947)
+++ branches/blender2.5/blender/release/ui/buttons_data_armature.py	2009-07-27 20:39:10 UTC (rev 21948)
@@ -7,7 +7,7 @@
 	__context__ = "data"
 	
 	def poll(self, context):
-		return (context.armature != None)
+		return (context.armature)
 
 class DATA_PT_context_arm(DataButtonsPanel):
 	__show_header__ = False
@@ -38,43 +38,40 @@
 		arm = context.armature
 		space = context.space_data
 
+		split = layout.split()
 
-		if arm:
-			split = layout.split()
-
-			col = split.column()
-			col.itemR(arm, "rest_position")
-
-			sub = col.column()
-			sub.itemL(text="Deform:")
-			sub.itemR(arm, "deform_vertexgroups", text="Vertes Groups")
-			sub.itemR(arm, "deform_envelope", text="Envelopes")
-			sub.itemR(arm, "deform_quaternion", text="Quaternion")
-			sub.itemR(arm, "deform_bbone_rest", text="B-Bones Rest")
-			#sub.itemR(arm, "x_axis_mirror")
-			#sub.itemR(arm, "auto_ik")
+		col = split.column()
+		col.itemR(arm, "rest_position")
+		col.itemL(text="Deform:")
+		col.itemR(arm, "deform_vertexgroups", text="Vertes Groups")
+		col.itemR(arm, "deform_envelope", text="Envelopes")
+		col.itemR(arm, "deform_quaternion", text="Quaternion")
+		col.itemR(arm, "deform_bbone_rest", text="B-Bones Rest")
+		#col.itemR(arm, "x_axis_mirror")
+		#col.itemR(arm, "auto_ik")
 			
-			sub = split.column()
-			sub.itemL(text="Layers:")
-			sub.template_layers(arm, "layer")
-			sub.itemL(text="Protected Layers:")
-			sub.template_layers(arm, "layer_protection")
+		col = split.column()
+		col.itemL(text="Layers:")
+		col.template_layers(arm, "layer")
+		col.itemL(text="Protected Layers:")
+		col.template_layers(arm, "layer_protection")
 
 class DATA_PT_display(DataButtonsPanel):
 	__label__ = "Display"
 	
 	def draw(self, context):
 		layout = self.layout
+		
 		arm = context.armature
 
 		layout.row().itemR(arm, "drawtype", expand=True)
 
-		sub = layout.column_flow()
-		sub.itemR(arm, "draw_names", text="Names")
-		sub.itemR(arm, "draw_axes", text="Axes")
-		sub.itemR(arm, "draw_custom_bone_shapes", text="Shapes")
-		sub.itemR(arm, "draw_group_colors", text="Colors")
-		sub.itemR(arm, "delay_deform", text="Delay Refresh")
+		flow = layout.column_flow()
+		flow.itemR(arm, "draw_names", text="Names")
+		flow.itemR(arm, "draw_axes", text="Axes")
+		flow.itemR(arm, "draw_custom_bone_shapes", text="Shapes")
+		flow.itemR(arm, "draw_group_colors", text="Colors")
+		flow.itemR(arm, "delay_deform", text="Delay Refresh")
 
 class DATA_PT_bone_groups(DataButtonsPanel):
 	__label__ = "Bone Groups"
@@ -84,11 +81,11 @@
 
 	def draw(self, context):
 		layout = self.layout
+		
 		ob = context.object
 		pose= ob.pose
 		
 		row = layout.row()
-		
 		row.template_list(pose, "bone_groups", pose, "active_bone_group_index")
 		
 		col = row.column(align=True)
@@ -109,7 +106,7 @@
 				split.template_triColorSet(group, "colors")
 		
 		row = layout.row(align=True)
-		row.active= (ob.proxy == None)
+		row.active = (ob.proxy == None)
 		
 		row.itemO("pose.group_assign", text="Assign")
 		row.itemO("pose.group_remove", text="Remove") #row.itemO("pose.bone_group_remove_from", text="Remove")
@@ -121,52 +118,55 @@
 
 	def draw(self, context):
 		layout = self.layout
+		
 		arm = context.armature
 
 		split = layout.split()
 		
-		sub = split.column()
-		sub.itemR(arm, "paths_show_around_current_frame", text="Around Frame")
-		col = sub.column(align=True)
+		col = split.column()
+		col.itemR(arm, "paths_show_around_current_frame", text="Around Frame")
+		
+		sub = col.column(align=True)
 		if (arm.paths_show_around_current_frame):
-			col.itemR(arm, "path_before_current", text="Before")
-			col.itemR(arm, "path_after_current", text="After")
+			sub.itemR(arm, "path_before_current", text="Before")
+			sub.itemR(arm, "path_after_current", text="After")
 		else:
-			col.itemR(arm, "path_start_frame", text="Start")
-			col.itemR(arm, "path_end_frame", text="End")
+			sub.itemR(arm, "path_start_frame", text="Start")
+			sub.itemR(arm, "path_end_frame", text="End")
 
-		col.itemR(arm, "path_size", text="Step")	
-		sub.itemR(arm, "paths_calculate_head_positions", text="Head")
+		sub.itemR(arm, "path_size", text="Step")	
+		col.itemR(arm, "paths_calculate_head_positions", text="Head")
 		
-		sub = split.column()
-		sub.itemL(text="Show:")
-		sub.itemR(arm, "paths_show_frame_numbers", text="Frame Numbers")
-		sub.itemR(arm, "paths_highlight_keyframes", text="Keyframes")
-		sub.itemR(arm, "paths_show_keyframe_numbers", text="Keyframe Numbers")
+		col = split.column()
+		col.itemL(text="Show:")
+		col.itemR(arm, "paths_show_frame_numbers", text="Frame Numbers")
+		col.itemR(arm, "paths_highlight_keyframes", text="Keyframes")
+		col.itemR(arm, "paths_show_keyframe_numbers", text="Keyframe Numbers")
 
 class DATA_PT_ghost(DataButtonsPanel):
 	__label__ = "Ghost"
 
 	def draw(self, context):
 		layout = self.layout
+		
 		arm = context.armature
 
 		split = layout.split()
 
-		sub = split.column()
-		sub.itemR(arm, "ghost_type", text="Scope")
+		col = split.column()
+		col.itemR(arm, "ghost_type", text="Scope")
 
-		col = sub.column(align=True)
+		sub = col.column(align=True)
 		if arm.ghost_type == 'RANGE':
-			col.itemR(arm, "ghost_start_frame", text="Start")
-			col.itemR(arm, "ghost_end_frame", text="End")
-			col.itemR(arm, "ghost_size", text="Step")
+			sub.itemR(arm, "ghost_start_frame", text="Start")
+			sub.itemR(arm, "ghost_end_frame", text="End")
+			sub.itemR(arm, "ghost_size", text="Step")
 		elif arm.ghost_type == 'CURRENT_FRAME':
-			col.itemR(arm, "ghost_step", text="Range")
-			col.itemR(arm, "ghost_size", text="Step")
+			sub.itemR(arm, "ghost_step", text="Range")
+			sub.itemR(arm, "ghost_size", text="Step")
 
-		sub = split.column()
-		sub.itemR(arm, "ghost_only_selected", text="Selected Only")
+		col = split.column()
+		col.itemR(arm, "ghost_only_selected", text="Selected Only")
 
 bpy.types.register(DATA_PT_context_arm)
 bpy.types.register(DATA_PT_skeleton)

Modified: branches/blender2.5/blender/release/ui/buttons_data_bone.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_bone.py	2009-07-27 20:13:47 UTC (rev 21947)
+++ branches/blender2.5/blender/release/ui/buttons_data_bone.py	2009-07-27 20:39:10 UTC (rev 21948)
@@ -14,6 +14,7 @@
 
 	def draw(self, context):
 		layout = self.layout
+		
 		bone = context.bone
 		if not bone:
 			bone = context.edit_bone
@@ -27,9 +28,9 @@
 
 	def draw(self, context):
 		layout = self.layout
+		
 		ob = context.object
 		bone = context.bone
-
 		if not bone:
 			bone = context.edit_bone
 
@@ -43,7 +44,7 @@
 			sub.itemR(bone, "roll", text="")
 			sub.itemL()
 			sub.itemR(bone, "locked")
-			sub.itemS()
+
 		else:
 			pchan = ob.pose.pose_channels[context.bone.name]
 
@@ -70,9 +71,9 @@
 class BONE_PT_bone(BoneButtonsPanel):
 	__label__ = "Bone"
 
-
 	def draw(self, context):
 		layout = self.layout
+		
 		bone = context.bone
 		arm = context.armature
 		if not bone:
@@ -80,29 +81,28 @@
 
 		split = layout.split()
 
-		sub = split.column()
-		sub.itemL(text="Parent:")
+		col = split.column()
+		col.itemL(text="Parent:")
 		if context.bone:
-			sub.itemR(bone, "parent", text="")
+			col.itemR(bone, "parent", text="")
 		else:
-			sub.item_pointerR(bone, "parent", arm, "edit_bones", text="")
-		row = sub.row()
+			col.item_pointerR(bone, "parent", arm, "edit_bones", text="")
+
+		row = col.row()
+		row.active = bone.parent != None
 		row.itemR(bone, "connected")
-		row.active = bone.parent != None
 
-		sub.itemL(text="Layers:")
-		sub.template_layers(bone, "layer")
+		col.itemL(text="Layers:")
+		col.template_layers(bone, "layer")
 
-		sub = split.column()
+		col = split.column()
+		col.itemL(text="Inherit:")
+		col.itemR(bone, "hinge", text="Rotation")
+		col.itemR(bone, "inherit_scale", text="Scale")
+		col.itemL(text="Display:")
+		col.itemR(bone, "draw_wire", text="Wireframe")
+		col.itemR(bone, "hidden", text="Hide")
 
-		sub.itemL(text="Inherit:")
-		sub.itemR(bone, "hinge", text="Rotation")
-		sub.itemR(bone, "inherit_scale", text="Scale")
-		
-		sub.itemL(text="Display:")
-		sub.itemR(bone, "draw_wire", text="Wireframe")
-		sub.itemR(bone, "hidden", text="Hide")
-
 class BONE_PT_inverse_kinematics(BoneButtonsPanel):
 	__label__ = "Inverse Kinematics"
 	__default_closed__ = True
@@ -119,6 +119,7 @@
 
 	def draw(self, context):
 		layout = self.layout
+		
 		ob = context.object
 		bone = context.bone
 		pchan = ob.pose.pose_channels[context.bone.name]
@@ -178,6 +179,7 @@
 
 	def draw_header(self, context):
 		layout = self.layout
+		
 		bone = context.bone
 		if not bone:
 			bone = context.edit_bone
@@ -186,6 +188,7 @@
 
 	def draw(self, context):
 		layout = self.layout
+		
 		bone = context.bone
 		if not bone:
 			bone = context.edit_bone
@@ -196,6 +199,7 @@
 
 		col = split.column()
 		col.itemL(text="Envelope:")
+		
 		sub = col.column(align=True)
 		sub.itemR(bone, "envelope_distance", text="Distance")
 		sub.itemR(bone, "envelope_weight", text="Weight")
@@ -208,6 +212,7 @@
 
 		col = split.column()
 		col.itemL(text="Curved Bones:")
+		
 		sub = col.column(align=True)
 		sub.itemR(bone, "bbone_segments", text="Segments")
 		sub.itemR(bone, "bbone_in", text="Ease In")
@@ -221,4 +226,3 @@
 bpy.types.register(BONE_PT_bone)
 bpy.types.register(BONE_PT_deform)
 bpy.types.register(BONE_PT_inverse_kinematics)
-

Modified: branches/blender2.5/blender/release/ui/buttons_data_camera.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_camera.py	2009-07-27 20:13:47 UTC (rev 21947)
+++ branches/blender2.5/blender/release/ui/buttons_data_camera.py	2009-07-27 20:39:10 UTC (rev 21948)
@@ -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,53 +49,49 @@
 		elif cam.type == 'ORTHO':
 			row.itemR(cam, "ortho_scale")
 
-		split = layout.split()
-		split.itemR(cam, "panorama");
-		split.itemL()
+		layout.itemR(cam, "panorama");
 				
 		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")
+		col = split.column(align=True)

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list