Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArystanbek Dyussenov <arystan.d@gmail.com>2010-09-04 22:49:07 +0400
committerArystanbek Dyussenov <arystan.d@gmail.com>2010-09-04 22:49:07 +0400
commit90b464d3728d9ed8ec26fdf59058d236b99dbcd9 (patch)
treee88cab4fb1358e962b19f658064ca8c9f8d29f5b /release/scripts/ui/properties_object.py
parent08d02dd04d836976b25793bb1d4c6a86b3f924c7 (diff)
parentb0b787ef38f9947b3176642556f5282eb3518f69 (diff)
COLLADA branch: merge from trunk -r 28015:31610.soc-2009-chingachgook
Diffstat (limited to 'release/scripts/ui/properties_object.py')
-rw-r--r--release/scripts/ui/properties_object.py228
1 files changed, 107 insertions, 121 deletions
diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py
index 7169d936904..35037b10216 100644
--- a/release/scripts/ui/properties_object.py
+++ b/release/scripts/ui/properties_object.py
@@ -20,18 +20,16 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = 180
-
-class ObjectButtonsPanel(bpy.types.Panel):
+class ObjectButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "object"
-class OBJECT_PT_context_object(ObjectButtonsPanel):
+class OBJECT_PT_context_object(ObjectButtonsPanel, bpy.types.Panel):
bl_label = ""
- bl_show_header = False
+ bl_options = {'HIDE_HEADER'}
def draw(self, context):
layout = self.layout
@@ -46,59 +44,40 @@ class OBJECT_PT_context_object(ObjectButtonsPanel):
row.prop(ob, "name", text="")
-class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel):
- _context_path = "object"
-
-
-class OBJECT_PT_transform(ObjectButtonsPanel):
+class OBJECT_PT_transform(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Transform"
def draw(self, context):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
- if wide_ui:
- row = layout.row()
+ row = layout.row()
- row.column().prop(ob, "location")
- if ob.rotation_mode == 'QUATERNION':
- row.column().prop(ob, "rotation_quaternion", text="Rotation")
- elif ob.rotation_mode == 'AXIS_ANGLE':
- #row.column().label(text="Rotation")
- #row.column().prop(pchan, "rotation_angle", text="Angle")
- #row.column().prop(pchan, "rotation_axis", text="Axis")
- row.column().prop(ob, "rotation_axis_angle", text="Rotation")
- else:
- row.column().prop(ob, "rotation_euler", text="Rotation")
+ row.column().prop(ob, "location")
+ if ob.rotation_mode == 'QUATERNION':
+ row.column().prop(ob, "rotation_quaternion", text="Rotation")
+ elif ob.rotation_mode == 'AXIS_ANGLE':
+ #row.column().label(text="Rotation")
+ #row.column().prop(pchan, "rotation_angle", text="Angle")
+ #row.column().prop(pchan, "rotation_axis", text="Axis")
+ row.column().prop(ob, "rotation_axis_angle", text="Rotation")
+ else:
+ row.column().prop(ob, "rotation_euler", text="Rotation")
- row.column().prop(ob, "scale")
+ row.column().prop(ob, "scale")
- layout.prop(ob, "rotation_mode")
- else:
- col = layout.column()
- col.prop(ob, "location")
- col.label(text="Rotation:")
- col.prop(ob, "rotation_mode", text="")
- if ob.rotation_mode == 'QUATERNION':
- col.prop(ob, "rotation_quaternion", text="")
- elif ob.rotation_mode == 'AXIS_ANGLE':
- col.prop(ob, "rotation_axis_angle", text="")
- else:
- col.prop(ob, "rotation_euler", text="")
- col.prop(ob, "scale")
-
-
-class OBJECT_PT_transform_locks(ObjectButtonsPanel):
+ layout.prop(ob, "rotation_mode")
+
+
+class OBJECT_PT_transform_locks(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Transform Locks"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
ob = context.object
- # wide_ui = context.region.width > narrowui
row = layout.row()
@@ -117,14 +96,13 @@ class OBJECT_PT_transform_locks(ObjectButtonsPanel):
row.column().prop(ob, "lock_scale", text="Scale")
-class OBJECT_PT_relations(ObjectButtonsPanel):
+class OBJECT_PT_relations(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Relations"
def draw(self, context):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
split = layout.split()
@@ -133,8 +111,7 @@ class OBJECT_PT_relations(ObjectButtonsPanel):
col.separator()
col.prop(ob, "pass_index")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Parent:")
col.prop(ob, "parent", text="")
@@ -142,26 +119,23 @@ class OBJECT_PT_relations(ObjectButtonsPanel):
sub.prop(ob, "parent_type", text="")
parent = ob.parent
if parent and ob.parent_type == 'BONE' and parent.type == 'ARMATURE':
- sub.prop_object(ob, "parent_bone", parent.data, "bones", text="")
+ sub.prop_search(ob, "parent_bone", parent.data, "bones", text="")
sub.active = (parent is not None)
-class OBJECT_PT_groups(ObjectButtonsPanel):
+class OBJECT_PT_groups(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Groups"
def draw(self, context):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
- if wide_ui:
- split = layout.split()
- split.operator_menu_enum("object.group_add", "group")
- split.label()
- else:
- layout.operator_menu_enum("object.group_add", "group")
+ row = layout.row(align=True)
+ row.operator("object.group_link", text="Add to Group")
+ row.operator("object.group_add", text="", icon='ZOOMIN')
+ # XXX, this is bad practice, yes, I wrote it :( - campbell
index = 0
value = str(tuple(context.scene.cursor_location))
for group in bpy.data.groups:
@@ -172,71 +146,64 @@ class OBJECT_PT_groups(ObjectButtonsPanel):
row = col.box().row()
row.prop(group, "name", text="")
- row.operator("object.group_remove", text="", icon='X')
+ row.operator("object.group_remove", text="", icon='X', emboss=False)
split = col.box().split()
col = split.column()
- col.prop(group, "layer", text="Dupli")
+ col.prop(group, "layers", text="Dupli")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(group, "dupli_offset", text="")
prop = col.operator("wm.context_set_value", text="From Cursor")
- prop.path = "object.group_users[%d].dupli_offset" % index
+ prop.data_path = "object.users_group[%d].dupli_offset" % index
prop.value = value
index += 1
-class OBJECT_PT_display(ObjectButtonsPanel):
+class OBJECT_PT_display(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Display"
def draw(self, context):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
- col.prop(ob, "max_draw_type", text="Type")
+ col.prop(ob, "draw_type", text="Type")
- if wide_ui:
- col = split.column()
+ col = split.column()
row = col.row()
- row.prop(ob, "draw_bounds", text="Bounds")
+ row.prop(ob, "show_bounds", text="Bounds")
sub = row.row()
- sub.active = ob.draw_bounds
+ sub.active = ob.show_bounds
sub.prop(ob, "draw_bounds_type", text="")
split = layout.split()
col = split.column()
- col.prop(ob, "draw_name", text="Name")
- col.prop(ob, "draw_axis", text="Axis")
- col.prop(ob, "draw_wire", text="Wire")
+ col.prop(ob, "show_name", text="Name")
+ col.prop(ob, "show_axis", text="Axis")
+ col.prop(ob, "show_wire", text="Wire")
+ col.prop(ob, "color", text="Object Color")
- if wide_ui:
- col = split.column()
- col.prop(ob, "draw_texture_space", text="Texture Space")
- col.prop(ob, "x_ray", text="X-Ray")
- col.prop(ob, "draw_transparent", text="Transparency")
+ col = split.column()
+ col.prop(ob, "show_texture_space", text="Texture Space")
+ col.prop(ob, "show_x_ray", text="X-Ray")
+ col.prop(ob, "show_transparent", text="Transparency")
-class OBJECT_PT_duplication(ObjectButtonsPanel):
+class OBJECT_PT_duplication(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Duplication"
def draw(self, context):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
- if wide_ui:
- layout.prop(ob, "dupli_type", expand=True)
- else:
- layout.prop(ob, "dupli_type", text="")
+ layout.prop(ob, "dupli_type", expand=True)
if ob.dupli_type == 'FRAMES':
split = layout.split()
@@ -245,15 +212,14 @@ class OBJECT_PT_duplication(ObjectButtonsPanel):
col.prop(ob, "dupli_frames_start", text="Start")
col.prop(ob, "dupli_frames_end", text="End")
- if wide_ui:
- col = split.column(align=True)
+ col = split.column(align=True)
col.prop(ob, "dupli_frames_on", text="On")
col.prop(ob, "dupli_frames_off", text="Off")
layout.prop(ob, "use_dupli_frames_speed", text="Speed")
elif ob.dupli_type == 'VERTS':
- layout.prop(ob, "use_dupli_verts_rotation", text="Rotation")
+ layout.prop(ob, "use_dupli_vertices_rotation", text="Rotation")
elif ob.dupli_type == 'FACES':
split = layout.split()
@@ -261,82 +227,102 @@ class OBJECT_PT_duplication(ObjectButtonsPanel):
col = split.column()
col.prop(ob, "use_dupli_faces_scale", text="Scale")
- if wide_ui:
- col = split.column()
+ col = split.column()
col.prop(ob, "dupli_faces_scale", text="Inherit Scale")
elif ob.dupli_type == 'GROUP':
- if wide_ui:
- layout.prop(ob, "dupli_group", text="Group")
- else:
- layout.prop(ob, "dupli_group", text="")
+ layout.prop(ob, "dupli_group", text="Group")
-# XXX: the following options are all quite buggy, ancient hacks that should be dropped
+# XXX: the following options are all quite buggy, ancient hacks that should be dropped
-class OBJECT_PT_animation(ObjectButtonsPanel):
+class OBJECT_PT_animation(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Animation Hacks"
- bl_default_closed = True
+ bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
ob = context.object
- wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.label(text="Time Offset:")
- col.prop(ob, "time_offset_edit", text="Edit")
+ col.prop(ob, "use_time_offset_edit", text="Edit")
row = col.row()
- row.prop(ob, "time_offset_particle", text="Particle")
- row.active = len(ob.particle_systems) != 0
+ row.prop(ob, "use_time_offset_particle", text="Particle")
+ row.active = bool(ob.particle_systems)
row = col.row()
- row.prop(ob, "time_offset_parent", text="Parent")
+ row.prop(ob, "use_time_offset_parent", text="Parent")
row.active = (ob.parent is not None)
row = col.row()
- row.prop(ob, "slow_parent")
+ row.prop(ob, "use_slow_parent")
row.active = (ob.parent is not None)
col.prop(ob, "time_offset", text="Offset")
# XXX: these are still used for a few curve-related tracking features
- if wide_ui:
- col = split.column()
+ col = split.column()
col.label(text="Tracking Axes:")
col.prop(ob, "track_axis", text="Axis")
col.prop(ob, "up_axis", text="Up Axis")
+from properties_animviz import MotionPathButtonsPanel, OnionSkinButtonsPanel
-# import generic panels from other files
-from properties_animviz import OBJECT_PT_motion_paths, OBJECT_PT_onion_skinning
-classes = [
- OBJECT_PT_context_object,
- OBJECT_PT_transform,
- OBJECT_PT_transform_locks,
- OBJECT_PT_relations,
- OBJECT_PT_groups,
- OBJECT_PT_display,
- OBJECT_PT_duplication,
- OBJECT_PT_animation, # XXX: panel of old hacks pending to be removed...
+class OBJECT_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
+ #bl_label = "Object Motion Paths"
+ bl_context = "object"
+
+ @classmethod
+ def poll(cls, context):
+ return (context.object)
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ self.draw_settings(context, ob.animation_visualisation)
+
+ layout.separator()
+
+ split = layout.split()
+
+ col = split.column()
+ col.operator("object.paths_calculate", text="Calculate Paths")
- OBJECT_PT_motion_paths,
- #OBJECT_PT_onion_skinning,
+ col = split.column()
+ col.operator("object.paths_clear", text="Clear Paths")
+
+
+class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): #, bpy.types.Panel): # inherit from panel when ready
+ #bl_label = "Object Onion Skinning"
+ bl_context = "object"
- OBJECT_PT_custom_props]
+ @classmethod
+ def poll(cls, context):
+ return (context.object)
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ self.draw_settings(context, ob.animation_visualisation)
+
+
+class OBJECT_PT_custom_props(bpy.types.Panel, PropertyPanel, ObjectButtonsPanel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object"
def register():
- register = bpy.types.register
- for cls in classes:
- register(cls)
+ pass
def unregister():
- unregister = bpy.types.unregister
- for cls in classes:
- unregister(cls)
+ pass
if __name__ == "__main__":
register()