[Bf-blender-cvs] [cc06e0fbe8b] blender2.8: Dopesheet-Timeline: First steps towards making the Timeline a mode of the DopeSheet Editor

Joshua Leung noreply at git.blender.org
Fri Apr 20 19:06:35 CEST 2018


Commit: cc06e0fbe8bf122a7f1688342f9e80df3be8502f
Author: Joshua Leung
Date:   Thu Apr 19 14:41:20 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBcc06e0fbe8bf122a7f1688342f9e80df3be8502f

Dopesheet-Timeline: First steps towards making the Timeline a mode of the DopeSheet Editor

For many years, animators have been requesting the ability to edit keyframes in the
timeline. However, implementing such tools in the timeline quickly becomes a slippery
slope, where we'll eventually end up having to duplicate all the functionality from the
dopesheet editor.

Discussing with William and Pablo this morning, we realised that perhaps it might be possible
to just make the Timeline a mode of the Dopesheet Editor (and kill off the old standalone
Timeline), meaning that we essentially get all the Dopesheet Editor goodness for free!
Also, with some proposed UI updates (i.e. allowing "submodes" of editors to be part of the
the main editors selector), it might not even matter that there isn't an "actual" timeline
editor anymore.

This commit implements the following changes (which are actually sufficient for supporting
most basic workflows):
* Timeline mode in Dopesheet Editor
* Tweaks to UI code to make the Timeline header/menus show up in Dopesheet editor

TODO:
* Hide channels list when switching to timeline mode
* Port over cache-file indicators
* Add missing timeline-only settings that need a new home in the dopesheet
* Go through fixing all timeline editor operators (e.g. Bind to camera)
* Port over start/end frame shading (and adjust preview range rendering to make the
  distinction between these clear)
* Remove old timeline editor, and transfer over any leftover code

===================================================================

M	release/scripts/startup/bl_ui/space_dopesheet.py
M	release/scripts/startup/bl_ui/space_time.py
M	source/blender/editors/animation/anim_filter.c
M	source/blender/editors/include/ED_anim_api.h
M	source/blender/makesdna/DNA_action_types.h
M	source/blender/makesrna/intern/rna_space.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py
index 371ab088190..1b8582ba8f2 100644
--- a/release/scripts/startup/bl_ui/space_dopesheet.py
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -20,6 +20,7 @@
 
 import bpy
 from bpy.types import Header, Menu
+from .space_time import *
 
 
 #######################################
@@ -114,14 +115,35 @@ class DOPESHEET_HT_header(Header):
         layout = self.layout
 
         st = context.space_data
-        toolsettings = context.tool_settings
 
         row = layout.row(align=True)
         row.template_header()
+        
+        # XXX: perhaps our mode menu can be retired eventually when we get editor submodes in the main menu?
+        layout.prop(st, "mode", text="")
 
-        DOPESHEET_MT_editor_menus.draw_collapsible(context, layout)
+        if st.mode == 'TIMELINE':
+            TIME_MT_editor_menus.draw_collapsible(context, layout)
+            TIME_HT_editor_buttons.draw_header(context, layout)
+        else:
+            DOPESHEET_MT_editor_menus.draw_collapsible(context, layout)
+            DOPESHEET_HT_editor_buttons.draw_header(context, layout)
 
-        layout.prop(st, "mode", text="")
+
+# Header for "normal" dopesheet editor modes (e.g. Dope Sheet, Action, Shape Keys, etc.)
+# XXX: Temporary, until we have editor submodes in the actual editors menu
+class DOPESHEET_HT_editor_buttons(Header):
+    bl_idname = "DOPESHEET_HT_editor_buttons"
+    bl_space_type = 'DOPESHEET_EDITOR'
+    bl_label = ""
+
+    def draw(self, context):
+        pass
+
+    @staticmethod
+    def draw_header(context, layout):
+        st = context.space_data
+        toolsettings = context.tool_settings
 
         if st.mode in {'ACTION', 'SHAPEKEY'}:
             row = layout.row(align=True)
