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

Thomas Dinges dingto at gmx.de
Fri May 8 20:17:57 CEST 2009


Revision: 20107
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20107
Author:   dingto
Date:     2009-05-08 20:17:57 +0200 (Fri, 08 May 2009)

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

* Split the buttons_data.py into separate files, this makes it easier to maintain them. 
Notes: Added an extra modifier file, because modifiers are for different object types.

* Added basic lamp buttons and Sun/Sky settings.
As the camera buttons they only work for the default light object for now.

* Some minor code cleanup

Added Paths:
-----------
    branches/blender2.5/blender/release/ui/buttons_data_camera.py
    branches/blender2.5/blender/release/ui/buttons_data_lamp.py
    branches/blender2.5/blender/release/ui/buttons_data_modifier.py

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

Deleted: branches/blender2.5/blender/release/ui/buttons_data.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data.py	2009-05-08 16:02:58 UTC (rev 20106)
+++ branches/blender2.5/blender/release/ui/buttons_data.py	2009-05-08 18:17:57 UTC (rev 20107)
@@ -1,135 +0,0 @@
-
-import bpy
-
-class DataButtonsPanel(bpy.types.Panel):
-	__space_type__ = "BUTTONS_WINDOW"
-	__region_type__ = "WINDOW"
-	__context__ = "data"
-
-class DATA_PT_modifiers(DataButtonsPanel):
-	__idname__ = "DATA_PT_modifiers"
-	__label__ = "Modifiers"
-	
-	def poll(self, context):
-		ob = context.active_object
-		return (ob and ob.type in ("MESH", "CURVE", "SURFACE", "TEXT", "LATTICE"))
-
-	def draw(self, context):
-		ob = context.active_object
-		layout = self.layout
-
-		if not ob:
-			return
-
-		layout.row()
-		layout.item_menu_enumO("OBJECT_OT_modifier_add", "type")
-
-		for md in ob.modifiers:
-			sub = layout.box()
-
-			sub.row()
-			sub.itemR(md, "expanded", text="")
-			sub.itemR(md, "name", text="")
-
-			sub.itemR(md, "render", text="")
-			sub.itemR(md, "realtime", text="")
-			sub.itemR(md, "editmode", text="")
-			sub.itemR(md, "on_cage", text="")
-
-			if md.expanded:
-				sub.row()
-				sub.itemS()
-
-				if md.type == "ARMATURE":
-					self.armature(sub, md)
-
-	def armature(self, layout, md):
-		layout.column()
-		layout.itemR(md, "object")
-		layout.row()
-		layout.itemR(md, "vertex_group")
-		layout.itemR(md, "invert")
-		layout.column_flow()
-		layout.itemR(md, "use_vertex_groups")
-		layout.itemR(md, "use_bone_envelopes")
-		layout.itemR(md, "quaternion")
-		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()
-		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.column()
-		subsub.itemR(cam, "show_passepartout", text="Passepartout")
-		if (cam.show_passepartout):
-			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)
-

Added: branches/blender2.5/blender/release/ui/buttons_data_camera.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_camera.py	                        (rev 0)
+++ branches/blender2.5/blender/release/ui/buttons_data_camera.py	2009-05-08 18:17:57 UTC (rev 20107)
@@ -0,0 +1,81 @@
+
+import bpy
+
+class DataButtonsPanel(bpy.types.Panel):
+	__space_type__ = "BUTTONS_WINDOW"
+	__region_type__ = "WINDOW"
+	__context__ = "data"
+
+	def poll(self, context):
+		ob = context.active_object
+		return (ob and ob.type == 'CAMERA')
+		
+class DATA_PT_cameralens(DataButtonsPanel):
+	__idname__ = "DATA_PT_camera"
+	__label__ = "Lens"
+
+	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 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()
+		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.column()
+		subsub.itemR(cam, "show_passepartout", text="Passepartout")
+		if (cam.show_passepartout):
+			subsub.itemR(cam, "passepartout_alpha", text="Alpha")
+		sub.row()
+		sub.itemR(cam, "draw_size", text="Size")
+		
+bpy.types.register(DATA_PT_cameralens)
+bpy.types.register(DATA_PT_cameradisplay)
+
+

