use camera render argument to avoid temp overwriting the scene camera.
also fix for mistake with rendering stars from previous commit.
This commit is contained in:
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user