[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20059] branches/blender2.5/blender/ release/ui/buttons_data.py: 2.5 Data Buttons:

Thomas Dinges dingto at gmx.de
Mon May 4 17:53:55 CEST 2009


Revision: 20059
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20059
Author:   dingto
Date:     2009-05-04 17:53:55 +0200 (Mon, 04 May 2009)

Log Message:
-----------
2.5 Data Buttons:

* Added camera buttons.
* Added poll to check on active object type.

ToDo:
* Lens Unit "lens" and "angle" don't update each other. Needs RNA fix. 
* Buttons only work for default camera now, needs better context. 

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

Modified: branches/blender2.5/blender/release/ui/buttons_data.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data.py	2009-05-04 15:31:28 UTC (rev 20058)
+++ branches/blender2.5/blender/release/ui/buttons_data.py	2009-05-04 15:53:55 UTC (rev 20059)
@@ -9,6 +9,10 @@
 class DATA_PT_modifiers(DataButtonsPanel):
 	__idname__ = "DATA_PT_modifiers"
 	__label__ = "Modifiers"
+	
+	def poll(self, context):
+		ob = context.active_object
+		return (ob and ob.type == "MESH")
 
 	def draw(self, context):
 		ob = context.active_object
@@ -52,5 +56,80 @@
 		layout.itemR(md, "b_bone_rest")
 		layout.itemR(md, "multi_modifier")
 
+class DATA_PT_cameralens(DataButtonsPanel):
+	__idname__ = "DATA_PT_camera"
+	__label__ = "Lens"
+	
+	def poll(self, context):
+		ob = context.active_object
+		return (ob and ob.type == "CAMERA")
+
+	def draw(self, context):
+		cam = context.main.cameras[0]
+		layout = self.layout
+
+		if not cam:
+			return
+		
+		layout.row()
+		layout.itemR(cam, "type", expand=True)
+		
+		layout.row()
+		if cam.type == 'PERSP':
+			layout.itemR(cam, "lens_unit")
+			if cam.lens_unit == 'MILLIMETERS':
+				layout.itemR(cam, "lens", text="Angle")
+			if cam.lens_unit == 'DEGREES':
+				layout.itemR(cam, "angle")
+		if cam.type == 'ORTHO':
+			layout.itemR(cam, "ortho_scale")
+		
+		layout.column_flow()
+		layout.itemL(text="Shift:")
+		layout.itemR(cam, "shift_x", text="X")
+		layout.itemR(cam, "shift_y", text="Y")
+		layout.itemL(text="Clipping:")
+		layout.itemR(cam, "clip_start", text="Start")
+		layout.itemR(cam, "clip_end", text="End")
+		
+		layout.row()
+		layout.itemR(cam, "dof_object")
+		layout.itemR(cam, "dof_distance")
+		
+class DATA_PT_cameradisplay(DataButtonsPanel):
+	__idname__ = "DATA_PT_cameradisplay"
+	__label__ = "Display"
+	
+	def poll(self, context):
+		ob = context.active_object
+		return (ob and ob.type == "CAMERA")
+
+	def draw(self, context):
+		cam = context.main.cameras[0]
+		layout = self.layout
+
+		if not cam:
+			return
+			
+		layout.split(number=2)
+		
+		sub = layout.sub(0)
+		sub.column_flow()
+		sub.itemR(cam, "show_limits", text="Limits")
+		sub.itemR(cam, "show_mist", text="Mist")
+		sub.itemR(cam, "show_title_safe", text="Title Safe")
+		sub.itemR(cam, "show_name", text="Name")
+		
+		sub = layout.sub(1)
+		subsub = sub.box()
+		subsub.row()
+		subsub.itemR(cam, "show_passepartout", text="Passepartout")
+		subsub.row()
+		subsub.itemR(cam, "passepartout_alpha", text="Alpha")
+		sub.row()
+		sub.itemR(cam, "draw_size", text="Size")
+		
 bpy.types.register(DATA_PT_modifiers)
+bpy.types.register(DATA_PT_cameralens)
+bpy.types.register(DATA_PT_cameradisplay)
 





More information about the Bf-blender-cvs mailing list