[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20447] branches/blender2.5/blender/ release/ui/buttons_object_constraint.py: 2. 5 - Constraint Buttons Layout file

Joshua Leung aligorith at gmail.com
Wed May 27 09:28:51 CEST 2009


Revision: 20447
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20447
Author:   aligorith
Date:     2009-05-27 09:28:51 +0200 (Wed, 27 May 2009)

Log Message:
-----------
2.5 - Constraint Buttons Layout file 

Separated out the code for defining the layout for the constraint targets since its practically the same (with a few minor variations) for all of the other constraints.

Modified Paths:
--------------
    branches/blender2.5/blender/release/ui/buttons_object_constraint.py

Modified: branches/blender2.5/blender/release/ui/buttons_object_constraint.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_object_constraint.py	2009-05-27 05:47:51 UTC (rev 20446)
+++ branches/blender2.5/blender/release/ui/buttons_object_constraint.py	2009-05-27 07:28:51 UTC (rev 20447)
@@ -28,18 +28,23 @@
 			if box:
 				if con.type == 'COPY_LOCATION':
 					self.copy_location(box, con)
-							
+					
+	def target_template(self, layout, con, subtargets=True):
+		layout.itemR(con, "target") # XXX limiting settings for only 'curves' or some type of object
+		
+		if con.target and subtargets:
+			if con.target.type == "ARMATURE":
+				layout.itemR(con, "subtarget", text="Bone") # XXX autocomplete
+				
+				row = layout.row()
+				row.itemL(text="Head/Tail:")
+				row.itemR(con, "head_tail", text="")
+			elif con.target.type in ("MESH", "LATTICE"):
+				layout.itemR(con, "subtarget", text="Vertex Group") # XXX autocomplete
+	
 	def copy_location(self, layout, con):
-		layout.itemR(con, "target")
-
-		if con.target and con.target.type == "ARMATURE":
-			layout.itemR(con, "subtarget", text="Bone") # XXX autocomplete
-			row = layout.row()
-			row.itemL(text="Head/Tail:")
-			row.itemR(con, "head_tail", text="")
-		elif con.target and con.target.type == "MESH":
-			layout.itemR(con, "subtarget", text="Vertex Group") # XXX autocomplete
-
+		self.target_template(layout, con)
+		
 		row = layout.row(align=True)
 		row.itemR(con, "locate_like_x", text="X", toggle=True)
 		row.itemR(con, "invert_x", text="-", toggle=True)





More information about the Bf-blender-cvs mailing list