Merging r43501 through r43720 form trunk into soc-2011-tomato
[blender.git] / release / scripts / startup / bl_ui / space_dopesheet.py
index 1ba9a628c1a2b5b40649153898c6c87417709813..b7d69fb38b339e7420e74f9297df0b8a1888cfce 100644 (file)
@@ -19,6 +19,7 @@
 # <pep8 compliant>
 
 import bpy
+from bpy.types import Header, Menu
 
 
 #######################################
@@ -33,54 +34,63 @@ def dopesheet_filter(layout, context, genericFiltersOnly=False):
     row.prop(dopesheet, "show_only_selected", text="")
     row.prop(dopesheet, "show_hidden", text="")
 
-    if genericFiltersOnly:
-        return
-
-    row = layout.row(align=True)
-    row.prop(dopesheet, "show_transforms", text="")
-
     if is_nla:
         row.prop(dopesheet, "show_missing_nla", text="")
 
-    row = layout.row(align=True)
-    row.prop(dopesheet, "show_scenes", text="")
-    row.prop(dopesheet, "show_worlds", text="")
-    row.prop(dopesheet, "show_nodes", text="")
-
-    if bpy.data.meshes:
-        row.prop(dopesheet, "show_meshes", text="")
-    if bpy.data.shape_keys:
-        row.prop(dopesheet, "show_shapekeys", text="")
-    if bpy.data.materials:
-        row.prop(dopesheet, "show_materials", text="")
-    if bpy.data.lamps:
-        row.prop(dopesheet, "show_lamps", text="")
-    if bpy.data.textures:
-        row.prop(dopesheet, "show_textures", text="")
-    if bpy.data.cameras:
-        row.prop(dopesheet, "show_cameras", text="")
-    if bpy.data.curves:
-        row.prop(dopesheet, "show_curves", text="")
-    if bpy.data.metaballs:
-        row.prop(dopesheet, "show_metaballs", text="")
-    if bpy.data.lattices:
-        row.prop(dopesheet, "show_lattices", text="")
-    if bpy.data.armatures:
-        row.prop(dopesheet, "show_armatures", text="")
-    if bpy.data.particles:
-        row.prop(dopesheet, "show_particles", text="")
-
-    if bpy.data.groups:
+    if not genericFiltersOnly:
+        if bpy.data.groups:
+            row = layout.row(align=True)
+            row.prop(dopesheet, "show_only_group_objects", text="")
+            if dopesheet.show_only_group_objects:
+                row.prop(dopesheet, "filter_group", text="")
+
+    if not is_nla:
         row = layout.row(align=True)
-        row.prop(dopesheet, "show_only_group_objects", text="")
-        if dopesheet.show_only_group_objects:
-            row.prop(dopesheet, "filter_group", text="")
+        row.prop(dopesheet, "show_only_matching_fcurves", text="")
+        if dopesheet.show_only_matching_fcurves:
+            row.prop(dopesheet, "filter_fcurve_name", text="")
+
+    if not genericFiltersOnly:
+        row = layout.row(align=True)
+        row.prop(dopesheet, "show_datablock_filters", text="Filters")
+
+        if dopesheet.show_datablock_filters:
+            row.prop(dopesheet, "show_scenes", text="")
+            row.prop(dopesheet, "show_worlds", text="")
+            row.prop(dopesheet, "show_nodes", text="")
+
+            row.prop(dopesheet, "show_transforms", text="")
+
+            if bpy.data.meshes:
+                row.prop(dopesheet, "show_meshes", text="")
+            if bpy.data.shape_keys:
+                row.prop(dopesheet, "show_shapekeys", text="")
+            if bpy.data.materials:
+                row.prop(dopesheet, "show_materials", text="")
+            if bpy.data.lamps:
+                row.prop(dopesheet, "show_lamps", text="")
+            if bpy.data.textures:
+                row.prop(dopesheet, "show_textures", text="")
+            if bpy.data.cameras:
+                row.prop(dopesheet, "show_cameras", text="")
+            if bpy.data.curves:
+                row.prop(dopesheet, "show_curves", text="")
+            if bpy.data.metaballs:
+                row.prop(dopesheet, "show_metaballs", text="")
+            if bpy.data.lattices:
+                row.prop(dopesheet, "show_lattices", text="")
+            if bpy.data.armatures:
+                row.prop(dopesheet, "show_armatures", text="")
+            if bpy.data.particles:
+                row.prop(dopesheet, "show_particles", text="")
+            if bpy.data.speakers:
+                row.prop(dopesheet, "show_speakers", text="")
 
 
 #######################################
 # DopeSheet Editor - General/Standard UI
 