Added: branches/blender2.5/blender/release/ui/buttons_data_lamp.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_lamp.py	                        (rev 0)
+++ branches/blender2.5/blender/release/ui/buttons_data_lamp.py	2009-05-08 18:17:57 UTC (rev 20107)
@@ -0,0 +1,113 @@
+
+import bpy
+
+class DataButtonsPanel(bpy.types.Panel):
+	__space_type__ = "BUTTONS_WINDOW"
+	__region_type__ = "WINDOW"
+	__context__ = "data"
+	
+	def poll(self, context):
+		ob = context.active_object
+		return (ob and ob.type == "LAMP")
+	
+class DATA_PT_lamp(DataButtonsPanel):
+	__idname__ = "DATA_PT_lamp"
+	__label__ = "Lamp"
+
+	def draw(self, context):
+		lamp = context.main.lamps[0]
+		layout = self.layout
+
+		if not lamp:
+			return
+		
+		layout.row()
+		layout.itemR(lamp, "type", expand=True)
+		
+		layout.split(number=2)
+		
+		sub = layout.sub(0)
+		sub.column()
+		sub.itemL(text="LAMP DATABLOCKS")
+		sub.itemR(lamp, "energy")
+		sub.itemR(lamp, "distance")
+		sub.itemR(lamp, "color")
+	
+		sub = layout.sub(1)
+		
+		sub.column()
+		sub.itemL(text="Illumination:")
+		sub.itemR(lamp, "layer")
+		sub.itemR(lamp, "negative")
+		sub.itemR(lamp, "specular")
+		sub.itemR(lamp, "diffuse")
+		
+		if (lamp.type in ('LOCAL', 'SPOT')):
+			sub.column()
+			sub.itemR(lamp, "falloff_type")
+			sub.itemR(lamp, "sphere")
+			
+			if (lamp.falloff_type == 'LINEAR_QUADRATIC_WEIGHTED'):
+				sub.itemR(lamp, "linear_attenuation")
+				sub.itemR(lamp, "quadratic_attenuation")
+			
+		if (lamp.type == 'AREA'):
+			sub.column()
+			sub.itemR(lamp, "gamma")
+			sub.itemR(lamp, "shape")
+			if (lamp.shape == 'SQUARE'):
+				sub.itemR(lamp, "size")
+			if (lamp.shape == 'RECTANGLE'):
+				sub.itemR(lamp, "size", text="Size X")
+				sub.itemR(lamp, "size_y")
+				
+class DATA_PT_sunsky(DataButtonsPanel):
+	__idname__ = "DATA_PT_sunsky"
+	__label__ = "Sun/Sky"
+	
+	def poll(self, context):
+		ob = context.active_object
+		lamp = context.main.lamps[0]
+		return (ob.type == 'LAMP' and lamp.type == 'SUN')
+
+	def draw(self, context):
+		lamp = context.main.lamps[0].sky
+		layout = self.layout
+
+		if not lamp:
+			return
+		
+		layout.row()
+		layout.itemR(lamp, "sky")
+		layout.itemR(lamp, "atmosphere")
+		
+		if (lamp.sky or lamp.atmosphere):
+			layout.row()
+			layout.itemR(lamp, "atmosphere_turbidity", text="Turbidity")
+			
+			layout.split(number=2)
+			
+			if (lamp.sky):
+				sub = layout.sub(0)
+				sub.column()
+				sub.itemR(lamp, "horizon_brightness", text="Hor Bright")
+				sub.itemR(lamp, "spread", text="Hor Spread")
+				sub.itemR(lamp, "sun_brightness", text="Sun Bright")
+				sub.itemR(lamp, "sun_size")
+				sub.itemR(lamp, "backscattered_light", text="Back Light")
+				sub.column()
+				sub.itemR(lamp, "sky_blend_type", text="Blend Type")
+				sub.itemR(lamp, "sky_blend")
+				sub.itemR(lamp, "sky_color_space", text="Color Space")
+				sub.itemR(lamp, "sky_exposure")
+			
+			if (lamp.atmosphere):
+				sub = layout.sub(1)
+				sub.column()
+				sub.itemR(lamp, "sun_intensity", text="Sun Intens")
+				sub.itemR(lamp, "atmosphere_inscattering", text="Inscattering")
+				sub.itemR(lamp, "atmosphere_extinction", text="Extinction")
+				sub.itemR(lamp, "atmosphere_distance_factor", text="Distance")
+
+bpy.types.register(DATA_PT_lamp)
+bpy.types.register(DATA_PT_sunsky)

Added: branches/blender2.5/blender/release/ui/buttons_data_modifier.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_modifier.py	                        (rev 0)
+++ branches/blender2.5/blender/release/ui/buttons_data_modifier.py	2009-05-08 18:17:57 UTC (rev 20107)
@@ -0,0 +1,61 @@
+
+import bpy
+
+class DataButtonsPanel(bpy.types.Panel):
+	__space_type__ = "BUTTONS_WINDOW"
+	__region_type__ = "WINDOW"
+	__context__ = "data"
+
+	def poll(self, context):
+		ob = context.active_object
+		return (ob and ob.type in ('MESH', 'CURVE', 'SURFACE', 'TEXT', 'LATTICE'))
+		
+class DATA_PT_modifiers(DataButtonsPanel):
+	__idname__ = "DATA_PT_modifiers"
+	__label__ = "Modifiers"
+
+	def draw(self, context):
+		ob = context.active_object
+		layout = self.layout
+
+		if not ob:
+			return
+
+		layout.row()
+		layout.item_menu_enumO("OBJECT_OT_modifier_add", "type")
+
+		for md in ob.modifiers:
+			sub = layout.box()
+
+			sub.row()
+			sub.itemR(md, "expanded", text="")
+			sub.itemR(md, "name", text="")
+

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list