[Bf-blender-cvs] [b081436d1c8] blender2.8: Graph Editor: Changing the display mode to "Drivers" mode now runs the Drivers-Editor UI setup code

Joshua Leung noreply at git.blender.org
Thu Jun 21 07:56:54 CEST 2018

Commit: b081436d1c82f46ffa22bca5c72f0bd3cb20b5f1
Author: Joshua Leung
Date:   Thu Jun 21 17:15:45 2018 +1200
Branches: blender2.8

Graph Editor: Changing the display mode to "Drivers" mode now runs the Drivers-Editor UI setup code

This is a step towards being able to just choose the "Drivers Editor"
from the editor selector, and have everything displayed, ready to use.

Currently there are a few problems to resolve still:
1) This update callback doesn't run when changing the mode via the
   editors selector in the UI. (Note: This problem also affects the
   Timeline vs Dopesheet, causing a lot of initialisation work to be

2) There's some missing redraw/refresh here to cause the properties
   region to actually show. You need to resize the window for that to
   happen now.


M	source/blender/makesrna/intern/rna_space.c


diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 11d30721c9e..f531e4e2041 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -327,6 +327,7 @@ const EnumPropertyItem rna_enum_file_sort_items[] = {
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_build.h"
+#include "ED_anim_api.h"
 #include "ED_buttons.h"
 #include "ED_fileselect.h"
 #include "ED_image.h"
@@ -1528,9 +1529,16 @@ static void rna_SpaceDopeSheetEditor_mode_update(bContext *C, PointerRNA *ptr)
 /* Space Graph Editor */
-static void rna_SpaceGraphEditor_display_mode_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_SpaceGraphEditor_display_mode_update(bContext *C, PointerRNA *ptr)
 	ScrArea *sa = rna_area_from_space(ptr);
+	SpaceIpo *sipo = (SpaceIpo *)ptr->data;
+	/* for "Drivers" mode, enable all the necessary bits and pieces */
+	if (sipo->mode == SIPO_MODE_DRIVERS) {
+		ED_drivers_editor_init(C, sa);
+		ED_area_tag_redraw(sa);
+	}
 	/* after changing view mode, must force recalculation of F-Curve colors
 	 * which can only be achieved using refresh as opposed to redraw
@@ -3750,6 +3758,7 @@ static void rna_def_space_graph(BlenderRNA *brna)
 	RNA_def_property_enum_sdna(prop, NULL, "mode");
 	RNA_def_property_enum_items(prop, rna_enum_space_graph_mode_items);
 	RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
+	RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, "rna_SpaceGraphEditor_display_mode_update");
 	/* display */

More information about the Bf-blender-cvs mailing list