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:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-02-01 18:09:21 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-02-01 18:11:24 +0300
commitcb9f9a63e02986bd308dcd4b39ea19586b233167 (patch)
tree1e3864b3f398ac74c538cee61630af0e8385cb40 /source/blender/blenkernel
parentd7af7a1e04c243170edffeda3f2feb19605d2aba (diff)
Fix wrong information used for stamp when "Strip Metadata" is used
Such configuration used to cause quite confusing situation when stamp will use actual scene's statistics but metadata from strip will be used for the saved file (basically, causing different information stamped and saved as metadata). Don't think it was desired behavior and it's something what artists here in the studio wants to be fixed.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_image.h2
-rw-r--r--source/blender/blenkernel/intern/image.c54
2 files changed, 52 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index aec5b0afa45..894ccae0dc8 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -68,7 +68,7 @@ void BKE_imbuf_stamp_info(struct RenderResult *rr, struct ImBuf *ibuf);
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,
+ struct Scene *scene, struct Object *camera, const struct StampData *stamp_data_template,
unsigned char *rect, float *rectf, int width, int height, int channels);
bool BKE_imbuf_alpha_test(struct ImBuf *ibuf);
int BKE_imbuf_write_stamp(
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index d48b455ae81..cfed3716dcf 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1865,8 +1865,45 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
}
}
+static void stampdata_reset(const Scene *scene, StampData *stamp_data)
+{
+ if ((scene->r.stamp & R_STAMP_FILENAME) == 0) {
+ stamp_data->file[0] = '\0';
+ }
+ if ((scene->r.stamp & R_STAMP_NOTE) == 0) {
+ stamp_data->note[0] = '\0';
+ }
+ if ((scene->r.stamp & R_STAMP_DATE) == 0) {
+ stamp_data->date[0] = '\0';
+ }
+ if ((scene->r.stamp & R_STAMP_MARKER) == 0) {
+ stamp_data->marker[0] = '\0';
+ }
+ if ((scene->r.stamp & R_STAMP_TIME) == 0) {
+ stamp_data->time[0] = '\0';
+ }
+ if ((scene->r.stamp & R_STAMP_FRAME) == 0) {
+ stamp_data->frame[0] = '\0';
+ }
+ if ((scene->r.stamp & R_STAMP_CAMERA) == 0) {
+ stamp_data->camera[0] = '\0';
+ }
+ if ((scene->r.stamp & R_STAMP_CAMERALENS) == 0) {
+ stamp_data->cameralens[0] = '\0';
+ }
+ if ((scene->r.stamp & R_STAMP_SCENE) == 0) {
+ stamp_data->scene[0] = '\0';
+ }
+ if ((scene->r.stamp & R_STAMP_SEQSTRIP) == 0) {
+ stamp_data->strip[0] = '\0';
+ }
+ if ((scene->r.stamp & R_STAMP_RENDERTIME) == 0) {
+ stamp_data->rendertime[0] = '\0';
+ }
+}
+
void BKE_image_stamp_buf(
- Scene *scene, Object *camera,
+ Scene *scene, Object *camera, const StampData *stamp_data_template,
unsigned char *rect, float *rectf, int width, int height, int channels)
{
struct StampData stamp_data;
@@ -1903,7 +1940,13 @@ void BKE_image_stamp_buf(
display_device = scene->display_settings.display_device;
display = IMB_colormanagement_display_get_named(display_device);
- stampdata(scene, camera, &stamp_data, 1);
+ if (stamp_data_template == NULL) {
+ stampdata(scene, camera, &stamp_data, 1);
+ }
+ else {
+ stamp_data = *stamp_data_template;
+ stampdata_reset(scene, &stamp_data);
+ }
/* TODO, do_versions */
if (scene->r.stamp_font_id < 8)
@@ -2146,7 +2189,12 @@ static void metadata_change_field(void *data, const char *propname, char *propva
static void metadata_get_field(void *data, const char *propname, char *propvalue, int len)
{
- IMB_metadata_get_field(data, propname, propvalue, len);
+ char buffer[1024];
+ if (STREQ(propname, "Strip")) {
+ IMB_metadata_get_field(data, propname, buffer, sizeof(buffer));
+ }
+ IMB_metadata_get_field(data, propname, buffer, sizeof(buffer));
+ BLI_snprintf(propvalue, len, "%s %s", propname, buffer);
}
void BKE_imbuf_stamp_info(RenderResult *rr, struct ImBuf *ibuf)