[Bf-blender-cvs] [6c3110a6612] master: Write the scene render frame range to image/video files

Sybren A. Stüvel noreply at git.blender.org
Thu Apr 5 16:51:08 CEST 2018


Commit: 6c3110a66122f33a3c4df3066c42374660dad067
Author: Sybren A. Stüvel
Date:   Thu Apr 5 16:33:32 2018 +0200
Branches: master
https://developer.blender.org/rB6c3110a66122f33a3c4df3066c42374660dad067

Write the scene render frame range to image/video files

This is useful to create a mapping from the frame range in the video to
frame index in the blend file.

Part of: https://developer.blender.org/D2273

Reviewed by: @campbellbarton

===================================================================

M	release/scripts/startup/bl_ui/properties_render.py
M	source/blender/blenkernel/intern/image.c
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_scene.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index 41ebf8196d2..3e6de3503d9 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -369,6 +369,7 @@ class RENDER_PT_stamp(RenderButtonsPanel, Panel):
         col.prop(rd, "use_stamp_camera", text="Camera")
         col.prop(rd, "use_stamp_lens", text="Lens")
         col.prop(rd, "use_stamp_filename", text="Filename")
+        col.prop(rd, "use_stamp_frame_range", text="Frame range")
         col.prop(rd, "use_stamp_marker", text="Marker")
         col.prop(rd, "use_stamp_sequencer_strip", text="Seq. Strip")
 
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 34891d95669..6abffd83a4d 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1711,6 +1711,15 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
 		stamp_data->frame[0] = '\0';
 	}
 
+	if (scene->r.stamp & R_STAMP_FRAME_RANGE) {
+		BLI_snprintf(stamp_data->frame_range, sizeof(stamp_data->frame),
+		             do_prefix ? "Frame Range %d:%d" : "%d:%d",
+		             scene->r.sfra, scene->r.efra);
+	}
+	else {
+		stamp_data->frame_range[0] = '\0';
+	}
+
 	if (use_dynamic && scene->r.stamp & R_STAMP_CAMERA) {
 		BLI_snprintf(stamp_data->camera, sizeof(stamp_data->camera), do_prefix ? "Camera %s" : "%s", camera ? camera->id.name + 2 : "<none>");
 	}
@@ -1771,6 +1780,13 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
 			stamp_data->memory[0] = '\0';
 		}
 	}
+	if (scene->r.stamp & R_STAMP_FRAME_RANGE) {
+		BLI_snprintf(stamp_data->frame_range, sizeof(stamp_data->frame_range),
+		             do_prefix ? "Frame Range %d:%d" : "%d:%d", scene->r.sfra, scene->r.efra);
+	}
+	else {
+		stamp_data->frame_range[0] = '\0';
+	}
 }
 
 /* Will always add prefix. */
@@ -2151,6 +2167,7 @@ void BKE_stamp_info_callback(void *data, struct StampData *stamp_data, StampCall
 	CALL(marker, "Marker");
 	CALL(time, "Time");
 	CALL(frame, "Frame");
+	CALL(frame_range, "FrameRange");
 	CALL(camera, "Camera");
 	CALL(cameralens, "Lens");
 	CALL(scene, "Scene");
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index b41e649b628..9a14f2eacbb 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1832,10 +1832,11 @@ enum {
 #define R_STAMP_STRIPMETA	0x1000
 #define R_STAMP_MEMORY		0x2000
 #define R_STAMP_HIDE_LABELS	0x4000
+#define R_STAMP_FRAME_RANGE	0x8000
 #define R_STAMP_ALL (R_STAMP_TIME|R_STAMP_FRAME|R_STAMP_DATE|R_STAMP_CAMERA|R_STAMP_SCENE| \
                      R_STAMP_NOTE|R_STAMP_MARKER|R_STAMP_FILENAME|R_STAMP_SEQSTRIP|        \
                      R_STAMP_RENDERTIME|R_STAMP_CAMERALENS|R_STAMP_MEMORY|                 \
-                     R_STAMP_HIDE_LABELS)
+                     R_STAMP_HIDE_LABELS|R_STAMP_FRAME_RANGE)
 
 /* RenderData.alphamode */
 #define R_ADDSKY		0
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 94206710028..2cfe0666fbf 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -6363,6 +6363,11 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Stamp Frame", "Include the frame number in image metadata");
 	RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
 	
+	prop = RNA_def_property(srna, "use_stamp_frame_range", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_FRAME_RANGE);
+	RNA_def_property_ui_text(prop, "Stamp Frame", "Include the rendered frame range in image/video metadata");
+	RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
 	prop = RNA_def_property(srna, "use_stamp_camera", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_CAMERA);
 	RNA_def_property_ui_text(prop, "Stamp Camera", "Include the name of the active camera in image metadata");



More information about the Bf-blender-cvs mailing list