use camera render argument to avoid temp overwriting the scene camera.
authorCampbell Barton <ideasman42@gmail.com>
Sat, 30 Apr 2011 05:42:37 +0000 (05:42 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 30 Apr 2011 05:42:37 +0000 (05:42 +0000)
also fix for mistake with rendering stars from previous commit.

source/blender/blenkernel/BKE_sequencer.h
source/blender/blenkernel/intern/sequencer.c
source/blender/editors/include/ED_view3d.h
source/blender/editors/render/render_opengl.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/render/intern/source/convertblender.c
source/blender/windowmanager/intern/wm_files.c

index 42786e1c9bec9136f14ec31a3ad078cee9508a5e..57829e957f7793d1a7ba85b02de171559f4edd17 100644 (file)
@@ -330,7 +330,7 @@ struct Sequence *sequencer_add_sound_strip(struct bContext *C, ListBase *seqbase
 struct Sequence *sequencer_add_movie_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load);
 
 /* view3d draw callback, run when not in background view */
-typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, int, int, unsigned int, int, char[256]);
+typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, struct Object *, int, int, unsigned int, int, char[256]);
 extern SequencerDrawView sequencer_view3d_cb;
 
 /* copy/paste */
index a4d11c9001951d599e9ba8177d144fb8badd9d81..3d40f0ba00aec8825077b0173815bae3e0871111 100644 (file)
@@ -1858,7 +1858,7 @@ static ImBuf * seq_render_scene_strip_impl(
        ImBuf * ibuf = NULL;
        float frame= seq->sfra + nr + seq->anim_startofs;
        float oldcfra;
-       Object *oldcamera;
+       Object *camera;
        ListBase oldmarkers;
        
        /* Old info:
@@ -1908,7 +1908,6 @@ static ImBuf * seq_render_scene_strip_impl(
                return NULL;
 
        oldcfra= seq->scene->r.cfra;
-       oldcamera= seq->scene->camera;
 
        /* prevent eternal loop */
        doseq= context.scene->r.scemode & R_DOSEQ;
@@ -1916,9 +1915,11 @@ static ImBuf * seq_render_scene_strip_impl(
        
        seq->scene->r.cfra= frame;
        if(seq->scene_camera)   
-               seq->scene->camera= seq->scene_camera;
-       else    
+               camera= seq->scene_camera;
+       else {  
                scene_camera_switch_update(seq->scene);
+               camera= seq->scene->camera;
+       }
        
 #ifdef DURIAN_CAMERA_SWITCH
        /* stooping to new low's in hackyness :( */
@@ -1934,7 +1935,7 @@ static ImBuf * seq_render_scene_strip_impl(
 
                /* opengl offscreen render */
                scene_update_for_newframe(context.bmain, seq->scene, seq->scene->lay);
-               ibuf= sequencer_view3d_cb(seq->scene, context.rectx, context.recty, IB_rect, context.scene->r.seq_prev_type, err_out);
+               ibuf= sequencer_view3d_cb(seq->scene, camera, context.rectx, context.recty, IB_rect, context.scene->r.seq_prev_type, err_out);
                if(ibuf == NULL) {
                        fprintf(stderr, "seq_render_scene_strip_impl failed to get opengl buffer: %s\n", err_out);
                }
@@ -1948,7 +1949,7 @@ static ImBuf * seq_render_scene_strip_impl(
                        if(re==NULL)
                                re= RE_NewRender(sce->id.name);
                        
-                       RE_BlenderFrame(re, context.bmain, sce, NULL, NULL, sce->lay, frame, FALSE);
+                       RE_BlenderFrame(re, context.bmain, sce, NULL, camera, sce->lay, frame, FALSE);
 
                        /* restore previous state after it was toggled on & off by RE_BlenderFrame */
                        G.rendering = rendering;
@@ -1982,7 +1983,7 @@ static ImBuf * seq_render_scene_strip_impl(
        context.scene->r.scemode |= doseq;
        
        seq->scene->r.cfra = oldcfra;
-       seq->scene->camera= oldcamera;
+
        if(frame != oldcfra)
                scene_update_for_newframe(context.bmain, seq->scene, seq->scene->lay);
        
index 4cac1a8d618c14a69a72fcdc55750ecb3d97b5e5..297bd234edd2d9ac806f0533fedf883212b68dcb 100644 (file)
@@ -175,7 +175,7 @@ void ED_view3d_draw_offscreen(struct Scene *scene, struct View3D *v3d, struct AR
        int winx, int winy, float viewmat[][4], float winmat[][4]);
 
 struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey, unsigned int flag, char err_out[256]);
-struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, unsigned int flag, int drawtype, char err_out[256]);
+struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, struct Object *camera, int width, int height, unsigned int flag, int drawtype, char err_out[256]);
 
 
 Base *ED_view3d_give_base_under_cursor(struct bContext *C, const short mval[2]);
index 7c1c2001b2fb317f6945419f3b71c3f163ecbf0c..626fbce1b2e9162876d5d9a98579e3e2ece652c2 100644 (file)
@@ -192,7 +192,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
        else {
                /* shouldnt suddenly give errors mid-render but possible */
                char err_out[256]= "unknown";
-               ImBuf *ibuf_view= ED_view3d_draw_offscreen_imbuf_simple(scene, oglrender->sizex, oglrender->sizey, IB_rectfloat, OB_SOLID, err_out);
+               ImBuf *ibuf_view= ED_view3d_draw_offscreen_imbuf_simple(scene, scene->camera, oglrender->sizex, oglrender->sizey, IB_rectfloat, OB_SOLID, err_out);
                camera= scene->camera;
 
                if(ibuf_view) {
index 78538a6f16df3a7eea4af5fdc7e0af1e42335f69..1bbad6220efb2021f1148172b20baa164d672da2 100644 (file)
@@ -2212,7 +2212,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
 }
 
 /* creates own 3d views, used by the sequencer */
-ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, unsigned int flag, int drawtype, char err_out[256])
+ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, Object *camera, int width, int height, unsigned int flag, int drawtype, char err_out[256])
 {
        View3D v3d= {NULL};
        ARegion ar= {NULL};
@@ -2223,7 +2223,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height
        ar.regiondata= &rv3d;
        ar.regiontype= RGN_TYPE_WINDOW;
 
-       v3d.camera= scene->camera;
+       v3d.camera= camera;
        v3d.lay= scene->lay;
        v3d.drawtype = drawtype;
        v3d.flag2 = V3D_RENDER_OVERRIDE;
index b7b97d81a60b4822af6b10367b8f69a7706ed1a9..9d96bd756dfac1d467da23bb77c38cb6bd215617 100644 (file)
@@ -164,7 +164,7 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
        World *wrld= NULL;
        HaloRen *har;
        Scene *scene;
-       Object *camera= re ? RE_GetCamera(re) : scene->camera;
+       Object *camera;
        Camera *cam;
        double dblrand, hlfrand;
        float vec[4], fx, fy, fz;
@@ -181,7 +181,7 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
                scene= re->scene;
                wrld= &(re->wrld);
        }
-       
+
        stargrid = wrld->stardist;                      /* distance between stars */
        maxrand = 2.0;                                          /* amount a star can be shifted (in grid units) */
        maxjit = (wrld->starcolnoise);          /* amount a color is being shifted */
@@ -206,6 +206,8 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
                * y = -z | +z
                */
 
+       camera= re ? RE_GetCamera(re) : scene->camera;
+
        if(camera==NULL || camera->type != OB_CAMERA)
                return;
 
index 05cf71fcd8325e5df88e6ca4c25937451e1033dc..fec60ac3dc8dc35e592689296bbdc9c3354c52b6 100644 (file)
@@ -602,7 +602,7 @@ static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt)
                return NULL;
 
        /* gets scaled to BLEN_THUMB_SIZE */
-       ibuf= ED_view3d_draw_offscreen_imbuf_simple(scene, BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2, IB_rect, OB_SOLID, err_out);
+       ibuf= ED_view3d_draw_offscreen_imbuf_simple(scene, scene->camera, BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2, IB_rect, OB_SOLID, err_out);
        
        if(ibuf) {              
                float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp);