blender/release/ui/buttons_data_lamp.py

323 lines
8.4 KiB
Python
Raw Normal View History

import bpy
class DataButtonsPanel(bpy.types.Panel):
__space_type__ = "PROPERTIES"
__region_type__ = "WINDOW"
__context__ = "data"
def poll(self, context):
return (context.lamp)
class DATA_PT_preview(DataButtonsPanel):
__label__ = "Preview"
def draw(self, context):
layout = self.layout
layout.template_preview(context.lamp)
class DATA_PT_context_lamp(DataButtonsPanel):
__show_header__ = False
def draw(self, context):
layout = self.layout
ob = context.object
lamp = context.lamp
space = context.space_data
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.itemS()
elif lamp:
split.template_ID(space, "pin_id")
split.itemS()
class DATA_PT_lamp(DataButtonsPanel):
__label__ = "Lamp"
def draw(self, context):
layout = self.layout
lamp = context.lamp
layout.itemR(lamp, "type", expand=True)
UI: Layout Engine * Buttons are now created first, and after that the layout is computed. This means the layout engine now works at button level, and makes it easier to write templates. Otherwise you had to store all info and create the buttons later. * Added interface_templates.c as a separate file to put templates in. These can contain regular buttons, and can be put in a Free layout, which means you can specify manual coordinates, but still get nested correct inside other layouts. * API was changed to allow better nesting. Previously items were added in the last added layout specifier, i.e. one level up in the layout hierarchy. This doesn't work well in always, so now when creating things like rows or columns it always returns a layout which you have to add the items in. All py scripts were updated to follow this. * Computing the layout now goes in two passes, first estimating the required width/height of all nested layouts, and then in the second pass using the results of that to decide on the actual locations. * Enum and array buttons now follow the direction of the layout, i.e. they are vertical or horizontal depending if they are in a column or row. * Color properties now get a color picker, and only get the additional RGB sliders with Expand=True. * File/directory string properties now get a button next to them for opening the file browse, though this is not implemented yet. * Layout items can now be aligned, set align=True when creating a column, row, etc. * Buttons now get a minimum width of one icon (avoids squashing icon buttons). * Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
split = layout.split()
col = split.column()
sub = col.column()
sub.itemR(lamp, "color", text="")
sub.itemR(lamp, "energy")
UI: Layout Engine * Buttons are now created first, and after that the layout is computed. This means the layout engine now works at button level, and makes it easier to write templates. Otherwise you had to store all info and create the buttons later. * Added interface_templates.c as a separate file to put templates in. These can contain regular buttons, and can be put in a Free layout, which means you can specify manual coordinates, but still get nested correct inside other layouts. * API was changed to allow better nesting. Previously items were added in the last added layout specifier, i.e. one level up in the layout hierarchy. This doesn't work well in always, so now when creating things like rows or columns it always returns a layout which you have to add the items in. All py scripts were updated to follow this. * Computing the layout now goes in two passes, first estimating the required width/height of all nested layouts, and then in the second pass using the results of that to decide on the actual locations. * Enum and array buttons now follow the direction of the layout, i.e. they are vertical or horizontal depending if they are in a column or row. * Color properties now get a color picker, and only get the additional RGB sliders with Expand=True. * File/directory string properties now get a button next to them for opening the file browse, though this is not implemented yet. * Layout items can now be aligned, set align=True when creating a column, row, etc. * Buttons now get a minimum width of one icon (avoids squashing icon buttons). * Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
if lamp.type in ('POINT', 'SPOT'):
sub.itemL(text="Falloff:")
sub.itemR(lamp, "falloff_type", text="")
sub.itemR(lamp, "distance")
if lamp.falloff_type == 'LINEAR_QUADRATIC_WEIGHTED':
2009-07-29 14:17:15 +00:00
col.itemL(text="Attenuation Factors:")
sub = col.column(align=True)
sub.itemR(lamp, "linear_attenuation", slider=True, text="Linear")
sub.itemR(lamp, "quadratic_attenuation", slider=True, text="Quadratic")
2009-07-29 14:17:15 +00:00
col.itemR(lamp, "sphere")
UI: Layout Engine * Buttons are now created first, and after that the layout is computed. This means the layout engine now works at button level, and makes it easier to write templates. Otherwise you had to store all info and create the buttons later. * Added interface_templates.c as a separate file to put templates in. These can contain regular buttons, and can be put in a Free layout, which means you can specify manual coordinates, but still get nested correct inside other layouts. * API was changed to allow better nesting. Previously items were added in the last added layout specifier, i.e. one level up in the layout hierarchy. This doesn't work well in always, so now when creating things like rows or columns it always returns a layout which you have to add the items in. All py scripts were updated to follow this. * Computing the layout now goes in two passes, first estimating the required width/height of all nested layouts, and then in the second pass using the results of that to decide on the actual locations. * Enum and array buttons now follow the direction of the layout, i.e. they are vertical or horizontal depending if they are in a column or row. * Color properties now get a color picker, and only get the additional RGB sliders with Expand=True. * File/directory string properties now get a button next to them for opening the file browse, though this is not implemented yet. * Layout items can now be aligned, set align=True when creating a column, row, etc. * Buttons now get a minimum width of one icon (avoids squashing icon buttons). * Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
if lamp.type == 'AREA':
2009-07-29 14:17:15 +00:00
col.itemR(lamp, "distance")
col.itemR(lamp, "gamma")
2009-07-29 14:17:15 +00:00
col = split.column()
col.itemR(lamp, "negative")
col.itemR(lamp, "layer", text="This Layer Only")
col.itemR(lamp, "specular")
col.itemR(lamp, "diffuse")
class DATA_PT_sunsky(DataButtonsPanel):
__label__ = "Sun/Sky"
def poll(self, context):
lamp = context.lamp
return (lamp and lamp.type == 'SUN')
def draw(self, context):
layout = self.layout
lamp = context.lamp.sky
row = layout.row()
row.itemR(lamp, "sky")
row.itemR(lamp, "atmosphere")
row = layout.row()
row.active = lamp.sky or lamp.atmosphere
row.itemR(lamp, "atmosphere_turbidity", text="Turbidity")
split = layout.split()
col = split.column()
col.active = lamp.sky
col.itemL(text="Blend Mode:")
sub = col.column(align=True)
sub.itemR(lamp, "sky_blend_type", text="")
sub.itemR(lamp, "sky_blend", text="Factor")
col.itemL(text="Color Space:")
sub = col.column(align=True)
sub.itemR(lamp, "sky_color_space", text="")
sub.itemR(lamp, "sky_exposure", text="Exposure")
col = split.column()
col.active = lamp.sky
col.itemL(text="Horizon:")
sub = col.column(align=True)
sub.itemR(lamp, "horizon_brightness", text="Brightness")
sub.itemR(lamp, "spread", text="Spread")
col.itemL(text="Sun:")
sub = col.column(align=True)
sub.itemR(lamp, "sun_brightness", text="Brightness")
sub.itemR(lamp, "sun_size", text="Size")
sub.itemR(lamp, "backscattered_light", slider=True,text="Back Light")
layout.itemS()
split = layout.split()
col = split.column()
col.active = lamp.atmosphere
col.itemL(text="Sun:")
col.itemR(lamp, "sun_intensity", text="Intensity")
col.itemL(text="Scale Distance:")
col.itemR(lamp, "atmosphere_distance_factor", text="Distance")
col = split.column()
col.active = lamp.atmosphere
col.itemL(text="Scattering:")
sub = col.column(align=True)
sub.itemR(lamp, "atmosphere_inscattering", slider=True, text="Inscattering")
sub.itemR(lamp, "atmosphere_extinction", slider=True ,text="Extinction")
class DATA_PT_shadow(DataButtonsPanel):
__label__ = "Shadow"
def poll(self, context):
lamp = context.lamp
return (lamp and lamp.type in ('POINT','SUN', 'SPOT', 'AREA'))
def draw(self, context):
layout = self.layout
lamp = context.lamp
layout.itemR(lamp, "shadow_method", expand=True)
if lamp.shadow_method != 'NOSHADOW':
UI: Layout Engine * Buttons are now created first, and after that the layout is computed. This means the layout engine now works at button level, and makes it easier to write templates. Otherwise you had to store all info and create the buttons later. * Added interface_templates.c as a separate file to put templates in. These can contain regular buttons, and can be put in a Free layout, which means you can specify manual coordinates, but still get nested correct inside other layouts. * API was changed to allow better nesting. Previously items were added in the last added layout specifier, i.e. one level up in the layout hierarchy. This doesn't work well in always, so now when creating things like rows or columns it always returns a layout which you have to add the items in. All py scripts were updated to follow this. * Computing the layout now goes in two passes, first estimating the required width/height of all nested layouts, and then in the second pass using the results of that to decide on the actual locations. * Enum and array buttons now follow the direction of the layout, i.e. they are vertical or horizontal depending if they are in a column or row. * Color properties now get a color picker, and only get the additional RGB sliders with Expand=True. * File/directory string properties now get a button next to them for opening the file browse, though this is not implemented yet. * Layout items can now be aligned, set align=True when creating a column, row, etc. * Buttons now get a minimum width of one icon (avoids squashing icon buttons). * Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
split = layout.split()
col = split.column()
col.itemR(lamp, "shadow_color", text="")
col = split.column()
col.itemR(lamp, "shadow_layer", text="This Layer Only")
col.itemR(lamp, "only_shadow")
UI: Layout Engine * Buttons are now created first, and after that the layout is computed. This means the layout engine now works at button level, and makes it easier to write templates. Otherwise you had to store all info and create the buttons later. * Added interface_templates.c as a separate file to put templates in. These can contain regular buttons, and can be put in a Free layout, which means you can specify manual coordinates, but still get nested correct inside other layouts. * API was changed to allow better nesting. Previously items were added in the last added layout specifier, i.e. one level up in the layout hierarchy. This doesn't work well in always, so now when creating things like rows or columns it always returns a layout which you have to add the items in. All py scripts were updated to follow this. * Computing the layout now goes in two passes, first estimating the required width/height of all nested layouts, and then in the second pass using the results of that to decide on the actual locations. * Enum and array buttons now follow the direction of the layout, i.e. they are vertical or horizontal depending if they are in a column or row. * Color properties now get a color picker, and only get the additional RGB sliders with Expand=True. * File/directory string properties now get a button next to them for opening the file browse, though this is not implemented yet. * Layout items can now be aligned, set align=True when creating a column, row, etc. * Buttons now get a minimum width of one icon (avoids squashing icon buttons). * Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
if lamp.shadow_method == 'RAY_SHADOW':
col = layout.column()
col.itemL(text="Sampling:")
col.row().itemR(lamp, "shadow_ray_sampling_method", expand=True)
if lamp.type in ('POINT', 'SUN', 'SPOT'):
split = layout.split()
col = split.column()
col.itemR(lamp, "shadow_soft_size", text="Soft Size")
col.itemR(lamp, "shadow_ray_samples", text="Samples")
UI: Layout Engine * Buttons are now created first, and after that the layout is computed. This means the layout engine now works at button level, and makes it easier to write templates. Otherwise you had to store all info and create the buttons later. * Added interface_templates.c as a separate file to put templates in. These can contain regular buttons, and can be put in a Free layout, which means you can specify manual coordinates, but still get nested correct inside other layouts. * API was changed to allow better nesting. Previously items were added in the last added layout specifier, i.e. one level up in the layout hierarchy. This doesn't work well in always, so now when creating things like rows or columns it always returns a layout which you have to add the items in. All py scripts were updated to follow this. * Computing the layout now goes in two passes, first estimating the required width/height of all nested layouts, and then in the second pass using the results of that to decide on the actual locations. * Enum and array buttons now follow the direction of the layout, i.e. they are vertical or horizontal depending if they are in a column or row. * Color properties now get a color picker, and only get the additional RGB sliders with Expand=True. * File/directory string properties now get a button next to them for opening the file browse, though this is not implemented yet. * Layout items can now be aligned, set align=True when creating a column, row, etc. * Buttons now get a minimum width of one icon (avoids squashing icon buttons). * Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
col.itemR(lamp, "shadow_adaptive_threshold", text="Threshold")
col = split.column()
elif lamp.type == 'AREA':
split = layout.split()
col = split.column()
sub = split.column(align=True)
if lamp.shape == 'SQUARE':
col.itemR(lamp, "shadow_ray_samples_x", text="Samples")
elif lamp.shape == 'RECTANGLE':
col.itemR(lamp, "shadow_ray_samples_x", text="Samples X")
col.itemR(lamp, "shadow_ray_samples_y", text="Samples Y")
if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
col.itemR(lamp, "shadow_adaptive_threshold", text="Threshold")
elif lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED':
sub.itemR(lamp, "umbra")
sub.itemR(lamp, "dither")
sub.itemR(lamp, "jitter")
UI: Layout Engine * Buttons are now created first, and after that the layout is computed. This means the layout engine now works at button level, and makes it easier to write templates. Otherwise you had to store all info and create the buttons later. * Added interface_templates.c as a separate file to put templates in. These can contain regular buttons, and can be put in a Free layout, which means you can specify manual coordinates, but still get nested correct inside other layouts. * API was changed to allow better nesting. Previously items were added in the last added layout specifier, i.e. one level up in the layout hierarchy. This doesn't work well in always, so now when creating things like rows or columns it always returns a layout which you have to add the items in. All py scripts were updated to follow this. * Computing the layout now goes in two passes, first estimating the required width/height of all nested layouts, and then in the second pass using the results of that to decide on the actual locations. * Enum and array buttons now follow the direction of the layout, i.e. they are vertical or horizontal depending if they are in a column or row. * Color properties now get a color picker, and only get the additional RGB sliders with Expand=True. * File/directory string properties now get a button next to them for opening the file browse, though this is not implemented yet. * Layout items can now be aligned, set align=True when creating a column, row, etc. * Buttons now get a minimum width of one icon (avoids squashing icon buttons). * Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
if lamp.shadow_method == 'BUFFER_SHADOW':
col = layout.column()
col.itemL(text="Buffer Type:")
col.row().itemR(lamp, "shadow_buffer_type", expand=True)
UI: Layout Engine * Buttons are now created first, and after that the layout is computed. This means the layout engine now works at button level, and makes it easier to write templates. Otherwise you had to store all info and create the buttons later. * Added interface_templates.c as a separate file to put templates in. These can contain regular buttons, and can be put in a Free layout, which means you can specify manual coordinates, but still get nested correct inside other layouts. * API was changed to allow better nesting. Previously items were added in the last added layout specifier, i.e. one level up in the layout hierarchy. This doesn't work well in always, so now when creating things like rows or columns it always returns a layout which you have to add the items in. All py scripts were updated to follow this. * Computing the layout now goes in two passes, first estimating the required width/height of all nested layouts, and then in the second pass using the results of that to decide on the actual locations. * Enum and array buttons now follow the direction of the layout, i.e. they are vertical or horizontal depending if they are in a column or row. * Color properties now get a color picker, and only get the additional RGB sliders with Expand=True. * File/directory string properties now get a button next to them for opening the file browse, though this is not implemented yet. * Layout items can now be aligned, set align=True when creating a column, row, etc. * Buttons now get a minimum width of one icon (avoids squashing icon buttons). * Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
if lamp.shadow_buffer_type in ('REGULAR', 'HALFWAY'):
split = layout.split()
col = split.column()
col.itemL(text="Filter Type:")
col.itemR(lamp, "shadow_filter_type", text="")
sub = col.column(align=True)
sub.itemR(lamp, "shadow_buffer_soft", text="Soft")
sub.itemR(lamp, "shadow_buffer_bias", text="Bias")
col = split.column()
col.itemL(text="Sample Buffers:")
col.itemR(lamp, "shadow_sample_buffers", text="")
sub = col.column(align=True)
sub.itemR(lamp, "shadow_buffer_size", text="Size")
sub.itemR(lamp, "shadow_buffer_samples", text="Samples")
elif lamp.shadow_buffer_type == 'IRREGULAR':
layout.itemR(lamp, "shadow_buffer_bias", text="Bias")
UI: Layout Engine * Buttons are now created first, and after that the layout is computed. This means the layout engine now works at button level, and makes it easier to write templates. Otherwise you had to store all info and create the buttons later. * Added interface_templates.c as a separate file to put templates in. These can contain regular buttons, and can be put in a Free layout, which means you can specify manual coordinates, but still get nested correct inside other layouts. * API was changed to allow better nesting. Previously items were added in the last added layout specifier, i.e. one level up in the layout hierarchy. This doesn't work well in always, so now when creating things like rows or columns it always returns a layout which you have to add the items in. All py scripts were updated to follow this. * Computing the layout now goes in two passes, first estimating the required width/height of all nested layouts, and then in the second pass using the results of that to decide on the actual locations. * Enum and array buttons now follow the direction of the layout, i.e. they are vertical or horizontal depending if they are in a column or row. * Color properties now get a color picker, and only get the additional RGB sliders with Expand=True. * File/directory string properties now get a button next to them for opening the file browse, though this is not implemented yet. * Layout items can now be aligned, set align=True when creating a column, row, etc. * Buttons now get a minimum width of one icon (avoids squashing icon buttons). * Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
row = layout.row()
row.itemR(lamp, "auto_clip_start", text="Autoclip Start")
sub = row.row()
sub.active = not lamp.auto_clip_start
sub.itemR(lamp, "shadow_buffer_clip_start", text="Clip Start")
UI: Layout Engine * Buttons are now created first, and after that the layout is computed. This means the layout engine now works at button level, and makes it easier to write templates. Otherwise you had to store all info and create the buttons later. * Added interface_templates.c as a separate file to put templates in. These can contain regular buttons, and can be put in a Free layout, which means you can specify manual coordinates, but still get nested correct inside other layouts. * API was changed to allow better nesting. Previously items were added in the last added layout specifier, i.e. one level up in the layout hierarchy. This doesn't work well in always, so now when creating things like rows or columns it always returns a layout which you have to add the items in. All py scripts were updated to follow this. * Computing the layout now goes in two passes, first estimating the required width/height of all nested layouts, and then in the second pass using the results of that to decide on the actual locations. * Enum and array buttons now follow the direction of the layout, i.e. they are vertical or horizontal depending if they are in a column or row. * Color properties now get a color picker, and only get the additional RGB sliders with Expand=True. * File/directory string properties now get a button next to them for opening the file browse, though this is not implemented yet. * Layout items can now be aligned, set align=True when creating a column, row, etc. * Buttons now get a minimum width of one icon (avoids squashing icon buttons). * Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
row = layout.row()
row.itemR(lamp, "auto_clip_end", text="Autoclip End")
sub = row.row()
sub.active = not lamp.auto_clip_end
sub.itemR(lamp, "shadow_buffer_clip_end", text=" Clip End")
class DATA_PT_area(DataButtonsPanel):
__label__ = "Area Shape"
def poll(self, context):
lamp = context.lamp
return (lamp and lamp.type == 'AREA')
def draw(self, context):
layout = self.layout
lamp = context.lamp
split = layout.split()
col = split.column()
col.itemR(lamp, "shape", text="")
sub = col.column(align=True)
if (lamp.shape == 'SQUARE'):
sub.itemR(lamp, "size")
elif (lamp.shape == 'RECTANGLE'):
sub.itemR(lamp, "size", text="Size X")
sub.itemR(lamp, "size_y", text="Size Y")
col = split.column()
class DATA_PT_spot(DataButtonsPanel):
__label__ = "Spot Shape"
def poll(self, context):
lamp = context.lamp
return (lamp and lamp.type == 'SPOT')
def draw(self, context):
layout = self.layout
lamp = context.lamp
UI: Layout Engine * Buttons are now created first, and after that the layout is computed. This means the layout engine now works at button level, and makes it easier to write templates. Otherwise you had to store all info and create the buttons later. * Added interface_templates.c as a separate file to put templates in. These can contain regular buttons, and can be put in a Free layout, which means you can specify manual coordinates, but still get nested correct inside other layouts. * API was changed to allow better nesting. Previously items were added in the last added layout specifier, i.e. one level up in the layout hierarchy. This doesn't work well in always, so now when creating things like rows or columns it always returns a layout which you have to add the items in. All py scripts were updated to follow this. * Computing the layout now goes in two passes, first estimating the required width/height of all nested layouts, and then in the second pass using the results of that to decide on the actual locations. * Enum and array buttons now follow the direction of the layout, i.e. they are vertical or horizontal depending if they are in a column or row. * Color properties now get a color picker, and only get the additional RGB sliders with Expand=True. * File/directory string properties now get a button next to them for opening the file browse, though this is not implemented yet. * Layout items can now be aligned, set align=True when creating a column, row, etc. * Buttons now get a minimum width of one icon (avoids squashing icon buttons). * Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
split = layout.split()
col = split.column()
sub = col.column(align=True)
sub.itemR(lamp, "spot_size", text="Size")
sub.itemR(lamp, "spot_blend", text="Blend")
col.itemR(lamp, "square")
col = split.column()
col.itemR(lamp, "halo")
sub = col.column(align=True)
sub.active = lamp.halo
sub.itemR(lamp, "halo_intensity", text="Intensity")
if lamp.shadow_method == 'BUFFER_SHADOW':
sub.itemR(lamp, "halo_step", text="Step")
class DATA_PT_falloff_curve(DataButtonsPanel):
__label__ = "Falloff Curve"
__default_closed__ = True
def poll(self, context):
lamp = context.lamp
if lamp and lamp.type in ('POINT', 'SPOT'):
if lamp.falloff_type == 'CUSTOM_CURVE':
return True
return False
def draw(self, context):
layout = self.layout
lamp = context.lamp
layout.template_curve_mapping(lamp.falloff_curve)
bpy.types.register(DATA_PT_context_lamp)
bpy.types.register(DATA_PT_preview)
bpy.types.register(DATA_PT_lamp)
bpy.types.register(DATA_PT_falloff_curve)
bpy.types.register(DATA_PT_area)
bpy.types.register(DATA_PT_spot)
bpy.types.register(DATA_PT_shadow)
bpy.types.register(DATA_PT_sunsky)