From c3401eb5cb0833dc76eff1e90e573b487181ec81 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 16 Dec 2009 19:49:33 +0000 Subject: camera switching via markers Currently access by selecting a marking and binding with the active camera from the view menu. Note: after long discussion we decieded there is no nice way to do this.. animate pointers? animate multiple camera visibility?, use sequencer? use NLA?.... have a kind of event system (like framechange scriptlinks)... etc so this is ifdef'd with DURIAN_CAMERA_SWITCH --- source/blender/blenkernel/intern/scene.c | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'source/blender/blenkernel/intern/scene.c') diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 4312f23bd9b..7bfeac037ce 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -698,6 +698,47 @@ Object *scene_find_camera(Scene *sc) return NULL; } +#ifdef DURIAN_CAMERA_SWITCH +Object *scene_find_camera_switch(Scene *scene) +{ + TimeMarker *m; + int cfra = scene->r.cfra; + int frame = -(MAXFRAME + 1); + Object *camera= NULL; + + for (m= scene->markers.first; m; m= m->next) { + if(m->camera && (m->frame <= cfra) && (m->frame > frame)) { + camera= m->camera; + frame= m->frame; + + if(frame == cfra) + break; + + } + } + return camera; +} +#endif + +static char *get_cfra_marker_name(Scene *scene) +{ + ListBase *markers= &scene->markers; + TimeMarker *m1, *m2; + + /* search through markers for match */ + for (m1=markers->first, m2=markers->last; m1 && m2; m1=m1->next, m2=m2->prev) { + if (m1->frame==CFRA) + return m1->name; + + if (m1 == m2) + break; + + if (m2->frame==CFRA) + return m2->name; + } + + return NULL; +} Base *scene_add_base(Scene *sce, Object *ob) { -- cgit v1.2.3