Cleanup: moar G.main removal.

Nice trick from blender2.8, we now can get active scene from active
window of windowmanager!
This commit is contained in:
Bastien Montagne 2018-06-20 11:53:30 +02:00
parent edb80a801d
commit 20788e1747
2 changed files with 4 additions and 4 deletions

@ -181,14 +181,14 @@ static void graph_free(SpaceLink *sl)
/* spacetype; init callback */
static void graph_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
static void graph_init(struct wmWindowManager *wm, ScrArea *sa)
{
SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first;
/* init dopesheet data if non-existent (i.e. for old files) */
if (sipo->ads == NULL) {
sipo->ads = MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet");
sipo->ads->source = (ID *)(G.main->scene.first); // FIXME: this is a really nasty hack here for now...
sipo->ads->source = (ID *)WM_window_get_active_scene(wm->winactive);
}
/* force immediate init of any invalid F-Curve colors */

@ -178,14 +178,14 @@ static void nla_free(SpaceLink *sl)
/* spacetype; init callback */
static void nla_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
static void nla_init(struct wmWindowManager *wm, ScrArea *sa)
{
SpaceNla *snla = (SpaceNla *)sa->spacedata.first;
/* init dopesheet data if non-existent (i.e. for old files) */
if (snla->ads == NULL) {
snla->ads = MEM_callocN(sizeof(bDopeSheet), "NlaEdit DopeSheet");
snla->ads->source = (ID *)G.main->scene.first; // XXX this is bad, but we need this to be set correct
snla->ads->source = (ID *)WM_window_get_active_scene(wm->winactive);
}
ED_area_tag_refresh(sa);