-class DOPESHEET_HT_header(bpy.types.Header):
+class DOPESHEET_HT_header(Header):
     bl_space_type = 'DOPESHEET_EDITOR'
 
     def draw(self, context):
@@ -92,21 +102,19 @@ class DOPESHEET_HT_header(bpy.types.Header):
         row.template_header()
 
         if context.area.show_menus:
-            sub = row.row(align=True)
+            row.menu("DOPESHEET_MT_view")
+            row.menu("DOPESHEET_MT_select")
+            row.menu("DOPESHEET_MT_marker")
 
-            sub.menu("DOPESHEET_MT_view")
-            sub.menu("DOPESHEET_MT_select")
-            sub.menu("DOPESHEET_MT_marker")
-
-            if st.mode == 'DOPESHEET' or (st.mode == 'ACTION' and st.action != None):
-                sub.menu("DOPESHEET_MT_channel")
+            if st.mode == 'DOPESHEET' or (st.mode == 'ACTION' and st.action is not None):
+                row.menu("DOPESHEET_MT_channel")
             elif st.mode == 'GPENCIL':
-                sub.menu("DOPESHEET_MT_gpencil_channel")
+                row.menu("DOPESHEET_MT_gpencil_channel")
 
             if st.mode != 'GPENCIL':
-                sub.menu("DOPESHEET_MT_key")
+                row.menu("DOPESHEET_MT_key")
             else:
-                sub.menu("DOPESHEET_MT_gpencil_frame")
+                row.menu("DOPESHEET_MT_gpencil_frame")
 
         layout.prop(st, "mode", text="")
         layout.prop(st.dopesheet, "show_summary", text="Summary")
@@ -130,7 +138,7 @@ class DOPESHEET_HT_header(bpy.types.Header):
         row.operator("action.paste", text="", icon='PASTEDOWN')
 
 
-class DOPESHEET_MT_view(bpy.types.Menu):
+class DOPESHEET_MT_view(Menu):
     bl_label = "View"
 
     def draw(self, context):
@@ -138,18 +146,13 @@ class DOPESHEET_MT_view(bpy.types.Menu):
 
         st = context.space_data
 
-        layout.column()
-
         layout.prop(st, "use_realtime_update")
         layout.prop(st, "show_frame_indicator")
         layout.prop(st, "show_sliders")
         layout.prop(st, "use_auto_merge_keyframes")
         layout.prop(st, "use_marker_sync")
 
-        if st.show_seconds:
-            layout.operator("anim.time_toggle", text="Show Frames")
-        else:
-            layout.operator("anim.time_toggle", text="Show Seconds")
+        layout.prop(st, "show_seconds")
 
         layout.separator()
         layout.operator("anim.previewrange_set")
@@ -166,19 +169,18 @@ class DOPESHEET_MT_view(bpy.types.Menu):
         layout.operator("screen.screen_full_area")
 
 
-class DOPESHEET_MT_select(bpy.types.Menu):
+class DOPESHEET_MT_select(Menu):
     bl_label = "Select"
 
     def draw(self, context):
         layout = self.layout
 
-        layout.column()
         # This is a bit misleading as the operator's default text is "Select All" while it actually *toggles* All/None
-        layout.operator("action.select_all_toggle")
+        layout.operator("action.select_all_toggle").invert = False
         layout.operator("action.select_all_toggle", text="Invert Selection").invert = True
 
         layout.separator()
-        layout.operator("action.select_border")
+        layout.operator("action.select_border").axis_range = False
         layout.operator("action.select_border", text="Border Axis Range").axis_range = True
 
         layout.separator()
@@ -202,25 +204,16 @@ class DOPESHEET_MT_select(bpy.types.Menu):
             layout.operator("action.select_linked")
 
 
-class DOPESHEET_MT_marker(bpy.types.Menu):
+class DOPESHEET_MT_marker(Menu):
     bl_label = "Marker"
 
     def draw(self, context):
         layout = self.layout
 
