From bf2daa56c1a08f80176f5e817c3bc3c0e5749ba3 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Fri, 8 May 2009 18:17:57 +0000 Subject: 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 --- release/ui/buttons_data_lamp.py | 113 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 release/ui/buttons_data_lamp.py (limited to 'release/ui/buttons_data_lamp.py') diff --git a/release/ui/buttons_data_lamp.py b/release/ui/buttons_data_lamp.py new file mode 100644 index 00000000000..e5747d5097e --- /dev/null +++ b/release/ui/buttons_data_lamp.py @@ -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) -- cgit v1.2.3