Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-07-09 14:55:41 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-09 14:55:41 +0400
commit98969c64ff69d8a35bd9a3dff7bc48cf40f1175e (patch)
treecda5ebc6c8060593f6397182095fd2e674f5a97b /source/blender/blenkernel
parent0966a3b191f124eb2fd7a7241c860feaad65ef7a (diff)
code cleanup: move sequencer timecode into its own func.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/image.c46
1 files changed, 26 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 61cfc8e747b..658be1fb494 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1312,6 +1312,31 @@ void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const ImBuf *i
}
+static void timecode_simple_string(char *text, size_t text_size, const int cfra, int const frs_sec)
+{
+ int f = (int)(cfra % frs_sec);
+ int s = (int)(cfra / frs_sec);
+ int h = 0;
+ int m = 0;
+
+ if (s) {
+ m = (int)(s / 60);
+ s %= 60;
+
+ if (m) {
+ h = (int)(m / 60);
+ m %= 60;
+ }
+ }
+
+ if (frs_sec < 100) {
+ BLI_snprintf(text, text_size, "%02d:%02d:%02d.%02d", h, m, s, f);
+ }
+ else {
+ BLI_snprintf(text, text_size, "%02d:%02d:%02d.%03d", h, m, s, f);
+ }
+}
+
/* could allow access externally - 512 is for long names, 64 is for id names */
typedef struct StampData {
char file[512];
@@ -1371,26 +1396,7 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
}
if (scene->r.stamp & R_STAMP_TIME) {
- int f = (int)(scene->r.cfra % scene->r.frs_sec);
- int s = (int)(scene->r.cfra / scene->r.frs_sec);
- int h = 0;
- int m = 0;
-
- if (s) {
- m = (int)(s / 60);
- s %= 60;
-
- if (m) {
- h = (int)(m / 60);
- m %= 60;
- }
- }
-
- if (scene->r.frs_sec < 100)
- BLI_snprintf(text, sizeof(text), "%02d:%02d:%02d.%02d", h, m, s, f);
- else
- BLI_snprintf(text, sizeof(text), "%02d:%02d:%02d.%03d", h, m, s, f);
-
+ timecode_simple_string(text, sizeof(text), scene->r.cfra, scene->r.frs_sec);
BLI_snprintf(stamp_data->time, sizeof(stamp_data->time), do_prefix ? "Time %s" : "%s", text);
}
else {