@@ -451,6 +473,7 @@ class DOPESHEET_MT_delete(Menu):
 
 classes = (
     DOPESHEET_HT_header,
+    DOPESHEET_HT_editor_buttons,
     DOPESHEET_MT_editor_menus,
     DOPESHEET_MT_view,
     DOPESHEET_MT_select,
diff --git a/release/scripts/startup/bl_ui/space_time.py b/release/scripts/startup/bl_ui/space_time.py
index 9026a93aa99..669d146cb91 100644
--- a/release/scripts/startup/bl_ui/space_time.py
+++ b/release/scripts/startup/bl_ui/space_time.py
@@ -27,15 +27,29 @@ class TIME_HT_header(Header):
     def draw(self, context):
         layout = self.layout
 
-        scene = context.scene
-        toolsettings = context.tool_settings
-        screen = context.screen
-        userprefs = context.user_preferences
-
         row = layout.row(align=True)
         row.template_header()
 
         TIME_MT_editor_menus.draw_collapsible(context, layout)
+        TIME_HT_editor_buttons.draw_header(context, layout)
+
+
+# Header buttons for actual timeline editor header
+# XXX: Temporary, until we have editor submodes in the actual editors menu
+class TIME_HT_editor_buttons(Header):
+    bl_idname = "TIME_HT_editor_buttons"
+    bl_space_type = 'TIMELINE' # XXX: Change this to 'DOPESHEET_EDITOR'
+    bl_label = ""
+
+    def draw(self, context):
+        pass
+
+    @staticmethod
+    def draw_header(context, layout):
+        scene = context.scene
+        toolsettings = context.tool_settings
+        screen = context.screen
+        userprefs = context.user_preferences
 
         row = layout.row(align=True)
         row.prop(scene, "use_preview_range", text="", toggle=True)
@@ -272,6 +286,7 @@ def marker_menu_generic(layout):
 
 classes = (
     TIME_HT_header,
+    TIME_HT_editor_buttons,
     TIME_MT_editor_menus,
     TIME_MT_marker,
     TIME_MT_view,
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 2a5c01fc671..dec41248053 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -230,6 +230,7 @@ static bool actedit_get_context(bAnimContext *ac, SpaceAction *saction)
 			ac->mode = saction->mode;
 			return true;
 		}
+		
 		case SACTCONT_DOPESHEET: /* DopeSheet */
 			/* update scene-pointer (no need to check for pinning yet, as not implemented) */
 			saction->ads.source = (ID *)ac->scene;
@@ -240,6 +241,16 @@ static bool actedit_get_context(bAnimContext *ac, SpaceAction *saction)
 			ac->mode = saction->mode;
 			return true;
 		
+		case SACTCONT_TIMELINE: /* Timeline */
+			/* update scene-pointer (no need to check for pinning yet, as not implemented) */
+			saction->ads.source = (ID *)ac->scene;
+			
+			ac->datatype = ANIMCONT_TIMELINE;
+			ac->data = &saction->ads;
+			
+			ac->mode = saction->mode;
+			return true;
+		
 		default: /* unhandled yet */
 			ac->datatype = ANIMCONT_NONE;
 			ac->data = NULL;
@@ -3244,6 +3255,15 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_F
 			}
 			
 			
+			/* Timeline Mode - Basically the same as dopesheet, except we only have the summary for now */
+			case ANIMCONT_TIMELINE:
+			{
+				/* the DopeSheet editor is the primary place where the DopeSheet summaries are useful */
+				if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items))
+					items += animdata_filter_dopesheet(ac, anim_data, data, filter_mode);
+				break;
+			}
+			
 			/* Special/Internal Use */
 			case ANIMCONT_CHANNEL: /* animation channel */
 			{
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index db141a2ee29..edcdb868ea4 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -102,7 +102,8 @@ typedef enum eAnimCont_Types {
 	ANIMCONT_DRIVERS   = 6, /* drivers (bDopesheet) */
 	ANIMCONT_NLA       = 7, /* nla (bDopesheet) */
 	ANIMCONT_CHANNEL   = 8, /* animation channel (bAnimListElem) */
-	ANIMCONT_MASK      = 9  /* mask dopesheet */
+	ANIMCONT_MASK      = 9, /* mask dopesheet */
+	ANIMCONT_TIMELINE  = 10, /* "timeline" editor (bDopeSheet) */
 } eAnimCont_Types;
 
 /* --------------- Channels -------------------- */
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index e1306253df8..f08199ad957 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -724,6 +724,8 @@ typedef enum eAnimEdit_Context {
 	SACTCONT_MASK = 4,
 	/* cache file */
 	SACTCONT_CACHEFILE = 5,
+	/* timeline - replacement for the standalone "timeline editor" */
+	SACTCONT_TIMELINE = 6,
 } eAnimEdit_Context;
 
 /* SpaceAction AutoSnap Settings (also used by other Animation Editors) */
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 92352a27e22..7ac6ed35068 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -3180,6 +3180,7 @@ static void rna_def_space_dopesheet(BlenderRNA *brna)
 
 	/* XXX: action-editor is currently for object-level only actions, so show that using object-icon hint */
 	static EnumPropertyItem mode_items[] = {
+		{SACTCONT_TIMELINE, "TIMELINE", ICON_TIME, "Timeline", "Timeline and playback controls"},
 		{SACTCONT_DOPESHEET, "DOPESHEET", ICON_OOPS, "Dope Sheet", "Edit all keyframes in scene"},
 		{SACTCONT_ACTION, "ACTION", ICON_OBJECT_DATA, "Action Editor", "Edit keyframes in active object's Object-level action"},
 		{SACTCONT_SHAPEKEY, "SHAPEKEY", ICON_SHAPEKEY_DATA, "Shape Key Editor", "Edit keyframes in active object's Shape Keys action"},



More information about the Bf-blender-cvs mailing list