Commit: 20788e174751797c8c3f225f63444939cb8c54bf
Author: Bastien Montagne
Date:   Wed Jun 20 11:53:30 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB20788e174751797c8c3f225f63444939cb8c54bf

Cleanup: moar G.main removal.

Nice trick from blender2.8, we now can get active scene from active
window of windowmanager!

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

M       source/blender/editors/space_graph/space_graph.c
M       source/blender/editors/space_nla/space_nla.c

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

diff --git a/source/blender/editors/space_graph/space_graph.c 
b/source/blender/editors/space_graph/space_graph.c
index 59d7d7500ae..d208ead317b 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -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 */
diff --git a/source/blender/editors/space_nla/space_nla.c 
b/source/blender/editors/space_nla/space_nla.c
index 639195c16ac..745cea37ea3 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -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);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to