Brought back the Scene strip in Sequencer. Even does a full composite with
authorTon Roosendaal <ton@blender.org>
Sun, 21 May 2006 20:59:54 +0000 (20:59 +0000)
committerTon Roosendaal <ton@blender.org>
Sun, 21 May 2006 20:59:54 +0000 (20:59 +0000)
only images input in compositor. Currently still renders in the scene's
own resolution. It also doesn't show scanline/tile updates yet while
rendering.

source/blender/render/intern/source/pipeline.c
source/blender/src/renderwin.c
source/blender/src/sequence.c

index d0b876b8b0f152e8195aa34eeb87a3568cb514ce..263b044cd940ca97962bc1551eeac9a763202058 100644 (file)
@@ -693,13 +693,13 @@ Render *RE_NewRender(const char *name)
        
        /* only one render per name exists */
        re= RE_GetRender(name);
-       if(re)
-               return re;
-       
-       /* new render data struct */
-       re= MEM_callocT(sizeof(Render), "new render");
-       BLI_addtail(&RenderList, re);
-       strncpy(re->name, name, RE_MAXNAME);
+       if(re==NULL) {
+               
+               /* new render data struct */
+               re= MEM_callocT(sizeof(Render), "new render");
+               BLI_addtail(&RenderList, re);
+               strncpy(re->name, name, RE_MAXNAME);
+       }
        
        /* set default empty callbacks */
        re->display_init= result_nothing;
@@ -1507,10 +1507,14 @@ void RE_BlenderFrame(Render *re, Scene *scene, int frame)
        /* is also set by caller renderwin.c */
        G.rendering= 1;
        
+       scene->r.cfra= frame;
+       
        if(render_initialize_from_scene(re, scene)) {
                do_render_final(re);
-               
        }
+       
+       /* UGLY WARNING */
+       G.rendering= 0;
 }
 
 static void do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh)
@@ -1627,6 +1631,9 @@ void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra)
                mh->end_movie();
 
        scene->r.cfra= cfrao;
+       
+       /* UGLY WARNING */
+       G.rendering= 0;
 }
 
 /* note; repeated win/disprect calc... solve that nicer, also in compo */
index 8032d443b8f663dc85d1f4be08704dac5d2a9db5..d479b9e374744f780ebd08b816e6f5e76907a8a3 100644 (file)
@@ -1060,7 +1060,8 @@ static void do_render(int anim)
        unsigned int lay= G.scene->lay;
        int scemode= G.scene->r.scemode;
        
-       /* we set this flag to prevent renderwindow queue to execute another render */
+       /* UGLY! we set this flag to prevent renderwindow queue to execute another render */
+       /* is reset in RE_BlenderFrame */
        G.rendering= 1;
        G.afbreek= 0;
 
@@ -1111,10 +1112,7 @@ static void do_render(int anim)
 //                     BIF_preview_changed(ID_TE);
 //             }
        allqueue(REDRAWBUTSSCENE, 0);   // visualize fbuf for example
-       
-       // before scene update!
-       G.rendering= 0;
-       
+               
        scene_update_for_newframe(G.scene, G.scene->lay);       // no redraw needed, this restores to view as we left it
        
        waitcursor(0);
index c5a46fc36745bea529d82efcc76c48c38aa3c382..d4bae7a6d658ee388073662fb7175c63e52b0060 100644 (file)
 #include "DNA_sequence_types.h"
 #include "DNA_view3d_types.h"
 
-#include "BKE_utildefines.h"
 #include "BKE_global.h"
-#include "BKE_texture.h"
 #include "BKE_image.h"
+#include "BKE_ipo.h"
 #include "BKE_main.h"
 #include "BKE_scene.h"
-#include "BKE_ipo.h"
+#include "BKE_texture.h"
+#include "BKE_utildefines.h"
 
+#include "BIF_editsound.h"
+#include "BIF_editseq.h"
 #include "BSE_filesel.h"
-#include "BIF_interface.h"
 #include "BSE_headerbuttons.h"
+#include "BIF_interface.h"
+#include "BIF_renderwin.h"
 #include "BIF_screen.h"
 #include "BIF_space.h"
 #include "BIF_toolbox.h"
