[Bf-blender-cvs] [f525483] master: Sequencer metadata:

Antony Riakiotakis noreply at git.blender.org
Wed Jul 1 15:23:36 CEST 2015


Commit: f525483d837f8f91876ba395134c3ed263dcc7c2
Author: Antony Riakiotakis
Date:   Wed Jul 1 15:23:09 2015 +0200
Branches: master
https://developer.blender.org/rBf525483d837f8f91876ba395134c3ed263dcc7c2

Sequencer metadata:

Add option to render strip metadata to final result, bypassing current
scene metadata.

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

M	release/scripts/startup/bl_ui/properties_render.py
M	source/blender/blenkernel/BKE_image.h
M	source/blender/blenkernel/intern/image.c
M	source/blender/editors/render/render_opengl.c
M	source/blender/imbuf/intern/openexr/openexr_api.cpp
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_scene.c
M	source/blender/render/intern/source/pipeline.c

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

diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index 0c68d98..88b7e08 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -343,7 +343,7 @@ class RENDER_PT_stamp(RenderButtonsPanel, Panel):
 
         rd = context.scene.render
 
-        layout.prop(rd, "use_stamp", text="Stamp Output")
+        layout.prop(rd, "use_stamp")
         col = layout.column()
         col.active = rd.use_stamp
         col.prop(rd, "stamp_font_size", text="Font Size")
@@ -374,6 +374,9 @@ class RENDER_PT_stamp(RenderButtonsPanel, Panel):
         sub = row.row()
         sub.active = rd.use_stamp_note
         sub.prop(rd, "stamp_note_text", text="")
+        if rd.use_sequencer:
+            layout.label("Sequencer")
+            layout.prop(rd, "use_stamp_strip_meta")
 
 
 class RENDER_PT_output(RenderButtonsPanel, Panel):
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index facf3cf..29b073f 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -60,11 +60,12 @@ void    BKE_image_free_buffers(struct Image *image);
 /* call from library */
 void    BKE_image_free(struct Image *image);
 
-typedef void (StampCallback)(void *data, const char *propname, const char *propvalue);
+typedef void (StampCallback)(void *data, const char *propname, char *propvalue, int len);
 
-void    BKE_render_result_stamp_info(struct Scene *scene, struct Object *camera, struct RenderResult *rr);
+void    BKE_render_result_stamp_info(struct Scene *scene, struct Object *camera, struct RenderResult *rr, bool allocate_only);
 void    BKE_imbuf_stamp_info(struct RenderResult *rr, struct ImBuf *ibuf);
