2009-04-19 13:37:59 +00:00
|
|
|
|
2009-04-11 16:17:39 +00:00
|
|
|
import bpy
|
2009-04-11 02:18:24 +00:00
|
|
|
|
2009-04-19 13:37:59 +00:00
|
|
|
class ObjectButtonsPanel(bpy.types.Panel):
|
2009-08-22 08:48:01 +00:00
|
|
|
__space_type__ = 'PROPERTIES'
|
|
|
|
__region_type__ = 'WINDOW'
|
2009-04-11 02:18:24 +00:00
|
|
|
__context__ = "object"
|
|
|
|
|
2009-07-09 09:42:34 +00:00
|
|
|
class OBJECT_PT_context_object(ObjectButtonsPanel):
|
2009-07-26 03:54:17 +00:00
|
|
|
__show_header__ = False
|
2009-07-09 09:07:25 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-09 09:07:25 +00:00
|
|
|
ob = context.object
|
|
|
|
|
2009-07-21 00:55:20 +00:00
|
|
|
row = layout.row()
|
2009-08-22 08:48:01 +00:00
|
|
|
row.itemL(text="", icon='ICON_OBJECT_DATA')
|
2009-07-21 00:55:20 +00:00
|
|
|
row.itemR(ob, "name", text="")
|
2009-07-09 16:09:44 +00:00
|
|
|
|
2009-04-19 13:37:59 +00:00
|
|
|
class OBJECT_PT_transform(ObjectButtonsPanel):
|
|
|
|
__label__ = "Transform"
|
|
|
|
|
2009-04-11 02:18:24 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-06-13 21:22:21 +00:00
|
|
|
ob = context.object
|
2009-04-11 02:18:24 +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.column().itemR(ob, "location")
|
|
|
|
row.column().itemR(ob, "rotation")
|
|
|
|
row.column().itemR(ob, "scale")
|
2009-04-11 02:18:24 +00:00
|
|
|
|
2009-07-14 20:27:28 +00:00
|
|
|
class OBJECT_PT_relations(ObjectButtonsPanel):
|
|
|
|
__label__ = "Relations"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-14 20:27:28 +00:00
|
|
|
ob = context.object
|
|
|
|
|
|
|
|
split = layout.split()
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-07-14 20:27:28 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemR(ob, "layers")
|
|
|
|
col.itemS()
|
|
|
|
col.itemR(ob, "pass_index")
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="Parent:")
|
|
|
|
col.itemR(ob, "parent", text="")
|
|
|
|
|
|
|
|
sub = col.column()
|
2009-08-12 22:16:47 +00:00
|
|
|
split = sub.split(percentage=0.3)
|
|
|
|
split.itemL(text="Type:")
|
|
|
|
split.itemR(ob, "parent_type", text="")
|
2009-07-14 20:27:28 +00:00
|
|
|
parent = ob.parent
|
|
|
|
if parent and ob.parent_type == 'BONE' and parent.type == 'ARMATURE':
|
|
|
|
sub.item_pointerR(ob, "parent_bone", parent.data, "bones", text="")
|
|
|
|
sub.active = parent != None
|
|
|
|
|
2009-04-19 13:37:59 +00:00
|
|
|
class OBJECT_PT_groups(ObjectButtonsPanel):
|
2009-04-11 02:18:24 +00:00
|
|
|
__label__ = "Groups"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-06-13 21:22:21 +00:00
|
|
|
ob = context.object
|
2009-04-11 02:18:24 +00:00
|
|
|
|
2009-07-14 20:27:28 +00:00
|
|
|
split = layout.split()
|
2009-07-17 12:26:40 +00:00
|
|
|
split.item_menu_enumO("object.group_add", "group", text="Add to Group")
|
2009-07-14 20:27:28 +00:00
|
|
|
split.itemL()
|
2009-04-11 02:18:24 +00:00
|
|
|
|
|
|
|
for group in bpy.data.groups:
|
2009-06-20 02:44:57 +00:00
|
|
|
if ob.name in group.objects:
|
2009-05-28 23:45:50 +00:00
|
|
|
col = layout.column(align=True)
|
2009-04-11 02:18:24 +00:00
|
|
|
|
2009-07-14 20:27:28 +00:00
|
|
|
col.set_context_pointer("group", group)
|
|
|
|
|
2009-05-28 23:45:50 +00:00
|
|
|
row = col.box().row()
|
|
|
|
row.itemR(group, "name", text="")
|
2009-08-22 08:48:01 +00:00
|
|
|
row.itemO("object.group_remove", text="", icon='VICON_X')
|
2009-04-11 02:18:24 +00:00
|
|
|
|
2009-05-28 23:45:50 +00:00
|
|
|
split = col.box().split()
|
2009-07-14 20:27:28 +00:00
|
|
|
split.column().itemR(group, "layer", text="Dupli")
|
|
|
|
split.column().itemR(group, "dupli_offset", text="")
|
2009-04-11 02:18:24 +00:00
|
|
|
|
2009-04-19 13:37:59 +00:00
|
|
|
class OBJECT_PT_display(ObjectButtonsPanel):
|
2009-04-11 02:18:24 +00:00
|
|
|
__label__ = "Display"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-06-13 21:22:21 +00:00
|
|
|
ob = context.object
|
2009-09-14 06:31:20 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
col = split.column()
|
|
|
|
col.itemR(ob, "max_draw_type", text="Type")
|
|
|
|
col = split.column()
|
|
|
|
row = col.row()
|
|
|
|
row.itemR(ob, "draw_bounds", text="Bounds")
|
|
|
|
row.itemR(ob, "draw_bounds_type", 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
|
|
|
|
|
|
|
flow = layout.column_flow()
|
|
|
|
flow.itemR(ob, "draw_name", text="Name")
|
|
|
|
flow.itemR(ob, "draw_axis", text="Axis")
|
|
|
|
flow.itemR(ob, "draw_wire", text="Wire")
|
|
|
|
flow.itemR(ob, "draw_texture_space", text="Texture Space")
|
|
|
|
flow.itemR(ob, "x_ray", text="X-Ray")
|
|
|
|
flow.itemR(ob, "draw_transparent", text="Transparency")
|
2009-04-11 02:18:24 +00:00
|
|
|
|
2009-04-19 13:37:59 +00:00
|
|
|
class OBJECT_PT_duplication(ObjectButtonsPanel):
|
2009-04-11 02:18:24 +00:00
|
|
|
__label__ = "Duplication"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-06-13 21:22:21 +00:00
|
|
|
ob = context.object
|
2009-04-11 02:18:24 +00:00
|
|
|
|
2009-05-24 12:37:55 +00:00
|
|
|
layout.itemR(ob, "dupli_type", expand=True)
|
2009-04-11 02:18:24 +00:00
|
|
|
|
2009-05-24 12:37:55 +00:00
|
|
|
if ob.dupli_type == 'FRAMES':
|
2009-05-17 09:25:30 +00:00
|
|
|
split = layout.split()
|
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
col = split.column(align=True)
|
|
|
|
col.itemR(ob, "dupli_frames_start", text="Start")
|
|
|
|
col.itemR(ob, "dupli_frames_end", text="End")
|
2009-05-17 09:25:30 +00:00
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
col = split.column(align=True)
|
|
|
|
col.itemR(ob, "dupli_frames_on", text="On")
|
|
|
|
col.itemR(ob, "dupli_frames_off", text="Off")
|
2009-05-20 16:24:04 +00:00
|
|
|
|
2009-05-24 12:37:55 +00:00
|
|
|
layout.itemR(ob, "dupli_frames_no_speed", text="No Speed")
|
2009-05-20 16:24:04 +00:00
|
|
|
|
2009-05-24 12:37:55 +00:00
|
|
|
elif ob.dupli_type == 'VERTS':
|
|
|
|
layout.itemR(ob, "dupli_verts_rotation", text="Rotation")
|
2009-05-20 16:24:04 +00:00
|
|
|
|
2009-05-24 12:37:55 +00:00
|
|
|
elif ob.dupli_type == 'FACES':
|
|
|
|
row = layout.row()
|
|
|
|
row.itemR(ob, "dupli_faces_scale", text="Scale")
|
|
|
|
row.itemR(ob, "dupli_faces_inherit_scale", text="Inherit Scale")
|
2009-05-20 16:24:04 +00:00
|
|
|
|
2009-05-24 12:37:55 +00:00
|
|
|
elif ob.dupli_type == 'GROUP':
|
|
|
|
layout.itemR(ob, "dupli_group", text="Group")
|
2009-04-11 02:18:24 +00:00
|
|
|
|
2009-04-19 13:37:59 +00:00
|
|
|
class OBJECT_PT_animation(ObjectButtonsPanel):
|
2009-04-11 02:18:24 +00:00
|
|
|
__label__ = "Animation"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-07-30 10:11:19 +00:00
|
|
|
|
2009-06-13 21:22:21 +00:00
|
|
|
ob = context.object
|
2009-04-11 02:18:24 +00:00
|
|
|
|
2009-05-24 12:37:55 +00:00
|
|
|
split = layout.split()
|
|
|
|
|
2009-07-30 10:11:19 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="Time Offset:")
|
|
|
|
col.itemR(ob, "time_offset_edit", text="Edit")
|
|
|
|
row = col.row()
|
2009-07-14 20:38:21 +00:00
|
|
|
row.itemR(ob, "time_offset_particle", text="Particle")
|
|
|
|
row.active = len(ob.particle_systems) != 0
|
2009-07-30 10:11:19 +00:00
|
|
|
row = col.row()
|
2009-07-14 20:38:21 +00:00
|
|
|
row.itemR(ob, "time_offset_parent", text="Parent")
|
|
|
|
row.active = ob.parent != None
|
2009-07-30 10:11:19 +00:00
|
|
|
row = col.row()
|
2009-07-14 20:38:21 +00:00
|
|
|
row.itemR(ob, "slow_parent")
|
|
|
|
row.active = ob.parent != None
|
2009-07-30 10:11:19 +00:00
|
|
|
col.itemR(ob, "time_offset", text="Offset")
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.itemL(text="Track:")
|
|
|
|
col.itemR(ob, "track", text="")
|
|
|
|
col.itemR(ob, "track_axis", text="Axis")
|
|
|
|
col.itemR(ob, "up_axis", text="Up Axis")
|
|
|
|
row = col.row()
|
2009-07-14 20:27:28 +00:00
|
|
|
row.itemR(ob, "track_override_parent", text="Override Parent")
|
|
|
|
row.active = ob.parent != None
|
2009-04-11 02:18:24 +00:00
|
|
|
|
2009-07-09 09:42:34 +00:00
|
|
|
bpy.types.register(OBJECT_PT_context_object)
|
2009-04-19 13:37:59 +00:00
|
|
|
bpy.types.register(OBJECT_PT_transform)
|
2009-07-14 20:27:28 +00:00
|
|
|
bpy.types.register(OBJECT_PT_relations)
|
2009-04-19 13:37:59 +00:00
|
|
|
bpy.types.register(OBJECT_PT_groups)
|
|
|
|
bpy.types.register(OBJECT_PT_display)
|
|
|
|
bpy.types.register(OBJECT_PT_duplication)
|
2009-07-09 19:45:27 +00:00
|
|
|
bpy.types.register(OBJECT_PT_animation)
|