-#include "BIF_editsound.h"
-#include "BIF_editseq.h"
 
 #include "BSE_sequence.h"
 #include "BSE_seqeffects.h"
@@ -886,73 +887,37 @@ static void do_build_seq_ibuf(Sequence * seq, int cfra)
                                }
                        }
                        else if(seq->type==SEQ_SCENE && se->ibuf==0 && seq->scene) {    // scene can be NULL after deletions
-                               printf("Sorry, sequence scene is not yet back...\n");
-#if 0
-                               View3D *vd;
-                               Scene *oldsce;
-                               unsigned int *rectot;
-                               int oldcfra, doseq;
-                               int redisplay= (!G.background && !G.rendering);
+                               Scene *sce= seq->scene, *oldsce= G.scene;
+                               Render *re= RE_NewRender(sce->id.name);
+                               RenderResult rres;
+                               int doseq;
                                
-                               oldsce= G.scene;
-                               if(seq->scene!=G.scene) set_scene_bg(seq->scene);
+                               waitcursor(1);
                                
                                /* prevent eternal loop */
-                               doseq= G.scene->r.scemode & R_DOSEQ;
-                               G.scene->r.scemode &= ~R_DOSEQ;
-                               
-                               /* store Current FRAme */
-                               oldcfra= CFRA;
+                               doseq= sce->r.scemode & R_DOSEQ;
+                               sce->r.scemode &= ~R_DOSEQ;
                                
-                               CFRA= ( seq->sfra + se->nr );
+                               /* hrms, set_scene still needed? work on that... */
+                               set_scene_bg(sce);
+                               RE_BlenderFrame(re, sce, seq->sfra + se->nr);
+                               set_scene_bg(oldsce);
                                
-                               waitcursor(1);
-                               
-                               rectot= R.rectot; R.rectot= NULL;
-                               oldx= R.rectx; oldy= R.recty;
-                               /* needed because current 3D window cannot define the layers, like in a background render */
-                               vd= G.vd;
-                               G.vd= NULL;
+                               RE_GetResultImage(re, &rres);
                                
-                               RE_initrender(NULL);
-                               if (redisplay) {
-                                       mainwindow_make_active();
-                                       if(R.r.mode & R_FIELDS) update_for_newframe_muted();
-                                       R.flag= 0;
-                                       
-                                       free_filesel_spec(G.scene->r.pic);
-                               }
-                               
-                               se->ibuf= IMB_allocImBuf(R.rectx, R.recty, 32, IB_rect, 0);
-                               if(R.rectot) memcpy(se->ibuf->rect, R.rectot, 4*R.rectx*R.recty);
-                               if(R.rectz) {
-                                       se->ibuf->zbuf= (int *)R.rectz;
-                                       /* make sure ibuf frees it */
-                                       se->ibuf->mall |= IB_zbuf;
-                                       R.rectz= NULL;
+                               if(rres.rectf) {
+                                       se->ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat, 0);
+                                       memcpy(se->ibuf->rect_float, rres.rectf, 4*sizeof(float)*rres.rectx*rres.recty);
+                                       if(rres.rectz) {
+                                               /* not yet */
+                                       }
                                }
                                
-                               /* and restore */
-                               G.vd= vd;
-                               
-                               if((G.f & G_PLAYANIM)==0) waitcursor(0);
-                               CFRA= oldcfra;
-                               if(R.rectot) MEM_freeN(R.rectot);
-                               R.rectot= rectot;
-                               R.rectx=oldx; R.recty=oldy;
-                               G.scene->r.scemode |= doseq;
-                               if(seq->scene!=oldsce) set_scene_bg(oldsce);    /* set_scene does full dep updates */
-                               
-                               /* restore!! */
-                               R.rectx= seqrectx;
-                               R.recty= seqrecty;
+                               /* restore */
+                               sce->r.scemode |= doseq;
                                
-                               /* added because this flag is checked for
-                                * movie writing when rendering an anim.
-                                * very convoluted. fix. -zr
-                                */
-                               R.r.imtype= G.scene->r.imtype;
-#endif
+                               if((G.f & G_PLAYANIM)==0) /* bad, is set on do_render_seq */
+                                       waitcursor(0);
                        }
                        
                        /* size test */