2009-04-27 18:05:58 +00:00
|
|
|
|
|
|
|
import bpy
|
|
|
|
|
|
|
|
class DataButtonsPanel(bpy.types.Panel):
|
|
|
|
__space_type__ = "BUTTONS_WINDOW"
|
|
|
|
__region_type__ = "WINDOW"
|
|
|
|
__context__ = "data"
|
|
|
|
|
2009-05-04 15:53:55 +00:00
|
|
|
def poll(self, context):
|
|
|
|
ob = context.active_object
|
2009-05-08 18:17:57 +00:00
|
|
|
return (ob and ob.type == 'CAMERA')
|
|
|
|
|
2009-05-04 15:53:55 +00:00
|
|
|
class DATA_PT_cameralens(DataButtonsPanel):
|
|
|
|
__idname__ = "DATA_PT_camera"
|
|
|
|
__label__ = "Lens"
|
|
|
|
|
|
|
|
def draw(self, context):
|
2009-05-19 17:13:33 +00:00
|
|
|
cam = context.active_object.data
|
2009-05-04 15:53:55 +00:00
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
layout.itemR(cam, "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
|
|
|
row = layout.row(align=True)
|
|
|
|
if cam.type == 'PERSP':
|
2009-05-24 12:37:55 +00:00
|
|
|
row.itemR(cam, "lens_unit", text="")
|
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 cam.lens_unit == 'MILLIMETERS':
|
|
|
|
row.itemR(cam, "lens", text="Angle")
|
|
|
|
elif cam.lens_unit == 'DEGREES':
|
|
|
|
row.itemR(cam, "angle")
|
|
|
|
|
|
|
|
elif cam.type == 'ORTHO':
|
|
|
|
row.itemR(cam, "ortho_scale")
|
2009-05-15 16:24:08 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
2009-05-04 15:53:55 +00:00
|
|
|
|
2009-05-15 16:24:08 +00:00
|
|
|
sub = split.column(align=True)
|
|
|
|
sub.itemL(text="Shift:")
|
|
|
|
sub.itemR(cam, "shift_x", text="X")
|
|
|
|
sub.itemR(cam, "shift_y", text="Y")
|
|
|
|
|
|
|
|
sub = split.column(align=True)
|
|
|
|
sub.itemL(text="Clipping:")
|
|
|
|
sub.itemR(cam, "clip_start", text="Start")
|
|
|
|
sub.itemR(cam, "clip_end", text="End")
|
2009-05-04 15:53:55 +00:00
|
|
|
|
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(cam, "dof_object")
|
|
|
|
row.itemR(cam, "dof_distance")
|
2009-05-04 15:53:55 +00:00
|
|
|
|
|
|
|
class DATA_PT_cameradisplay(DataButtonsPanel):
|
|
|
|
__idname__ = "DATA_PT_cameradisplay"
|
|
|
|
__label__ = "Display"
|
|
|
|
|
|
|
|
def draw(self, context):
|
2009-05-19 17:13:33 +00:00
|
|
|
cam = context.active_object.data
|
2009-05-04 15:53:55 +00:00
|
|
|
layout = self.layout
|
|
|
|
|
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()
|
2009-05-04 15:53:55 +00:00
|
|
|
|
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
|
|
|
sub = split.column()
|
2009-05-04 15:53:55 +00:00
|
|
|
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")
|
2009-05-18 18:20:29 +00:00
|
|
|
|
|
|
|
sub = split.column()
|
2009-05-15 16:24:08 +00:00
|
|
|
sub.itemR(cam, "show_passepartout", text="Passepartout")
|
2009-05-05 04:07:08 +00:00
|
|
|
if (cam.show_passepartout):
|
2009-05-20 16:24:04 +00:00
|
|
|
sub.itemR(cam, "passepartout_alpha", text="Alpha", slider=True)
|
2009-05-15 16:24:08 +00:00
|
|
|
sub.itemR(cam, "draw_size", text="Size")
|
2009-05-04 15:53:55 +00:00
|
|
|
|
|
|
|
bpy.types.register(DATA_PT_cameralens)
|
2009-05-24 12:37:55 +00:00
|
|
|
bpy.types.register(DATA_PT_cameradisplay)
|