diff options
author | Joshua Leung <aligorith@gmail.com> | 2018-05-22 17:18:09 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2018-05-22 17:44:13 +0300 |
commit | c685c19df9513a3263e78b417a87fc102840437e (patch) | |
tree | 52e8e2cd61d6b9969fa414771dbf9fbf1e91515c /source/blender/windowmanager | |
parent | 6f127b22e6dba418e0e0e04e6f702db74f86e73e (diff) |
Drivers UI (Part of T55145): Add "Show Drivers Editor" entry to RMB menus
This commit adds an operator, "Show Drivers Editor", to the RMB menu when
clicking on properties.
As per T54653, this will open a new Graph Editor instance in a new/separate
window (much like how the User Preferences show up in a popup window now),
and will configure all the relevant panels so that you can see and edit the
driver settings immediately without doing a lot of the view configuration steps
that were previously needed.
When doing so on a property that is driven, the driver/fcurve for that property
will be made active in the editor, ready for you to start editing its settings
without having to hunt it down again first.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 33 |
2 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 33222b2f1f1..bda22929ce8 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -136,6 +136,7 @@ void WM_opengl_context_release(void *context); enum { WM_WINDOW_RENDER = 1, WM_WINDOW_USERPREFS, + WM_WINDOW_DRIVERS, // WM_WINDOW_FILESEL // UNUSED }; diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 2c28819ee58..ef1e4d24e7f 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -937,6 +937,9 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i if (type == WM_WINDOW_RENDER) { ED_area_newspace(C, sa, SPACE_IMAGE, false); } + else if (type == WM_WINDOW_DRIVERS) { + ED_area_newspace(C, sa, SPACE_IPO, false); + } else { ED_area_newspace(C, sa, SPACE_USERPREF, false); } @@ -944,12 +947,42 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i ED_screen_change(C, screen); ED_screen_refresh(CTX_wm_manager(C), win); /* test scale */ + /* do additional setup for specific editor type */ + if (type == WM_WINDOW_DRIVERS) { + /* Configure editor - mode, tabs, framing */ + SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first; + sipo->mode = SIPO_MODE_DRIVERS; + + ARegion *ar_props = BKE_area_find_region_type(sa, RGN_TYPE_UI); + if (ar_props) { + UI_panel_category_active_set(ar_props, "Drivers"); + + ar_props->flag &= ~RGN_FLAG_HIDDEN; + /* XXX: Adjust width of this too? */ + + ED_region_visibility_change_update(C, ar_props); + } + + ARegion *ar_main = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); + if (ar_main) { + /* XXX: Ideally we recenter based on the range instead... */ + ar_main->v2d.tot.xmin = -2.0f; + ar_main->v2d.tot.ymin = -2.0f; + ar_main->v2d.tot.xmax = 2.0f; + ar_main->v2d.tot.ymax = 2.0f; + + ar_main->v2d.cur = ar_main->v2d.tot; + } + } + if (sa->spacetype == SPACE_IMAGE) title = IFACE_("Blender Render"); else if (ELEM(sa->spacetype, SPACE_OUTLINER, SPACE_USERPREF)) title = IFACE_("Blender User Preferences"); else if (sa->spacetype == SPACE_FILE) title = IFACE_("Blender File View"); + else if (sa->spacetype == SPACE_IPO) + title = IFACE_("Blender Drivers Editor"); else title = "Blender"; |