Fix T67732: metadata "Include Labels" checkbox doesn't work when "Use Strip Metadata" is checked

The 'metadata from sequencer strip' system was using the
`stampdata_from_template()` function, which ignored the 'Use Labels'
setting.
This commit is contained in:
Sybren A. Stüvel
2019-09-26 12:05:40 +02:00
parent 8a7085b9d4
commit ae5bf4c2c8

View File

@@ -1861,13 +1861,13 @@ static void stampdata(
}
}
/* Will always add prefix. */
static void stampdata_from_template(StampData *stamp_data,
const Scene *scene,
const StampData *stamp_data_template)
const StampData *stamp_data_template,
bool do_prefix)
{
if (scene->r.stamp & R_STAMP_FILENAME) {
SNPRINTF(stamp_data->file, "File %s", stamp_data_template->file);
SNPRINTF(stamp_data->file, do_prefix ? "File %s" : "%s", stamp_data_template->file);
}
else {
stamp_data->file[0] = '\0';
@@ -1879,67 +1879,71 @@ static void stampdata_from_template(StampData *stamp_data,
stamp_data->note[0] = '\0';
}
if (scene->r.stamp & R_STAMP_DATE) {
SNPRINTF(stamp_data->date, "Date %s", stamp_data_template->date);
SNPRINTF(stamp_data->date, do_prefix ? "Date %s" : "%s", stamp_data_template->date);
}
else {
stamp_data->date[0] = '\0';
}
if (scene->r.stamp & R_STAMP_MARKER) {
SNPRINTF(stamp_data->marker, "Marker %s", stamp_data_template->marker);
SNPRINTF(stamp_data->marker, do_prefix ? "Marker %s" : "%s", stamp_data_template->marker);
}
else {
stamp_data->marker[0] = '\0';
}
if (scene->r.stamp & R_STAMP_TIME) {
SNPRINTF(stamp_data->time, "Timecode %s", stamp_data_template->time);
SNPRINTF(stamp_data->time, do_prefix ? "Timecode %s" : "%s", stamp_data_template->time);
}
else {
stamp_data->time[0] = '\0';
}
if (scene->r.stamp & R_STAMP_FRAME) {
SNPRINTF(stamp_data->frame, "Frame %s", stamp_data_template->frame);
SNPRINTF(stamp_data->frame, do_prefix ? "Frame %s" : "%s", stamp_data_template->frame);
}
else {
stamp_data->frame[0] = '\0';
}
if (scene->r.stamp & R_STAMP_CAMERA) {
SNPRINTF(stamp_data->camera, "Camera %s", stamp_data_template->camera);
SNPRINTF(stamp_data->camera, do_prefix ? "Camera %s" : "%s", stamp_data_template->camera);
}
else {
stamp_data->camera[0] = '\0';
}
if (scene->r.stamp & R_STAMP_CAMERALENS) {
SNPRINTF(stamp_data->cameralens, "Lens %s", stamp_data_template->cameralens);
SNPRINTF(
stamp_data->cameralens, do_prefix ? "Lens %s" : "%s", stamp_data_template->cameralens);
}
else {
stamp_data->cameralens[0] = '\0';
}
if (scene->r.stamp & R_STAMP_SCENE) {
SNPRINTF(stamp_data->scene, "Scene %s", stamp_data_template->scene);
SNPRINTF(stamp_data->scene, do_prefix ? "Scene %s" : "%s", stamp_data_template->scene);
}
else {
stamp_data->scene[0] = '\0';
}
if (scene->r.stamp & R_STAMP_SEQSTRIP) {
SNPRINTF(stamp_data->strip, "Strip %s", stamp_data_template->strip);
SNPRINTF(stamp_data->strip, do_prefix ? "Strip %s" : "%s", stamp_data_template->strip);
}
else {
stamp_data->strip[0] = '\0';
}
if (scene->r.stamp & R_STAMP_RENDERTIME) {
SNPRINTF(stamp_data->rendertime, "RenderTime %s", stamp_data_template->rendertime);
SNPRINTF(stamp_data->rendertime,
do_prefix ? "RenderTime %s" : "%s",
stamp_data_template->rendertime);
}
else {
stamp_data->rendertime[0] = '\0';
}
if (scene->r.stamp & R_STAMP_MEMORY) {
SNPRINTF(stamp_data->memory, "Peak Memory %s", stamp_data_template->memory);
SNPRINTF(stamp_data->memory, do_prefix ? "Peak Memory %s" : "%s", stamp_data_template->memory);
}
else {
stamp_data->memory[0] = '\0';
}
if (scene->r.stamp & R_STAMP_HOSTNAME) {
SNPRINTF(stamp_data->hostname, "Hostname %s", stamp_data_template->hostname);
SNPRINTF(
stamp_data->hostname, do_prefix ? "Hostname %s" : "%s", stamp_data_template->hostname);
}
else {
stamp_data->hostname[0] = '\0';
@@ -1991,11 +1995,12 @@ void BKE_image_stamp_buf(Scene *scene,
display_device = scene->display_settings.display_device;
display = IMB_colormanagement_display_get_named(display_device);
bool do_prefix = (scene->r.stamp & R_STAMP_HIDE_LABELS) == 0;
if (stamp_data_template == NULL) {
stampdata(scene, camera, &stamp_data, (scene->r.stamp & R_STAMP_HIDE_LABELS) == 0, true);
stampdata(scene, camera, &stamp_data, do_prefix, true);
}
else {
stampdata_from_template(&stamp_data, scene, stamp_data_template);
stampdata_from_template(&stamp_data, scene, stamp_data_template, do_prefix);
}
/* TODO, do_versions */