Compare commits

...

3 Commits

Author SHA1 Message Date
0825869c82 Store metadata in image buffer. 2022-05-06 16:33:40 +02:00
cc66340c7e Fix allocation metadata for image files. 2022-05-06 16:29:26 +02:00
7aec4a8a45 Use file meta data in composior. 2022-05-06 16:13:32 +02:00
5 changed files with 29 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
#include "COM_MetaData.h"
#include "BKE_idprop.h"
#include "BKE_image.h"
#include "RE_pipeline.h"
@@ -14,6 +15,17 @@ void MetaData::add(const blender::StringRef key, const blender::StringRef value)
entries_.add(key, value);
}
static void add_property(IDProperty *id_prop, void *user_data)
{
MetaData *meta_data = static_cast<MetaData *>(user_data);
meta_data->add(id_prop->name, IDP_String(id_prop));
}
void MetaData::add(IDProperty *id_prop)
{
IDP_foreach_property(id_prop, IDP_TYPE_FILTER_STRING, add_property, this);
}
void MetaData::add_cryptomatte_entry(const blender::StringRef layer_name,
const blender::StringRefNull key,
const blender::StringRef value)

View File

@@ -43,6 +43,8 @@ class MetaData {
*/
void replace_hash_neutral_cryptomatte_keys(const blender::StringRef layer_name);
void add_to_render_result(RenderResult *render_result) const;
void add(IDProperty *properties);
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("COM:MetaData")
#endif

View File

@@ -215,4 +215,13 @@ void ImageDepthOperation::update_memory_buffer_partial(MemoryBuffer *output,
}
}
std::unique_ptr<MetaData> ImageOperation::get_meta_data()
{
MetaData meta_data;
if (buffer_->metadata != nullptr) {
meta_data.add(buffer_->metadata);
}
return std::make_unique<MetaData>(meta_data);
}
} // namespace blender::compositor

View File

@@ -78,6 +78,7 @@ class ImageOperation : public BaseImageOperation {
void update_memory_buffer_partial(MemoryBuffer *output,
const rcti &area,
Span<MemoryBuffer *> inputs) override;
std::unique_ptr<MetaData> get_meta_data() override;
};
class ImageAlphaOperation : public BaseImageOperation {
public:

View File

@@ -201,6 +201,11 @@ 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_);