diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-03-09 10:41:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-03-09 10:41:04 +0300 |
commit | d4756d395bde04dc6cfeed696df1c38211ffbff9 (patch) | |
tree | f4c3a707b6ba88088036432de874ae1047cd9d7d | |
parent | 9c513346a57d3a6b000822685158b67d56d5d99f (diff) |
remove for bad-level-call & some minor changes to make camera switching neater.
-rw-r--r-- | source/blender/blenkernel/BKE_scene.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_sequencer.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 14 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 14 | ||||
-rw-r--r-- | source/blender/editors/include/ED_view3d.h | 24 | ||||
-rw-r--r-- | source/blender/editors/render/render_opengl.c | 6 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/space_sequencer.c | 16 | ||||
-rw-r--r-- | source/blender/render/intern/source/pipeline.c | 6 |
9 files changed, 47 insertions, 42 deletions
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index d1b4e5aef1a..09fb705dd70 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -66,7 +66,8 @@ void unlink_scene(struct Main *bmain, struct Scene *sce, struct Scene *newsce); int next_object(struct Scene *scene, int val, struct Base **base, struct Object **ob); struct Object *scene_find_camera(struct Scene *sc); -struct Object *scene_find_camera_switch(struct Scene *scene); // DURIAN_CAMERA_SWITCH +struct Object *scene_camera_switch_find(struct Scene *scene); // DURIAN_CAMERA_SWITCH +int scene_camera_switch_update(struct Scene *scene); char *scene_find_marker_name(struct Scene *scene, int frame); char *scene_find_last_marker_name(struct Scene *scene, int frame); diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index b0a810203cf..21cd2f694ca 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -233,6 +233,10 @@ struct Sequence *sequencer_add_image_strip(struct bContext *C, ListBase *seqbase struct Sequence *sequencer_add_sound_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load); 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); +extern SequencerDrawView sequencer_view3d_cb; + /* copy/paste */ extern ListBase seqbase_clipboard; extern int seqbase_clipboard_frame; diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index ca5efbef053..3f0ef5f5bff 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -722,7 +722,7 @@ Object *scene_find_camera(Scene *sc) } #ifdef DURIAN_CAMERA_SWITCH -Object *scene_find_camera_switch(Scene *scene) +Object *scene_camera_switch_find(Scene *scene) { TimeMarker *m; int cfra = scene->r.cfra; @@ -743,6 +743,18 @@ Object *scene_find_camera_switch(Scene *scene) } #endif +int scene_camera_switch_update(Scene *scene) +{ +#ifdef DURIAN_CAMERA_SWITCH + Object *camera= scene_camera_switch_find(scene); + if(camera) { + scene->camera= camera; + return 1; + } +#endif + return 0; +} + char *scene_find_marker_name(Scene *scene, int frame) { ListBase *markers= &scene->markers; diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 994bbc3e70e..3a85676e23b 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -81,7 +81,7 @@ static int seqrecty= 0; #define SELECT 1 ListBase seqbase_clipboard; int seqbase_clipboard_frame; -void *sequencer_view3d_cb= NULL; /* NULL in background mode */ +SequencerDrawView sequencer_view3d_cb= NULL; /* NULL in background mode */ void printf_strip(Sequence *seq) @@ -1940,8 +1940,6 @@ static void check_limiter_refcount_comp(const char * func, TStripElem *se) static TStripElem* do_build_seq_array_recursively(Scene *scene, ListBase *seqbasep, int cfra, int chanshown, int render_size); -extern ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height); - static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int cfra, int build_proxy_run, int render_size) { @@ -2160,16 +2158,12 @@ static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int seq->scene->r.cfra= frame; - if(G.background==0 && (seq->flag & SEQ_USE_SCENE_OPENGL) && have_seq==0) { + if(sequencer_view3d_cb && (seq->flag & SEQ_USE_SCENE_OPENGL) && have_seq==0) { /* opengl offscreen render */ -#ifdef DURIAN_CAMERA_SWITCH - Object *camera= scene_find_camera_switch(seq->scene); - if(camera) - seq->scene->camera= camera; -#endif + scene_camera_switch_update(seq->scene); scene_update_for_newframe(seq->scene, seq->scene->lay); - se->ibuf= ED_view3d_draw_offscreen_imbuf_simple(seq->scene, seqrectx, seqrecty); // BAD LEVEL CALL! DONT ALLOW THIS FOR MORE THEN A FEW DAYS, USE A CALLBACK!!! - campell + se->ibuf= sequencer_view3d_cb(seq->scene, seqrectx, seqrecty); } else { RenderResult rres; diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index a4035cef880..dfae3e6dda6 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -30,28 +30,30 @@ /* ********* exports for space_view3d/ module ********** */ struct ARegion; -struct BoundBox; -struct View3D; -struct RegionView3D; -struct ViewContext; +struct bContext; +struct BezTriple; struct bglMats; +struct BoundBox; struct BPoint; -struct Nurb; -struct BezTriple; -struct EditVert; struct EditEdge; struct EditFace; +struct EditVert; struct ImBuf; -struct Scene; -struct bContext; struct Main; +struct Nurb; +struct Object; struct rcti; +struct RegionView3D; +struct Scene; +struct View3D; +struct ViewContext; + /* for derivedmesh drawing callbacks, for view3d_select, .... */ typedef struct ViewContext { Scene *scene; - Object *obact; - Object *obedit; + struct Object *obact; + struct Object *obedit; struct ARegion *ar; struct View3D *v3d; struct RegionView3D *rv3d; diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 212dc335a63..ae0d67626cf 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -292,10 +292,8 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) if(oglrender->rv3d->persp==RV3D_CAMOB && oglrender->v3d->camera && oglrender->v3d->scenelock) { /* since scene_update_for_newframe() is used rather * then ED_update_for_newframe() the camera needs to be set */ - Object *camera= scene_find_camera_switch(scene); - - if(camera) - oglrender->v3d->camera= scene->camera= camera; + if(scene_camera_switch_update(scene)) + oglrender->v3d->camera= scene->camera; } /* render into offscreen buffer */ diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 180bbb3ea58..8dc06c4f3b8 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1715,7 +1715,7 @@ void ED_update_for_newframe(const bContext *C, int mute) Scene *scene= CTX_data_scene(C); #ifdef DURIAN_CAMERA_SWITCH - void *camera= scene_find_camera_switch(scene); + void *camera= scene_camera_switch_find(scene); if(camera && scene->camera != camera) { if(camera && scene->camera && (camera != scene->camera)) { diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 33cb0f5cdd5..05e802ad60f 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -29,36 +29,29 @@ #include <string.h> #include <stdio.h> -#include "DNA_object_types.h" #include "DNA_space_types.h" #include "DNA_scene_types.h" -#include "DNA_screen_types.h" #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_rand.h" -#include "BKE_colortools.h" #include "BKE_context.h" #include "BKE_screen.h" #include "BKE_sequencer.h" +#include "BKE_global.h" #include "ED_space_api.h" #include "ED_screen.h" - -#include "BIF_gl.h" +#include "ED_view3d.h" /* only for sequencer view3d drawing callback */ #include "WM_api.h" #include "WM_types.h" -#include "UI_interface.h" #include "UI_resources.h" #include "UI_view2d.h" -#include "ED_markers.h" - #include "sequencer_intern.h" // own include /* ******************** manage regions ********************* */ @@ -540,5 +533,10 @@ void ED_spacetype_sequencer(void) BLI_addhead(&st->regiontypes, art); BKE_spacetype_register(st); + + /* set the sequencer callback when not in background mode */ + if(G.background==0) { + sequencer_view3d_cb= ED_view3d_draw_offscreen_imbuf_simple; + } } diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 0122f1b5d65..385191f93bc 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2584,11 +2584,7 @@ static void do_render_seq(Render * re) /* main loop: doing sequence + fields + blur + 3d render + compositing */ static void do_render_all_options(Render *re) { -#ifdef DURIAN_CAMERA_SWITCH - Object *camera= scene_find_camera_switch(re->scene); - if(camera) - re->scene->camera= camera; -#endif + scene_camera_switch_update(re->scene); re->i.starttime= PIL_check_seconds_timer(); |