diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-02-06 17:56:25 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-02-06 17:56:25 +0300 |
commit | bd0b26f7bbb9679d54d661349adc8dd6e7b138b9 (patch) | |
tree | 31c40344111dca34372ba9aa80872ae2caf3d625 /source/blender/blenkernel/intern | |
parent | eafdf42c24b2555ec97bbbb471091bc280e6759a (diff) |
bugfix [#20990] maker name don't show in render stamp
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 27 |
2 files changed, 26 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index a05e8516260..6280fb27430 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1011,9 +1011,9 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix) } if (scene->r.stamp & R_STAMP_MARKER) { - TimeMarker *marker = NULL; // XXX get_frame_marker(scene->r.cfra); + char *name = scene_find_last_marker_name(scene, CFRA); - if (marker) strcpy(text, marker->name); + if (name) strcpy(text, name); else strcpy(text, "<none>"); if (do_prefix) sprintf(stamp_data->marker, "Marker %s", text); diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 8034b5453c5..83663637f97 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -732,26 +732,47 @@ Object *scene_find_camera_switch(Scene *scene) } #endif -static char *get_cfra_marker_name(Scene *scene) +char *scene_find_marker_name(Scene *scene, int frame) { 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) + if (m1->frame==frame) return m1->name; if (m1 == m2) break; - if (m2->frame==CFRA) + if (m2->frame==frame) return m2->name; } return NULL; } +/* return the current marker for this frame, +we can have more then 1 marker per frame, this just returns the first :/ */ +char *scene_find_last_marker_name(Scene *scene, int frame) +{ + TimeMarker *marker, *best_marker = NULL; + int best_frame = -MAXFRAME*2; + for (marker= scene->markers.first; marker; marker= marker->next) { + if (marker->frame==frame) { + return marker; + } + + if ( marker->frame > best_frame && marker->frame < frame) { + best_marker = marker; + best_frame = marker->frame; + } + } + + return best_marker ? best_marker->name : NULL; +} + + Base *scene_add_base(Scene *sce, Object *ob) { Base *b= MEM_callocN(sizeof(*b), "scene_add_base"); |