diff options
author | Joshua Leung <aligorith@gmail.com> | 2018-06-21 08:15:45 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2018-06-21 08:15:45 +0300 |
commit | b081436d1c82f46ffa22bca5c72f0bd3cb20b5f1 (patch) | |
tree | ec6f379debaceae267065e8fc2700b23e0351f2e /source/blender/makesrna | |
parent | 876c73c9af223a807f97b463c32e8b6e190983e8 (diff) |
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
skipped)
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.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 11 |
1 files changed, 10 insertions, 1 deletions
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 */ |