-void    BKE_stamp_info_callback(void *data, const struct StampData *stamp_data, StampCallback callback);
+void    BKE_stamp_info_from_imbuf(struct RenderResult *rr, struct ImBuf *ibuf);
+void    BKE_stamp_info_callback(void *data, struct StampData *stamp_data, StampCallback callback, bool noskip);
 void    BKE_image_stamp_buf(struct Scene *scene, struct Object *camera, unsigned char *rect, float *rectf, int width, int height, int channels);
 bool    BKE_imbuf_alpha_test(struct ImBuf *ibuf);
 int     BKE_imbuf_write_stamp(struct Scene *scene, struct RenderResult *rr, struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index df4bd6f..97e516b 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -2058,11 +2058,11 @@ void BKE_image_stamp_buf(
 #undef BUFF_MARGIN_Y
 }
 
-void BKE_render_result_stamp_info(Scene *scene, Object *camera, struct RenderResult *rr)
+void BKE_render_result_stamp_info(Scene *scene, Object *camera, struct RenderResult *rr, bool allocate_only)
 {
 	struct StampData *stamp_data;
 
-	if (!(scene && scene->r.stamp & R_STAMP_ALL))
+	if (!(scene && (scene->r.stamp & R_STAMP_ALL)) && !allocate_only)
 		return;
 
 	if (!rr->stamp_data) {
@@ -2072,22 +2072,23 @@ void BKE_render_result_stamp_info(Scene *scene, Object *camera, struct RenderRes
 		stamp_data = rr->stamp_data;
 	}
 
-	stampdata(scene, camera, stamp_data, 0);
+	if (!allocate_only)
+		stampdata(scene, camera, stamp_data, 0);
 
 	if (!rr->stamp_data) {
 		rr->stamp_data = stamp_data;
 	}
 }
 
-void BKE_stamp_info_callback(void *data, const struct StampData *stamp_data, StampCallback callback)
+void BKE_stamp_info_callback(void *data, struct StampData *stamp_data, StampCallback callback, bool noskip)
 {
 	if (!callback || !stamp_data) {
 		return;
 	}
 
 #define CALL(member, value_str) \
-	if (stamp_data->member[0]) { \
-		callback(data, value_str, stamp_data->member); \
+	if (noskip || stamp_data->member[0]) { \
+		callback(data, value_str, stamp_data->member, sizeof(stamp_data->member)); \
 	} ((void)0)
 
 	CALL(file, "File");
@@ -2106,18 +2107,29 @@ void BKE_stamp_info_callback(void *data, const struct StampData *stamp_data, Sta
 }
 
 /* wrap for callback only */
-static void metadata_change_field(void *data, const char *propname, const char *propvalue)
+static void metadata_change_field(void *data, const char *propname, char *propvalue, int UNUSED(len))
 {
 	IMB_metadata_change_field(data, propname, propvalue);
 }
 
+static void metadata_get_field(void *data, const char *propname, char *propvalue, int len)
+{
+	IMB_metadata_get_field(data, propname, propvalue, len);
+}
+
 void BKE_imbuf_stamp_info(RenderResult *rr, struct ImBuf *ibuf)
 {
 	struct StampData *stamp_data = rr->stamp_data;
 
-	BKE_stamp_info_callback(ibuf, stamp_data, metadata_change_field);
+	BKE_stamp_info_callback(ibuf, stamp_data, metadata_change_field, false);
 }
 
+void BKE_stamp_info_from_imbuf(RenderResult *rr, struct ImBuf *ibuf)
+{
+	struct StampData *stamp_data = rr->stamp_data;
+
+	BKE_stamp_info_callback(ibuf, stamp_data, metadata_get_field, true);
+}
 
 bool BKE_imbuf_alpha_test(ImBuf *ibuf)
 {
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 5c69748..c718dfa 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -240,10 +240,10 @@ static void screen_opengl_views_setup(OGLRender *oglrender)
 	/* will only work for non multiview correctly */
 	if (v3d) {
 		camera = BKE_camera_multiview_render(oglrender->scene, v3d->camera, "new opengl render view");
-		BKE_render_result_stamp_info(oglrender->scene, camera, rr);
+		BKE_render_result_stamp_info(oglrender->scene, camera, rr, false);
 	}
 	else {
-		BKE_render_result_stamp_info(oglrender->scene, oglrender->scene->camera, rr);
+		BKE_render_result_stamp_info(oglrender->scene, oglrender->scene->camera, rr, false);
 	}
 
 	RE_ReleaseResult(oglrender->re);
@@ -492,7 +492,7 @@ static void screen_opengl_render_write(OGLRender *oglrender)
 	        &scene->r.im_format, (scene->r.scemode & R_EXTENSION) != 0, false, NULL);
 
 	/* write images as individual images or stereo */
-	BKE_render_result_stamp_info(scene, scene->camera, rr);
+	BKE_render_result_stamp_info(scene, scene->camera, rr, false);
 	ok = RE_WriteRenderViewsImage(oglrender->reports, rr, scene, false, name);
 
 	RE_ReleaseResultImage(oglrender->re);
@@ -815,7 +815,7 @@ static bool screen_opengl_render_anim_step(bContext *C, wmOperator *op)
 		}
 	}
 	else {
-		BKE_render_result_stamp_info(scene, scene->camera, rr);
+		BKE_render_result_stamp_info(scene, scene->camera, rr, false);
 		ok = RE_WriteRenderViewsImage(op->reports, rr, scene, true, name);
 		if (ok) {
 			printf("Saved: %s", name);
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 44b7fbf..6bb1f0c 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -364,7 +364,7 @@ static void openexr_header_metadata(Header *header, struct ImBuf *ibuf)
 		addXDensity(*header, ibuf->ppm[0] / 39.3700787); /* 1 meter = 39.3700787 inches */
 }
 
-static void openexr_header_metadata_callback(void *data, const char *propname, const char *prop)
+static void openexr_header_metadata_callback(void *data, const char *propname, char *prop, int UNUSED(len))
 {
 	Header *header = (Header *)data;
 	header->insert(propname, StringAttribute(prop));
@@ -860,7 +860,7 @@ int IMB_exr_begin_write(void *handle, const char *filename, int width, int heigh
 	}
 
 	openexr_header_compression(&header, compress);
-	BKE_stamp_info_callback(&header, stamp, openexr_header_metadata_callback);
+	BKE_stamp_info_callback(&header, const_cast<StampData *>(stamp), openexr_header_metadata_callback, false);
 	/* header.lineOrder() = DECREASING_Y; this crashes in windows for file read! */
 
 	imb_exr_type_by_channels(header.channels(), *data->multiView, &is_singlelayer, &is_multilayer, &is_multiview);
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index b3d6745..47fd1a4 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1562,6 +1562,7 @@ typedef struct Scene {
 #define R_STAMP_SEQSTRIP	0x0200
 #define R_STAMP_RENDERTIME	0x0400
 #define R_STAMP_CAMERALENS	0x0800
+#define R_STAMP_STRIPMETA	0x1000
 #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)
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index bc05b37..2310320 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -5685,9 +5685,14 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 
 	prop = RNA_def_property(srna, "use_stamp", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_DRAW);
-	RNA_def_property_ui_text(prop, "Render Stamp", "Render the stamp info text in the rendered image");
+	RNA_def_property_ui_text(prop, "Stamp Output", "Render the stamp info text in the rendered image");
 	RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-	
+
+	prop = RNA_def_property(srna, "use_stamp_strip_meta", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_STRIPMETA);
+	RNA_def_property_ui_text(prop, "Strip Metadata", "Render the metadata of the strip for sequencer");
+	RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
 	prop = RNA_def_property(srna, "stamp_font_size", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "stamp_font_id");
 	RNA_def_property_range(prop, 8, 64);
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index c939c69..31efdb9 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -2617,6 +2617,7 @@ static void do_render_seq(Render *re)
 
 		if (out) {
 			ibuf_arr[view_id] = IMB_dupImBuf(

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list