Fix for #35147, view in backdrop and image editor in compositor don't work anymore...
authorLukas Toenne <lukas.toenne@googlemail.com>
Tue, 30 Apr 2013 07:40:15 +0000 (07:40 +0000)
committerLukas Toenne <lukas.toenne@googlemail.com>
Tue, 30 Apr 2013 07:40:15 +0000 (07:40 +0000)
source/blender/blenloader/intern/readfile.c

index a2e97e8063c93b7c40fecd1fc02a358570f996e6..78fcc22ea66533dab1efbcd511d7f4f4fa10203a 100644 (file)
@@ -9396,6 +9396,41 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                }
        }
 
+       {
+               /* Initialize the active_viewer_key for compositing */
+               bScreen *screen;
+               Scene *scene;
+               bNodeInstanceKey active_viewer_key = {0};
+               /* simply pick the first node space and use that for the active viewer key */
+               for (screen = main->screen.first; screen; screen = screen->id.next) {
+                       ScrArea *sa;
+                       for (sa = screen->areabase.first; sa; sa = sa->next) {
+                               SpaceLink *sl;
+                               for (sl = sa->spacedata.first; sl; sl= sl->next) {
+                                       if (sl->spacetype == SPACE_NODE) {
+                                               SpaceNode *snode = (SpaceNode *)sl;
+                                               bNodeTreePath *path = snode->treepath.last;
+                                               if (!path)
+                                                       continue;
+                                               
+                                               active_viewer_key = path->parent_key;
+                                               break;
+                                       }
+                               }
+                               if (active_viewer_key.value != 0)
+                                       break;
+                       }
+                       if (active_viewer_key.value != 0)
+                               break;
+               }
+               
+               for (scene = main->scene.first; scene; scene = scene->id.next) {
+                       /* NB: scene->nodetree is a local ID block, has been direct_link'ed */
+                       if (scene->nodetree)
+                               scene->nodetree->active_viewer_key = active_viewer_key;
+               }
+       }
+
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
        /* WATCH IT 2!: Userdef struct init see do_versions_userdef() above! */