[Bf-blender-cvs] [541fa83ba42] temp-T97905-compositor-meta-data: Store metadata via single layer file output operation.
Jeroen Bakker
noreply at git.blender.org
Wed May 11 16:50:34 CEST 2022
Commit: 541fa83ba42f1e53ccc0ef667889275fe0f9893c
Author: Jeroen Bakker
Date: Wed May 11 16:25:40 2022 +0200
Branches: temp-T97905-compositor-meta-data
https://developer.blender.org/rB541fa83ba42f1e53ccc0ef667889275fe0f9893c
Store metadata via single layer file output operation.
===================================================================
M source/blender/compositor/intern/COM_MetaData.cc
M source/blender/compositor/intern/COM_MetaData.h
M source/blender/compositor/operations/COM_OutputFileOperation.cc
M source/blender/compositor/operations/COM_ViewerOperation.cc
===================================================================
diff --git a/source/blender/compositor/intern/COM_MetaData.cc b/source/blender/compositor/intern/COM_MetaData.cc
index 0b64b353101..a4048a0279a 100644
--- a/source/blender/compositor/intern/COM_MetaData.cc
+++ b/source/blender/compositor/intern/COM_MetaData.cc
@@ -6,6 +6,8 @@
#include "BKE_idprop.h"
#include "BKE_image.h"
+#include "IMB_metadata.h"
+
#include "RE_pipeline.h"
namespace blender::compositor {
@@ -62,6 +64,14 @@ void MetaData::add_to_render_result(RenderResult *render_result) const
}
}
+void MetaData::add_to_id_prop(IDProperty *id_properties) const
+{
+ BLI_assert(id_properties != nullptr);
+ for (Map<std::string, std::string>::Item entry : entries_.items()) {
+ IMB_metadata_set_field(id_properties, entry.key.c_str(), entry.value.c_str());
+ }
+}
+
void MetaDataExtractCallbackData::add_meta_data(blender::StringRef key,
blender::StringRefNull value)
{
diff --git a/source/blender/compositor/intern/COM_MetaData.h b/source/blender/compositor/intern/COM_MetaData.h
index c1474ac16b7..cf94a7ff2d2 100644
--- a/source/blender/compositor/intern/COM_MetaData.h
+++ b/source/blender/compositor/intern/COM_MetaData.h
@@ -43,6 +43,7 @@ class MetaData {
*/
void replace_hash_neutral_cryptomatte_keys(const blender::StringRef layer_name);
void add_to_render_result(RenderResult *render_result) const;
+ void add_to_id_prop(IDProperty *properties) const;
void add(IDProperty *properties);
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cc b/source/blender/compositor/operations/COM_OutputFileOperation.cc
index 372e0736cd2..fa2d48b7c67 100644
--- a/source/blender/compositor/operations/COM_OutputFileOperation.cc
+++ b/source/blender/compositor/operations/COM_OutputFileOperation.cc
@@ -17,6 +17,7 @@
#include "IMB_colormanagement.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
+#include "IMB_metadata.h"
#include "RE_pipeline.h"
@@ -255,6 +256,12 @@ void OutputSingleLayerOperation::deinit_execution()
ibuf->mall |= IB_rectfloat;
ibuf->dither = rd_->dither_intensity;
+ std::unique_ptr<MetaData> metadata = image_input_->get_meta_data();
+ if (metadata.get() != nullptr) {
+ IMB_metadata_ensure(&ibuf->metadata);
+ metadata->add_to_id_prop(ibuf->metadata);
+ }
+
IMB_colormanagement_imbuf_for_write(ibuf, save_as_render_, false, &format_);
suffix = BKE_scene_multiview_view_suffix_get(rd_, view_name_);
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cc b/source/blender/compositor/operations/COM_ViewerOperation.cc
index 74b6c3493fb..58392b8a638 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.cc
+++ b/source/blender/compositor/operations/COM_ViewerOperation.cc
@@ -201,11 +201,6 @@ void ViewerOperation::update_image(const rcti *rect)
rect->xmax,
rect->ymax);
- std::unique_ptr<MetaData> metadata = image_input_->get_meta_data();
- if (metadata.has_value()) {
- // TODO: metadata.add_to_id_prop.
- }
-
/* This could be improved to use partial updates. For now disabled as the full frame compositor
* would not use partial frames anymore and the image engine requires more testing. */
BKE_image_partial_update_mark_full_update(image_);
More information about the Bf-blender-cvs
mailing list