==renderer==
authorKen Hughes <khughes@pacific.edu>
Wed, 18 Jan 2006 20:06:13 +0000 (20:06 +0000)
committerKen Hughes <khughes@pacific.edu>
Wed, 18 Jan 2006 20:06:13 +0000 (20:06 +0000)
Patch #3760: Allows a python script to call renderer when the UI is not
active (thanks to Cory King for patch).  Without the patch, blender will
segfault since G.vd is NULL.

source/blender/src/renderwin.c

index 949dfd27cbae4ddd7317b99c06a57c652609ad2e..87b4e0654b323bdd466f59e234d69d922e05fc8c 100644 (file)
@@ -1171,9 +1171,16 @@ void BIF_do_render(int anim)
        /* if start render in 3d win, use layer from window (e.g also local view) */
        if(curarea && curarea->spacetype==SPACE_VIEW3D) {
                int lay= G.scene->lay;
-               if(G.vd->lay & 0xFF000000)      // localview
-                       G.scene->lay |= G.vd->lay;
-               else G.scene->lay= G.vd->lay;
+               /*
+                * if view is defined (might not be if called form script), check
+                * and set layers
+                */
+               if(G.vd) {
+                       if(G.vd->lay & 0xFF000000)      // localview
+                               G.scene->lay |= G.vd->lay;
+                       else
+                               G.scene->lay= G.vd->lay;
+               }
                
                do_render(NULL, anim, 0);