-        st = context.space_data
-
-        #layout.operator_context = 'EXEC_REGION_WIN'
-
-        layout.column()
-        layout.operator("marker.add", "Add Marker")
-        layout.operator("marker.duplicate", text="Duplicate Marker")
-        layout.operator("marker.delete", text="Delete Marker")
-
-        layout.separator()
+        from .space_time import marker_menu_generic
+        marker_menu_generic(layout)
 
-        layout.operator("marker.rename", text="Rename Marker")
-        layout.operator("marker.move", text="Grab/Move Marker")
+        st = context.space_data
 
         if st.mode in {'ACTION', 'SHAPEKEY'} and st.action:
             layout.separator()
@@ -233,7 +226,7 @@ class DOPESHEET_MT_marker(bpy.types.Menu):
 #######################################
 # Keyframe Editing
 
-class DOPESHEET_MT_channel(bpy.types.Menu):
+class DOPESHEET_MT_channel(Menu):
     bl_label = "Channel"
 
     def draw(self, context):
@@ -241,7 +234,6 @@ class DOPESHEET_MT_channel(bpy.types.Menu):
 
         layout.operator_context = 'INVOKE_REGION_CHANNELS'
 
-        layout.column()
         layout.operator("anim.channels_delete")
 
         layout.separator()
@@ -264,13 +256,12 @@ class DOPESHEET_MT_channel(bpy.types.Menu):
         layout.operator("anim.channels_fcurves_enable")
 
 
-class DOPESHEET_MT_key(bpy.types.Menu):
+class DOPESHEET_MT_key(Menu):
     bl_label = "Key"
 
     def draw(self, context):
         layout = self.layout
 
-        layout.column()
         layout.menu("DOPESHEET_MT_key_transform", text="Transform")
 
         layout.operator_menu_enum("action.snap", "type", text="Snap")
@@ -280,7 +271,7 @@ class DOPESHEET_MT_key(bpy.types.Menu):
         layout.operator("action.keyframe_insert")
 
         layout.separator()
-        layout.operator("action.duplicate")
+        layout.operator("action.duplicate_move")
         layout.operator("action.delete")
 
         layout.separator()
@@ -297,13 +288,12 @@ class DOPESHEET_MT_key(bpy.types.Menu):
         layout.operator("action.paste")
 
 
-class DOPESHEET_MT_key_transform(bpy.types.Menu):
+class DOPESHEET_MT_key_transform(Menu):
     bl_label = "Transform"
 
     def draw(self, context):
         layout = self.layout
 
-        layout.column()
         layout.operator("transform.transform", text="Grab/Move").mode = 'TIME_TRANSLATE'
         layout.operator("transform.transform", text="Extend").mode = 'TIME_EXTEND'
         layout.operator("transform.transform", text="Slide").mode = 'TIME_SLIDE'
@@ -313,7 +303,7 @@ class DOPESHEET_MT_key_transform(bpy.types.Menu):
 #######################################
 # Grease Pencil Editing
 
-class DOPESHEET_MT_gpencil_channel(bpy.types.Menu):
+class DOPESHEET_MT_gpencil_channel(Menu):
     bl_label = "Channel"
 
     def draw(self, context):
@@ -321,7 +311,6 @@ class DOPESHEET_MT_gpencil_channel(bpy.types.Menu):
 
         layout.operator_context = 'INVOKE_REGION_CHANNELS'
 
-        layout.column()
         layout.operator("anim.channels_delete")
 
         layout.separator()
@@ -341,13 +330,12 @@ class DOPESHEET_MT_gpencil_channel(bpy.types.Menu):
         #layout.operator_menu_enum("anim.channels_move", "direction", text="Move...")
 
 
-class DOPESHEET_MT_gpencil_frame(bpy.types.Menu):
+class DOPESHEET_MT_gpencil_frame(Menu):
     bl_label = "Frame"
 
     def draw(self, context):
         layout = self.layout
 
-        layout.column()
         layout.menu("DOPESHEET_MT_key_transform", text="Transform")
 
         #layout.operator_menu_enum("action.snap", "type", text="Snap")
@@ -360,3 +348,6 @@ class DOPESHEET_MT_gpencil_frame(bpy.types.Menu):
         #layout.separator()
         #layout.operator("action.copy")
         #layout.operator("action.paste")
+
+if __name__ == "__main__":  # only for live edit.
+    bpy.utils.register_module(__name__)