It was only used by OpenEXR and Iris images, and saving the Z Buffer in those formats was disabled by default. This option comes from the times prior to the addition of the Multilayer EXR. It also worth noting that it was not possible to save Iris with Depth pass from Blender as internally it is called IRIZ format and it was not exposed. But even after exposing this format option something still was missing as saving and loading ITIZ did not show up the Depth pass. The reason of removal is to make it a more clear match of the ImBuf with a render pass, and use it instead of a custom type in the render result and render pass API. This will simplify the API and also avoid stealing buffers and making shallow copies when showing the render result. For the cases when Depth is needed a Multilayer EXR is to be used, as most likely more than just the Depth will be needed. On a user level this change: - Removes the "Z Buffer" option from the interface. - It preserves existing sockets in compositor nodes, but it will output black image. Also changing the image data-block will remove the socket unless a Multilayer EXR with Depth pass image is selected. - Removes "Depth" socket of the Viewer and Composite nodes. Ref #108618 Pull Request: https://projects.blender.org/blender/blender/pulls/109687
124 lines
2.7 KiB
C++
124 lines
2.7 KiB
C++
/* SPDX-FileCopyrightText: 2011 Blender Foundation
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
#include "BKE_global.h"
|
|
#include "BLI_rect.h"
|
|
#include "COM_MultiThreadedOperation.h"
|
|
#include "DNA_image_types.h"
|
|
|
|
namespace blender::compositor {
|
|
|
|
class ViewerOperation : public MultiThreadedOperation {
|
|
private:
|
|
/* TODO(manzanilla): To be removed together with tiled implementation. */
|
|
float *output_buffer_;
|
|
|
|
Image *image_;
|
|
ImageUser *image_user_;
|
|
bool active_;
|
|
float center_x_;
|
|
float center_y_;
|
|
ChunkOrdering chunk_order_;
|
|
ImBuf *ibuf_;
|
|
bool use_alpha_input_;
|
|
const RenderData *rd_;
|
|
const char *view_name_;
|
|
|
|
const ColorManagedViewSettings *view_settings_;
|
|
const ColorManagedDisplaySettings *display_settings_;
|
|
|
|
SocketReader *image_input_;
|
|
SocketReader *alpha_input_;
|
|
|
|
public:
|
|
ViewerOperation();
|
|
void init_execution() override;
|
|
void deinit_execution() override;
|
|
void execute_region(rcti *rect, unsigned int tile_number) override;
|
|
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
|
bool is_output_operation(bool /*rendering*/) const override
|
|
{
|
|
if (G.background) {
|
|
return false;
|
|
}
|
|
return is_active_viewer_output();
|
|
}
|
|
void set_image(Image *image)
|
|
{
|
|
image_ = image;
|
|
}
|
|
void set_image_user(ImageUser *image_user)
|
|
{
|
|
image_user_ = image_user;
|
|
}
|
|
bool is_active_viewer_output() const override
|
|
{
|
|
return active_;
|
|
}
|
|
void set_active(bool active)
|
|
{
|
|
active_ = active;
|
|
}
|
|
void setCenterX(float centerX)
|
|
{
|
|
center_x_ = centerX;
|
|
}
|
|
void setCenterY(float centerY)
|
|
{
|
|
center_y_ = centerY;
|
|
}
|
|
void set_chunk_order(ChunkOrdering tile_order)
|
|
{
|
|
chunk_order_ = tile_order;
|
|
}
|
|
float getCenterX() const
|
|
{
|
|
return center_x_;
|
|
}
|
|
float getCenterY() const
|
|
{
|
|
return center_y_;
|
|
}
|
|
ChunkOrdering get_chunk_order() const
|
|
{
|
|
return chunk_order_;
|
|
}
|
|
eCompositorPriority get_render_priority() const override;
|
|
void set_use_alpha_input(bool value)
|
|
{
|
|
use_alpha_input_ = value;
|
|
}
|
|
void set_render_data(const RenderData *rd)
|
|
{
|
|
rd_ = rd;
|
|
}
|
|
void set_view_name(const char *view_name)
|
|
{
|
|
view_name_ = view_name;
|
|
}
|
|
|
|
void set_view_settings(const ColorManagedViewSettings *view_settings)
|
|
{
|
|
view_settings_ = view_settings;
|
|
}
|
|
void set_display_settings(const ColorManagedDisplaySettings *display_settings)
|
|
{
|
|
display_settings_ = display_settings;
|
|
}
|
|
|
|
void update_memory_buffer_partial(MemoryBuffer *output,
|
|
const rcti &area,
|
|
Span<MemoryBuffer *> inputs) override;
|
|
|
|
void clear_display_buffer();
|
|
|
|
private:
|
|
void update_image(const rcti *rect);
|
|
void init_image();
|
|
};
|
|
|
|
} // namespace blender::compositor
|