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 | |
parent | eafdf42c24b2555ec97bbbb471091bc280e6759a (diff) |
bugfix [#20990] maker name don't show in render stamp
-rw-r--r-- | source/blender/blenkernel/BKE_scene.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 27 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 23 |
4 files changed, 30 insertions, 27 deletions
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index c372004bd19..ca75ac83a84 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -68,6 +68,9 @@ int next_object(struct Scene *scene, int val, struct Base **base, struct Object struct Object *scene_find_camera(struct Scene *sc); struct Object *scene_find_camera_switch(struct Scene *scene); // DURIAN_CAMERA_SWITCH +char *scene_find_marker_name(struct Scene *scene, int frame); +char *scene_find_last_marker_name(struct Scene *scene, int frame); + struct Base *scene_add_base(struct Scene *sce, struct Object *ob); void scene_deselect_all(struct Scene *sce); void scene_select_base(struct Scene *sce, struct Base *selbase); 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"); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 067098312ff..c33f8723231 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -755,27 +755,6 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d) } } - -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; -} - /* draw info beside axes in bottom left-corner: * framenum, object name, bone name (if available), marker name (if available) */ @@ -785,7 +764,7 @@ static void draw_selected_name(Scene *scene, Object *ob, View3D *v3d) short offset=30; /* get name of marker on current frame (if available) */ - markern= get_cfra_marker_name(scene); + markern= scene_find_marker_name(scene, CFRA); /* check if there is an object */ if(ob) { |