Compositor: Replace resolution concept by canvas
This is a code refactor in preparation of supporting canvas compositing. See {D12466}. No functional changes, all canvases are at (0,0) position matching tiled implementation. Differential Revision: https://developer.blender.org/D12465
This commit is contained in:
parent
2ecd963d87
commit
76377f0176
|
@ -121,7 +121,8 @@ constexpr float COM_PREVIEW_SIZE = 140.f;
|
|||
constexpr float COM_RULE_OF_THIRDS_DIVIDER = 100.0f;
|
||||
constexpr float COM_BLUR_BOKEH_PIXELS = 512;
|
||||
|
||||
constexpr rcti COM_SINGLE_ELEM_AREA = {0, 1, 0, 1};
|
||||
constexpr rcti COM_AREA_NONE = {0, 0, 0, 0};
|
||||
constexpr rcti COM_CONSTANT_INPUT_AREA_OF_INTEREST = COM_AREA_NONE;
|
||||
|
||||
constexpr IndexRange XRange(const rcti &area)
|
||||
{
|
||||
|
|
|
@ -24,12 +24,7 @@ BufferOperation::BufferOperation(MemoryBuffer *buffer, DataType data_type)
|
|||
{
|
||||
buffer_ = buffer;
|
||||
inflated_buffer_ = nullptr;
|
||||
/* TODO: Implement a MemoryBuffer get_size() method returning a Size2d type. Shorten following
|
||||
* code to: set_resolution(buffer.get_size()) */
|
||||
unsigned int resolution[2];
|
||||
resolution[0] = buffer->getWidth();
|
||||
resolution[1] = buffer->getHeight();
|
||||
setResolution(resolution);
|
||||
set_canvas(buffer->get_rect());
|
||||
addOutputSocket(data_type);
|
||||
flags.is_constant_operation = buffer_->is_a_single_elem();
|
||||
flags.is_fullframe_operation = false;
|
||||
|
|
|
@ -460,9 +460,9 @@ NodeOperation *COM_convert_data_type(const NodeOperationOutput &from, const Node
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void COM_convert_resolution(NodeOperationBuilder &builder,
|
||||
NodeOperationOutput *fromSocket,
|
||||
NodeOperationInput *toSocket)
|
||||
void COM_convert_canvas(NodeOperationBuilder &builder,
|
||||
NodeOperationOutput *fromSocket,
|
||||
NodeOperationInput *toSocket)
|
||||
{
|
||||
/* Data type conversions are executed before resolutions to ensure convert operations have
|
||||
* resolution. This method have to ensure same datatypes are linked for new operations. */
|
||||
|
@ -535,10 +535,10 @@ void COM_convert_resolution(NodeOperationBuilder &builder,
|
|||
builder.addOperation(sxop);
|
||||
builder.addOperation(syop);
|
||||
|
||||
unsigned int resolution[2] = {fromOperation->getWidth(), fromOperation->getHeight()};
|
||||
scaleOperation->setResolution(resolution);
|
||||
sxop->setResolution(resolution);
|
||||
syop->setResolution(resolution);
|
||||
const rcti &scale_canvas = fromOperation->get_canvas();
|
||||
scaleOperation->set_canvas(scale_canvas);
|
||||
sxop->set_canvas(scale_canvas);
|
||||
syop->set_canvas(scale_canvas);
|
||||
builder.addOperation(scaleOperation);
|
||||
}
|
||||
|
||||
|
@ -557,10 +557,10 @@ void COM_convert_resolution(NodeOperationBuilder &builder,
|
|||
builder.addOperation(xop);
|
||||
builder.addOperation(yop);
|
||||
|
||||
unsigned int resolution[2] = {toOperation->getWidth(), toOperation->getHeight()};
|
||||
translateOperation->setResolution(resolution);
|
||||
xop->setResolution(resolution);
|
||||
yop->setResolution(resolution);
|
||||
const rcti &translate_canvas = toOperation->get_canvas();
|
||||
translateOperation->set_canvas(translate_canvas);
|
||||
xop->set_canvas(translate_canvas);
|
||||
yop->set_canvas(translate_canvas);
|
||||
builder.addOperation(translateOperation);
|
||||
|
||||
if (doScale) {
|
||||
|
|
|
@ -65,8 +65,8 @@ NodeOperation *COM_convert_data_type(const NodeOperationOutput &from,
|
|||
* \note Conversion logic is implemented in this function.
|
||||
* \see InputSocketResizeMode for the possible conversions.
|
||||
*/
|
||||
void COM_convert_resolution(NodeOperationBuilder &builder,
|
||||
NodeOperationOutput *fromSocket,
|
||||
NodeOperationInput *toSocket);
|
||||
void COM_convert_canvas(NodeOperationBuilder &builder,
|
||||
NodeOperationOutput *fromSocket,
|
||||
NodeOperationInput *toSocket);
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
|
|
@ -162,8 +162,10 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system,
|
|||
|
||||
len += snprintf(str + len,
|
||||
maxlen > len ? maxlen - len : 0,
|
||||
"#%d (%u,%u)",
|
||||
"#%d (%i,%i) (%u,%u)",
|
||||
operation->get_id(),
|
||||
operation->get_canvas().xmin,
|
||||
operation->get_canvas().ymin,
|
||||
operation->getWidth(),
|
||||
operation->getHeight());
|
||||
|
||||
|
|
|
@ -87,12 +87,9 @@ Vector<MemoryBuffer *> FullFrameExecutionModel::get_input_buffers(NodeOperation
|
|||
|
||||
MemoryBuffer *FullFrameExecutionModel::create_operation_buffer(NodeOperation *op)
|
||||
{
|
||||
rcti op_rect;
|
||||
BLI_rcti_init(&op_rect, 0, op->getWidth(), 0, op->getHeight());
|
||||
|
||||
const DataType data_type = op->getOutputSocket(0)->getDataType();
|
||||
const bool is_a_single_elem = op->get_flags().is_constant_operation;
|
||||
return new MemoryBuffer(data_type, op_rect, is_a_single_elem);
|
||||
return new MemoryBuffer(data_type, op->get_canvas(), is_a_single_elem);
|
||||
}
|
||||
|
||||
void FullFrameExecutionModel::render_operation(NodeOperation *op)
|
||||
|
@ -199,12 +196,11 @@ void FullFrameExecutionModel::determine_areas_to_render(NodeOperation *output_op
|
|||
const int num_inputs = operation->getNumberOfInputSockets();
|
||||
for (int i = 0; i < num_inputs; i++) {
|
||||
NodeOperation *input_op = operation->get_input_operation(i);
|
||||
rcti input_op_rect, input_area;
|
||||
BLI_rcti_init(&input_op_rect, 0, input_op->getWidth(), 0, input_op->getHeight());
|
||||
rcti input_area;
|
||||
operation->get_area_of_interest(input_op, render_area, input_area);
|
||||
|
||||
/* Ensure area of interest is within operation bounds, cropping areas outside. */
|
||||
BLI_rcti_isect(&input_area, &input_op_rect, &input_area);
|
||||
BLI_rcti_isect(&input_area, &input_op->get_canvas(), &input_area);
|
||||
|
||||
stack.append({input_op, input_area});
|
||||
}
|
||||
|
|
|
@ -35,9 +35,8 @@ namespace blender::compositor {
|
|||
|
||||
NodeOperation::NodeOperation()
|
||||
{
|
||||
this->m_resolutionInputSocketIndex = 0;
|
||||
this->m_width = 0;
|
||||
this->m_height = 0;
|
||||
canvas_input_index_ = 0;
|
||||
canvas_ = COM_AREA_NONE;
|
||||
this->m_btree = nullptr;
|
||||
}
|
||||
|
||||
|
@ -48,7 +47,7 @@ NodeOperation::NodeOperation()
|
|||
*/
|
||||
std::optional<NodeOperationHash> NodeOperation::generate_hash()
|
||||
{
|
||||
params_hash_ = get_default_hash_2(m_width, m_height);
|
||||
params_hash_ = get_default_hash_2(canvas_.xmin, canvas_.xmax);
|
||||
|
||||
/* Hash subclasses params. */
|
||||
is_hash_output_params_implemented_ = true;
|
||||
|
@ -57,7 +56,11 @@ std::optional<NodeOperationHash> NodeOperation::generate_hash()
|
|||
return std::nullopt;
|
||||
}
|
||||
|
||||
hash_param(getOutputSocket()->getDataType());
|
||||
hash_params(canvas_.ymin, canvas_.ymax);
|
||||
if (m_outputs.size() > 0) {
|
||||
BLI_assert(m_outputs.size() == 1);
|
||||
hash_param(this->getOutputSocket()->getDataType());
|
||||
}
|
||||
NodeOperationHash hash;
|
||||
hash.params_hash_ = params_hash_;
|
||||
|
||||
|
@ -108,48 +111,46 @@ void NodeOperation::addOutputSocket(DataType datatype)
|
|||
m_outputs.append(NodeOperationOutput(this, datatype));
|
||||
}
|
||||
|
||||
void NodeOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2])
|
||||
void NodeOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
unsigned int used_resolution_index = 0;
|
||||
if (m_resolutionInputSocketIndex == RESOLUTION_INPUT_ANY) {
|
||||
unsigned int used_canvas_index = 0;
|
||||
if (canvas_input_index_ == RESOLUTION_INPUT_ANY) {
|
||||
for (NodeOperationInput &input : m_inputs) {
|
||||
unsigned int any_resolution[2] = {0, 0};
|
||||
input.determineResolution(any_resolution, preferredResolution);
|
||||
if (any_resolution[0] * any_resolution[1] > 0) {
|
||||
resolution[0] = any_resolution[0];
|
||||
resolution[1] = any_resolution[1];
|
||||
rcti any_area = COM_AREA_NONE;
|
||||
const bool determined = input.determine_canvas(preferred_area, any_area);
|
||||
if (determined) {
|
||||
r_area = any_area;
|
||||
break;
|
||||
}
|
||||
used_resolution_index += 1;
|
||||
used_canvas_index += 1;
|
||||
}
|
||||
}
|
||||
else if (m_resolutionInputSocketIndex < m_inputs.size()) {
|
||||
NodeOperationInput &input = m_inputs[m_resolutionInputSocketIndex];
|
||||
input.determineResolution(resolution, preferredResolution);
|
||||
used_resolution_index = m_resolutionInputSocketIndex;
|
||||
else if (canvas_input_index_ < m_inputs.size()) {
|
||||
NodeOperationInput &input = m_inputs[canvas_input_index_];
|
||||
input.determine_canvas(preferred_area, r_area);
|
||||
used_canvas_index = canvas_input_index_;
|
||||
}
|
||||
|
||||
if (modify_determined_resolution_fn_) {
|
||||
modify_determined_resolution_fn_(resolution);
|
||||
if (modify_determined_canvas_fn_) {
|
||||
modify_determined_canvas_fn_(r_area);
|
||||
}
|
||||
|
||||
unsigned int temp2[2] = {resolution[0], resolution[1]};
|
||||
unsigned int temp[2];
|
||||
rcti unused_area;
|
||||
const rcti &local_preferred_area = r_area;
|
||||
for (unsigned int index = 0; index < m_inputs.size(); index++) {
|
||||
if (index == used_resolution_index) {
|
||||
if (index == used_canvas_index) {
|
||||
continue;
|
||||
}
|
||||
NodeOperationInput &input = m_inputs[index];
|
||||
if (input.isConnected()) {
|
||||
input.determineResolution(temp, temp2);
|
||||
input.determine_canvas(local_preferred_area, unused_area);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NodeOperation::setResolutionInputSocketIndex(unsigned int index)
|
||||
void NodeOperation::set_canvas_input_index(unsigned int index)
|
||||
{
|
||||
this->m_resolutionInputSocketIndex = index;
|
||||
this->canvas_input_index_ = index;
|
||||
}
|
||||
|
||||
void NodeOperation::init_data()
|
||||
|
@ -260,7 +261,7 @@ void NodeOperation::get_area_of_interest(const int input_idx,
|
|||
/* Non full-frame operations never implement this method. To ensure correctness assume
|
||||
* whole area is used. */
|
||||
NodeOperation *input_op = getInputOperation(input_idx);
|
||||
BLI_rcti_init(&r_input_area, 0, input_op->getWidth(), 0, input_op->getHeight());
|
||||
r_input_area = input_op->get_canvas();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -420,12 +421,16 @@ SocketReader *NodeOperationInput::getReader()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void NodeOperationInput::determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2])
|
||||
/**
|
||||
* \return Whether canvas area could be determined.
|
||||
*/
|
||||
bool NodeOperationInput::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
if (m_link) {
|
||||
m_link->determineResolution(resolution, preferredResolution);
|
||||
m_link->determine_canvas(preferred_area, r_area);
|
||||
return !BLI_rcti_is_empty(&r_area);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/******************
|
||||
|
@ -437,18 +442,16 @@ NodeOperationOutput::NodeOperationOutput(NodeOperation *op, DataType datatype)
|
|||
{
|
||||
}
|
||||
|
||||
void NodeOperationOutput::determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2])
|
||||
void NodeOperationOutput::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
NodeOperation &operation = getOperation();
|
||||
if (operation.get_flags().is_resolution_set) {
|
||||
resolution[0] = operation.getWidth();
|
||||
resolution[1] = operation.getHeight();
|
||||
if (operation.get_flags().is_canvas_set) {
|
||||
r_area = operation.get_canvas();
|
||||
}
|
||||
else {
|
||||
operation.determineResolution(resolution, preferredResolution);
|
||||
if (resolution[0] > 0 && resolution[1] > 0) {
|
||||
operation.setResolution(resolution);
|
||||
operation.determine_canvas(preferred_area, r_area);
|
||||
if (!BLI_rcti_is_empty(&r_area)) {
|
||||
operation.set_canvas(r_area);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -470,8 +473,8 @@ std::ostream &operator<<(std::ostream &os, const NodeOperationFlags &node_operat
|
|||
if (node_operation_flags.use_viewer_border) {
|
||||
os << "view_border,";
|
||||
}
|
||||
if (node_operation_flags.is_resolution_set) {
|
||||
os << "resolution_set,";
|
||||
if (node_operation_flags.is_canvas_set) {
|
||||
os << "canvas_set,";
|
||||
}
|
||||
if (node_operation_flags.is_set_operation) {
|
||||
os << "set_operation,";
|
||||
|
|
|
@ -130,7 +130,7 @@ class NodeOperationInput {
|
|||
|
||||
SocketReader *getReader();
|
||||
|
||||
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
|
||||
bool determine_canvas(const rcti &preferred_area, rcti &r_area);
|
||||
|
||||
#ifdef WITH_CXX_GUARDEDALLOC
|
||||
MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeOperation")
|
||||
|
@ -158,12 +158,7 @@ class NodeOperationOutput {
|
|||
return m_datatype;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief determine the resolution of this data going through this socket
|
||||
* \param resolution: the result of this operation
|
||||
* \param preferredResolution: the preferable resolution as no resolution could be determined
|
||||
*/
|
||||
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area);
|
||||
|
||||
#ifdef WITH_CXX_GUARDEDALLOC
|
||||
MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeOperation")
|
||||
|
@ -211,9 +206,9 @@ struct NodeOperationFlags {
|
|||
bool use_viewer_border : 1;
|
||||
|
||||
/**
|
||||
* Is the resolution of the operation set.
|
||||
* Is the canvas of the operation set.
|
||||
*/
|
||||
bool is_resolution_set : 1;
|
||||
bool is_canvas_set : 1;
|
||||
|
||||
/**
|
||||
* Is this a set operation (value, color, vector).
|
||||
|
@ -257,7 +252,7 @@ struct NodeOperationFlags {
|
|||
open_cl = false;
|
||||
use_render_border = false;
|
||||
use_viewer_border = false;
|
||||
is_resolution_set = false;
|
||||
is_canvas_set = false;
|
||||
is_set_operation = false;
|
||||
is_read_buffer_operation = false;
|
||||
is_write_buffer_operation = false;
|
||||
|
@ -324,11 +319,11 @@ class NodeOperation {
|
|||
bool is_hash_output_params_implemented_;
|
||||
|
||||
/**
|
||||
* \brief the index of the input socket that will be used to determine the resolution
|
||||
* \brief the index of the input socket that will be used to determine the canvas
|
||||
*/
|
||||
unsigned int m_resolutionInputSocketIndex;
|
||||
unsigned int canvas_input_index_;
|
||||
|
||||
std::function<void(unsigned int resolution[2])> modify_determined_resolution_fn_;
|
||||
std::function<void(rcti &canvas)> modify_determined_canvas_fn_;
|
||||
|
||||
/**
|
||||
* \brief mutex reference for very special node initializations
|
||||
|
@ -352,15 +347,7 @@ class NodeOperation {
|
|||
*/
|
||||
eExecutionModel execution_model_;
|
||||
|
||||
/**
|
||||
* Width of the output of this operation.
|
||||
*/
|
||||
unsigned int m_width;
|
||||
|
||||
/**
|
||||
* Height of the output of this operation.
|
||||
*/
|
||||
unsigned int m_height;
|
||||
rcti canvas_;
|
||||
|
||||
/**
|
||||
* Flags how to evaluate this operation.
|
||||
|
@ -374,11 +361,6 @@ class NodeOperation {
|
|||
{
|
||||
}
|
||||
|
||||
void set_execution_model(const eExecutionModel model)
|
||||
{
|
||||
execution_model_ = model;
|
||||
}
|
||||
|
||||
void set_name(const std::string name)
|
||||
{
|
||||
m_name = name;
|
||||
|
@ -424,14 +406,7 @@ class NodeOperation {
|
|||
return getInputOperation(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief determine the resolution of this node
|
||||
* \note this method will not set the resolution, this is the responsibility of the caller
|
||||
* \param resolution: the result of this operation
|
||||
* \param preferredResolution: the preferable resolution as no resolution could be determined
|
||||
*/
|
||||
virtual void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]);
|
||||
virtual void determine_canvas(const rcti &preferred_area, rcti &r_area);
|
||||
|
||||
/**
|
||||
* \brief isOutputOperation determines whether this operation is an output of the
|
||||
|
@ -453,6 +428,11 @@ class NodeOperation {
|
|||
return false;
|
||||
}
|
||||
|
||||
void set_execution_model(const eExecutionModel model)
|
||||
{
|
||||
execution_model_ = model;
|
||||
}
|
||||
|
||||
void setbNodeTree(const bNodeTree *tree)
|
||||
{
|
||||
this->m_btree = tree;
|
||||
|
@ -527,19 +507,19 @@ class NodeOperation {
|
|||
}
|
||||
virtual void deinitExecution();
|
||||
|
||||
/**
|
||||
* \brief set the resolution
|
||||
* \param resolution: the resolution to set
|
||||
*/
|
||||
void setResolution(unsigned int resolution[2])
|
||||
void set_canvas(const rcti &canvas_area)
|
||||
{
|
||||
if (!this->flags.is_resolution_set) {
|
||||
this->m_width = resolution[0];
|
||||
this->m_height = resolution[1];
|
||||
this->flags.is_resolution_set = true;
|
||||
if (!this->flags.is_canvas_set) {
|
||||
canvas_ = canvas_area;
|
||||
flags.is_canvas_set = true;
|
||||
}
|
||||
}
|
||||
|
||||
const rcti &get_canvas() const
|
||||
{
|
||||
return canvas_;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief is this operation the active viewer output
|
||||
* user can select an ViewerNode to be active
|
||||
|
@ -557,18 +537,18 @@ class NodeOperation {
|
|||
rcti *output);
|
||||
|
||||
/**
|
||||
* \brief set the index of the input socket that will determine the resolution of this
|
||||
* \brief set the index of the input socket that will determine the canvas of this
|
||||
* operation \param index: the index to set
|
||||
*/
|
||||
void setResolutionInputSocketIndex(unsigned int index);
|
||||
void set_canvas_input_index(unsigned int index);
|
||||
|
||||
/**
|
||||
* Set a custom function to modify determined resolution from main input just before setting it
|
||||
* as preferred resolution for the other inputs.
|
||||
* Set a custom function to modify determined canvas from main input just before setting it
|
||||
* as preferred for the other inputs.
|
||||
*/
|
||||
void set_determined_resolution_modifier(std::function<void(unsigned int resolution[2])> fn)
|
||||
void set_determined_canvas_modifier(std::function<void(rcti &canvas)> fn)
|
||||
{
|
||||
modify_determined_resolution_fn_ = fn;
|
||||
modify_determined_canvas_fn_ = fn;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -595,12 +575,12 @@ class NodeOperation {
|
|||
|
||||
unsigned int getWidth() const
|
||||
{
|
||||
return m_width;
|
||||
return BLI_rcti_size_x(&canvas_);
|
||||
}
|
||||
|
||||
unsigned int getHeight() const
|
||||
{
|
||||
return m_height;
|
||||
return BLI_rcti_size_y(&canvas_);
|
||||
}
|
||||
|
||||
inline void readSampled(float result[4], float x, float y, PixelSampler sampler)
|
||||
|
@ -699,13 +679,13 @@ class NodeOperation {
|
|||
|
||||
void setWidth(unsigned int width)
|
||||
{
|
||||
this->m_width = width;
|
||||
this->flags.is_resolution_set = true;
|
||||
canvas_.xmax = canvas_.xmin + width;
|
||||
this->flags.is_canvas_set = true;
|
||||
}
|
||||
void setHeight(unsigned int height)
|
||||
{
|
||||
this->m_height = height;
|
||||
this->flags.is_resolution_set = true;
|
||||
canvas_.ymax = canvas_.ymin + height;
|
||||
this->flags.is_canvas_set = true;
|
||||
}
|
||||
SocketReader *getInputSocketReader(unsigned int inputSocketindex);
|
||||
NodeOperation *getInputOperation(unsigned int inputSocketindex);
|
||||
|
|
|
@ -106,7 +106,7 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system)
|
|||
folder.fold_operations();
|
||||
}
|
||||
|
||||
determineResolutions();
|
||||
determine_canvases();
|
||||
|
||||
save_graphviz("compositor_prior_merging");
|
||||
merge_equal_operations();
|
||||
|
@ -423,28 +423,27 @@ void NodeOperationBuilder::resolve_proxies()
|
|||
}
|
||||
}
|
||||
|
||||
void NodeOperationBuilder::determineResolutions()
|
||||
void NodeOperationBuilder::determine_canvases()
|
||||
{
|
||||
/* determine all resolutions of the operations (Width/Height) */
|
||||
/* Determine all canvas areas of the operations. */
|
||||
const rcti &preferred_area = COM_AREA_NONE;
|
||||
for (NodeOperation *op : m_operations) {
|
||||
if (op->isOutputOperation(m_context->isRendering()) && !op->get_flags().is_preview_operation) {
|
||||
unsigned int resolution[2] = {0, 0};
|
||||
unsigned int preferredResolution[2] = {0, 0};
|
||||
op->determineResolution(resolution, preferredResolution);
|
||||
op->setResolution(resolution);
|
||||
rcti canvas = COM_AREA_NONE;
|
||||
op->determine_canvas(preferred_area, canvas);
|
||||
op->set_canvas(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
for (NodeOperation *op : m_operations) {
|
||||
if (op->isOutputOperation(m_context->isRendering()) && op->get_flags().is_preview_operation) {
|
||||
unsigned int resolution[2] = {0, 0};
|
||||
unsigned int preferredResolution[2] = {0, 0};
|
||||
op->determineResolution(resolution, preferredResolution);
|
||||
op->setResolution(resolution);
|
||||
rcti canvas = COM_AREA_NONE;
|
||||
op->determine_canvas(preferred_area, canvas);
|
||||
op->set_canvas(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
/* add convert resolution operations when needed */
|
||||
/* Convert operation canvases when needed. */
|
||||
{
|
||||
Vector<Link> convert_links;
|
||||
for (const Link &link : m_links) {
|
||||
|
@ -457,7 +456,7 @@ void NodeOperationBuilder::determineResolutions()
|
|||
}
|
||||
}
|
||||
for (const Link &link : convert_links) {
|
||||
COM_convert_resolution(*this, link.from(), link.to());
|
||||
COM_convert_canvas(*this, link.from(), link.to());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,8 +145,8 @@ class NodeOperationBuilder {
|
|||
/** Replace proxy operations with direct links */
|
||||
void resolve_proxies();
|
||||
|
||||
/** Calculate resolution for each operation */
|
||||
void determineResolutions();
|
||||
/** Calculate canvas area for each operation. */
|
||||
void determine_canvases();
|
||||
|
||||
/** Helper function to store connected inputs for replacement */
|
||||
Vector<NodeOperationInput *> cache_output_links(NodeOperationOutput *output) const;
|
||||
|
|
|
@ -51,13 +51,13 @@ void AlphaOverNode::convertToOperations(NodeConverter &converter,
|
|||
|
||||
convertProg->setUseValueAlphaMultiply(false);
|
||||
if (color1Socket->isLinked()) {
|
||||
convertProg->setResolutionInputSocketIndex(1);
|
||||
convertProg->set_canvas_input_index(1);
|
||||
}
|
||||
else if (color2Socket->isLinked()) {
|
||||
convertProg->setResolutionInputSocketIndex(2);
|
||||
convertProg->set_canvas_input_index(2);
|
||||
}
|
||||
else {
|
||||
convertProg->setResolutionInputSocketIndex(0);
|
||||
convertProg->set_canvas_input_index(0);
|
||||
}
|
||||
|
||||
converter.addOperation(convertProg);
|
||||
|
|
|
@ -37,16 +37,16 @@ void CombineColorNode::convertToOperations(NodeConverter &converter,
|
|||
|
||||
CombineChannelsOperation *operation = new CombineChannelsOperation();
|
||||
if (inputRSocket->isLinked()) {
|
||||
operation->setResolutionInputSocketIndex(0);
|
||||
operation->set_canvas_input_index(0);
|
||||
}
|
||||
else if (inputGSocket->isLinked()) {
|
||||
operation->setResolutionInputSocketIndex(1);
|
||||
operation->set_canvas_input_index(1);
|
||||
}
|
||||
else if (inputBSocket->isLinked()) {
|
||||
operation->setResolutionInputSocketIndex(2);
|
||||
operation->set_canvas_input_index(2);
|
||||
}
|
||||
else {
|
||||
operation->setResolutionInputSocketIndex(3);
|
||||
operation->set_canvas_input_index(3);
|
||||
}
|
||||
converter.addOperation(operation);
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ void GlareNode::convertToOperations(NodeConverter &converter,
|
|||
mixvalueoperation->setValue(glare->mix);
|
||||
|
||||
MixGlareOperation *mixoperation = new MixGlareOperation();
|
||||
mixoperation->setResolutionInputSocketIndex(1);
|
||||
mixoperation->set_canvas_input_index(1);
|
||||
mixoperation->getInputSocket(2)->setResizeMode(ResizeMode::FitAny);
|
||||
|
||||
converter.addOperation(glareoperation);
|
||||
|
|
|
@ -53,7 +53,7 @@ void HueSaturationValueCorrectNode::convertToOperations(
|
|||
converter.addOperation(changeHSV);
|
||||
|
||||
MixBlendOperation *blend = new MixBlendOperation();
|
||||
blend->setResolutionInputSocketIndex(1);
|
||||
blend->set_canvas_input_index(1);
|
||||
converter.addOperation(blend);
|
||||
|
||||
converter.mapInputSocket(colorSocket, rgbToHSV->getInputSocket(0));
|
||||
|
|
|
@ -56,7 +56,7 @@ void HueSaturationValueNode::convertToOperations(NodeConverter &converter,
|
|||
converter.addOperation(changeHSV);
|
||||
|
||||
MixBlendOperation *blend = new MixBlendOperation();
|
||||
blend->setResolutionInputSocketIndex(1);
|
||||
blend->set_canvas_input_index(1);
|
||||
converter.addOperation(blend);
|
||||
|
||||
converter.mapInputSocket(colorSocket, rgbToHSV->getInputSocket(0));
|
||||
|
|
|
@ -34,7 +34,7 @@ void MapUVNode::convertToOperations(NodeConverter &converter,
|
|||
|
||||
MapUVOperation *operation = new MapUVOperation();
|
||||
operation->setAlpha((float)node->custom1);
|
||||
operation->setResolutionInputSocketIndex(1);
|
||||
operation->set_canvas_input_index(1);
|
||||
converter.addOperation(operation);
|
||||
|
||||
converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
|
||||
|
|
|
@ -39,7 +39,7 @@ void SetAlphaNode::convertToOperations(NodeConverter &converter,
|
|||
}
|
||||
|
||||
if (!this->getInputSocket(0)->isLinked() && this->getInputSocket(1)->isLinked()) {
|
||||
operation->setResolutionInputSocketIndex(1);
|
||||
operation->set_canvas_input_index(1);
|
||||
}
|
||||
|
||||
converter.addOperation(operation);
|
||||
|
|
|
@ -60,10 +60,10 @@ void ViewerNode::convertToOperations(NodeConverter &converter,
|
|||
viewerOperation->setViewSettings(context.getViewSettings());
|
||||
viewerOperation->setDisplaySettings(context.getDisplaySettings());
|
||||
|
||||
viewerOperation->setResolutionInputSocketIndex(0);
|
||||
viewerOperation->set_canvas_input_index(0);
|
||||
if (!imageSocket->isLinked()) {
|
||||
if (alphaSocket->isLinked()) {
|
||||
viewerOperation->setResolutionInputSocketIndex(1);
|
||||
viewerOperation->set_canvas_input_index(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -212,31 +212,30 @@ void BlurBaseOperation::updateSize()
|
|||
this->m_sizeavailable = true;
|
||||
}
|
||||
|
||||
void BlurBaseOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2])
|
||||
void BlurBaseOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
if (!m_extend_bounds) {
|
||||
NodeOperation::determineResolution(resolution, preferredResolution);
|
||||
NodeOperation::determine_canvas(preferred_area, r_area);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (execution_model_) {
|
||||
case eExecutionModel::Tiled: {
|
||||
NodeOperation::determineResolution(resolution, preferredResolution);
|
||||
resolution[0] += 2 * m_size * m_data.sizex;
|
||||
resolution[1] += 2 * m_size * m_data.sizey;
|
||||
NodeOperation::determine_canvas(preferred_area, r_area);
|
||||
r_area.xmax += 2 * m_size * m_data.sizex;
|
||||
r_area.ymax += 2 * m_size * m_data.sizey;
|
||||
break;
|
||||
}
|
||||
case eExecutionModel::FullFrame: {
|
||||
/* Setting a modifier ensures all non main inputs have extended bounds as preferred
|
||||
* resolution, avoiding unnecessary resolution conversions that would hide constant
|
||||
* canvas, avoiding unnecessary canvas convertions that would hide constant
|
||||
* operations. */
|
||||
set_determined_resolution_modifier([=](unsigned int res[2]) {
|
||||
set_determined_canvas_modifier([=](rcti &canvas) {
|
||||
/* Rounding to even prevents jiggling in backdrop while switching size values. */
|
||||
res[0] += round_to_even(2 * m_size * m_data.sizex);
|
||||
res[1] += round_to_even(2 * m_size * m_data.sizey);
|
||||
canvas.xmax += round_to_even(2 * m_size * m_data.sizex);
|
||||
canvas.ymax += round_to_even(2 * m_size * m_data.sizey);
|
||||
});
|
||||
NodeOperation::determineResolution(resolution, preferredResolution);
|
||||
NodeOperation::determine_canvas(preferred_area, r_area);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +250,7 @@ void BlurBaseOperation::get_area_of_interest(const int input_idx,
|
|||
r_input_area = output_area;
|
||||
break;
|
||||
case 1:
|
||||
r_input_area = use_variable_size_ ? output_area : COM_SINGLE_ELEM_AREA;
|
||||
r_input_area = use_variable_size_ ? output_area : COM_CONSTANT_INPUT_AREA_OF_INTEREST;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,8 +85,7 @@ class BlurBaseOperation : public MultiThreadedOperation, public QualityStepHelpe
|
|||
|
||||
int get_blur_size(eDimension dim) const;
|
||||
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
|
||||
virtual void get_area_of_interest(int input_idx,
|
||||
const rcti &output_area,
|
||||
|
|
|
@ -266,31 +266,30 @@ void BokehBlurOperation::updateSize()
|
|||
this->m_sizeavailable = true;
|
||||
}
|
||||
|
||||
void BokehBlurOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2])
|
||||
void BokehBlurOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
if (!m_extend_bounds) {
|
||||
NodeOperation::determineResolution(resolution, preferredResolution);
|
||||
NodeOperation::determine_canvas(preferred_area, r_area);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (execution_model_) {
|
||||
case eExecutionModel::Tiled: {
|
||||
NodeOperation::determineResolution(resolution, preferredResolution);
|
||||
const float max_dim = MAX2(resolution[0], resolution[1]);
|
||||
resolution[0] += 2 * this->m_size * max_dim / 100.0f;
|
||||
resolution[1] += 2 * this->m_size * max_dim / 100.0f;
|
||||
NodeOperation::determine_canvas(preferred_area, r_area);
|
||||
const float max_dim = MAX2(BLI_rcti_size_x(&r_area), BLI_rcti_size_y(&r_area));
|
||||
r_area.xmax += 2 * this->m_size * max_dim / 100.0f;
|
||||
r_area.ymax += 2 * this->m_size * max_dim / 100.0f;
|
||||
break;
|
||||
}
|
||||
case eExecutionModel::FullFrame: {
|
||||
set_determined_resolution_modifier([=](unsigned int res[2]) {
|
||||
const float max_dim = MAX2(res[0], res[1]);
|
||||
set_determined_canvas_modifier([=](rcti &canvas) {
|
||||
const float max_dim = MAX2(BLI_rcti_size_x(&canvas), BLI_rcti_size_y(&canvas));
|
||||
/* Rounding to even prevents image jiggling in backdrop while switching size values. */
|
||||
float add_size = round_to_even(2 * this->m_size * max_dim / 100.0f);
|
||||
res[0] += add_size;
|
||||
res[1] += add_size;
|
||||
canvas.xmax += add_size;
|
||||
canvas.ymax += add_size;
|
||||
});
|
||||
NodeOperation::determineResolution(resolution, preferredResolution);
|
||||
NodeOperation::determine_canvas(preferred_area, r_area);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -312,17 +311,14 @@ void BokehBlurOperation::get_area_of_interest(const int input_idx,
|
|||
}
|
||||
case BOKEH_INPUT_INDEX: {
|
||||
NodeOperation *bokeh_input = getInputOperation(BOKEH_INPUT_INDEX);
|
||||
r_input_area.xmin = 0;
|
||||
r_input_area.xmax = bokeh_input->getWidth();
|
||||
r_input_area.ymin = 0;
|
||||
r_input_area.ymax = bokeh_input->getHeight();
|
||||
r_input_area = bokeh_input->get_canvas();
|
||||
break;
|
||||
}
|
||||
case BOUNDING_BOX_INPUT_INDEX:
|
||||
r_input_area = output_area;
|
||||
break;
|
||||
case SIZE_INPUT_INDEX: {
|
||||
r_input_area = COM_SINGLE_ELEM_AREA;
|
||||
r_input_area = COM_CONSTANT_INPUT_AREA_OF_INTEREST;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,8 +80,7 @@ class BokehBlurOperation : public MultiThreadedOperation, public QualityStepHelp
|
|||
this->m_extend_bounds = extend_bounds;
|
||||
}
|
||||
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
|
||||
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override;
|
||||
void update_memory_buffer_partial(MemoryBuffer *output,
|
||||
|
|
|
@ -145,11 +145,13 @@ void BokehImageOperation::deinitExecution()
|
|||
}
|
||||
}
|
||||
|
||||
void BokehImageOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int /*preferredResolution*/[2])
|
||||
void BokehImageOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
resolution[0] = COM_BLUR_BOKEH_PIXELS;
|
||||
resolution[1] = COM_BLUR_BOKEH_PIXELS;
|
||||
BLI_rcti_init(&r_area,
|
||||
preferred_area.xmin,
|
||||
preferred_area.xmin + COM_BLUR_BOKEH_PIXELS,
|
||||
preferred_area.ymin,
|
||||
preferred_area.ymin + COM_BLUR_BOKEH_PIXELS);
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
|
|
@ -128,8 +128,7 @@ class BokehImageOperation : public MultiThreadedOperation {
|
|||
* \brief determine the resolution of this operation. currently fixed at [COM_BLUR_BOKEH_PIXELS,
|
||||
* COM_BLUR_BOKEH_PIXELS] \param resolution: \param preferredResolution:
|
||||
*/
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
|
||||
/**
|
||||
* \brief set the node data
|
||||
|
|
|
@ -165,11 +165,7 @@ void CalculateMeanOperation::get_area_of_interest(int input_idx,
|
|||
rcti &r_input_area)
|
||||
{
|
||||
BLI_assert(input_idx == 0);
|
||||
NodeOperation *operation = getInputOperation(input_idx);
|
||||
r_input_area.xmin = 0;
|
||||
r_input_area.ymin = 0;
|
||||
r_input_area.xmax = operation->getWidth();
|
||||
r_input_area.ymax = operation->getHeight();
|
||||
r_input_area = get_input_operation(input_idx)->get_canvas();
|
||||
}
|
||||
|
||||
void CalculateMeanOperation::update_memory_buffer_started(MemoryBuffer *UNUSED(output),
|
||||
|
|
|
@ -40,7 +40,7 @@ ColorBalanceASCCDLOperation::ColorBalanceASCCDLOperation()
|
|||
this->addOutputSocket(DataType::Color);
|
||||
this->m_inputValueOperation = nullptr;
|
||||
this->m_inputColorOperation = nullptr;
|
||||
this->setResolutionInputSocketIndex(1);
|
||||
this->set_canvas_input_index(1);
|
||||
flags.can_be_constant = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ ColorBalanceLGGOperation::ColorBalanceLGGOperation()
|
|||
this->addOutputSocket(DataType::Color);
|
||||
this->m_inputValueOperation = nullptr;
|
||||
this->m_inputColorOperation = nullptr;
|
||||
this->setResolutionInputSocketIndex(1);
|
||||
this->set_canvas_input_index(1);
|
||||
flags.can_be_constant = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ ColorCurveOperation::ColorCurveOperation()
|
|||
this->m_inputBlackProgram = nullptr;
|
||||
this->m_inputWhiteProgram = nullptr;
|
||||
|
||||
this->setResolutionInputSocketIndex(1);
|
||||
this->set_canvas_input_index(1);
|
||||
}
|
||||
void ColorCurveOperation::initExecution()
|
||||
{
|
||||
|
@ -139,7 +139,7 @@ ConstantLevelColorCurveOperation::ConstantLevelColorCurveOperation()
|
|||
this->m_inputFacProgram = nullptr;
|
||||
this->m_inputImageProgram = nullptr;
|
||||
|
||||
this->setResolutionInputSocketIndex(1);
|
||||
this->set_canvas_input_index(1);
|
||||
}
|
||||
void ConstantLevelColorCurveOperation::initExecution()
|
||||
{
|
||||
|
|
|
@ -236,8 +236,7 @@ void CompositorOperation::update_memory_buffer_partial(MemoryBuffer *UNUSED(outp
|
|||
depth_buf.copy_from(inputs[2], area);
|
||||
}
|
||||
|
||||
void CompositorOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2])
|
||||
void CompositorOperation::determine_canvas(const rcti &UNUSED(preferred_area), rcti &r_area)
|
||||
{
|
||||
int width = this->m_rd->xsch * this->m_rd->size / 100;
|
||||
int height = this->m_rd->ysch * this->m_rd->size / 100;
|
||||
|
@ -254,13 +253,11 @@ void CompositorOperation::determineResolution(unsigned int resolution[2],
|
|||
RE_ReleaseResult(re);
|
||||
}
|
||||
|
||||
preferredResolution[0] = width;
|
||||
preferredResolution[1] = height;
|
||||
rcti local_preferred;
|
||||
BLI_rcti_init(&local_preferred, 0, width, 0, height);
|
||||
|
||||
NodeOperation::determineResolution(resolution, preferredResolution);
|
||||
|
||||
resolution[0] = width;
|
||||
resolution[1] = height;
|
||||
NodeOperation::determine_canvas(local_preferred, r_area);
|
||||
r_area = local_preferred;
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
|
|
@ -115,8 +115,7 @@ class CompositorOperation : public MultiThreadedOperation {
|
|||
{
|
||||
return eCompositorPriority::Medium;
|
||||
}
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
void setUseAlphaInput(bool value)
|
||||
{
|
||||
this->m_useAlphaInput = value;
|
||||
|
|
|
@ -22,14 +22,14 @@ namespace blender::compositor {
|
|||
|
||||
ConstantOperation::ConstantOperation()
|
||||
{
|
||||
needs_resolution_to_get_constant_ = false;
|
||||
needs_canvas_to_get_constant_ = false;
|
||||
flags.is_constant_operation = true;
|
||||
flags.is_fullframe_operation = true;
|
||||
}
|
||||
|
||||
bool ConstantOperation::can_get_constant_elem() const
|
||||
{
|
||||
return !needs_resolution_to_get_constant_ || this->flags.is_resolution_set;
|
||||
return !needs_canvas_to_get_constant_ || this->flags.is_canvas_set;
|
||||
}
|
||||
|
||||
void ConstantOperation::update_memory_buffer(MemoryBuffer *output,
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace blender::compositor {
|
|||
*/
|
||||
class ConstantOperation : public NodeOperation {
|
||||
protected:
|
||||
bool needs_resolution_to_get_constant_;
|
||||
bool needs_canvas_to_get_constant_;
|
||||
|
||||
public:
|
||||
ConstantOperation();
|
||||
|
|
|
@ -587,7 +587,7 @@ CombineChannelsOperation::CombineChannelsOperation()
|
|||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->set_canvas_input_index(0);
|
||||
this->m_inputChannel1Operation = nullptr;
|
||||
this->m_inputChannel2Operation = nullptr;
|
||||
this->m_inputChannel3Operation = nullptr;
|
||||
|
|
|
@ -29,7 +29,7 @@ ConvolutionFilterOperation::ConvolutionFilterOperation()
|
|||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->set_canvas_input_index(0);
|
||||
this->m_inputOperation = nullptr;
|
||||
this->flags.complex = true;
|
||||
}
|
||||
|
|
|
@ -142,13 +142,12 @@ void CropImageOperation::get_area_of_interest(const int input_idx,
|
|||
r_input_area.ymin = output_area.ymin + this->m_ymin;
|
||||
}
|
||||
|
||||
void CropImageOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2])
|
||||
void CropImageOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
NodeOperation::determineResolution(resolution, preferredResolution);
|
||||
NodeOperation::determine_canvas(preferred_area, r_area);
|
||||
updateArea();
|
||||
resolution[0] = this->m_xmax - this->m_xmin;
|
||||
resolution[1] = this->m_ymax - this->m_ymin;
|
||||
r_area.xmax = r_area.xmin + (m_xmax - m_xmin);
|
||||
r_area.ymax = r_area.ymin + (m_ymax - m_ymin);
|
||||
}
|
||||
|
||||
void CropImageOperation::executePixelSampled(float output[4],
|
||||
|
|
|
@ -66,8 +66,7 @@ class CropImageOperation : public CropBaseOperation {
|
|||
bool determineDependingAreaOfInterest(rcti *input,
|
||||
ReadBufferOperation *readOperation,
|
||||
rcti *output) override;
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override;
|
||||
|
|
|
@ -153,10 +153,7 @@ void DenoiseBaseOperation::get_area_of_interest(const int UNUSED(input_idx),
|
|||
const rcti &UNUSED(output_area),
|
||||
rcti &r_input_area)
|
||||
{
|
||||
r_input_area.xmin = 0;
|
||||
r_input_area.xmax = this->getWidth();
|
||||
r_input_area.ymin = 0;
|
||||
r_input_area.ymax = this->getHeight();
|
||||
r_input_area = this->get_canvas();
|
||||
}
|
||||
|
||||
DenoiseOperation::DenoiseOperation()
|
||||
|
|
|
@ -29,7 +29,7 @@ DespeckleOperation::DespeckleOperation()
|
|||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->set_canvas_input_index(0);
|
||||
this->m_inputOperation = nullptr;
|
||||
this->flags.complex = true;
|
||||
}
|
||||
|
|
|
@ -152,10 +152,7 @@ void DirectionalBlurOperation::get_area_of_interest(const int input_idx,
|
|||
{
|
||||
BLI_assert(input_idx == 0);
|
||||
UNUSED_VARS_NDEBUG(input_idx);
|
||||
r_input_area.xmin = 0;
|
||||
r_input_area.xmax = this->getWidth();
|
||||
r_input_area.ymin = 0;
|
||||
r_input_area.ymax = this->getHeight();
|
||||
r_input_area = this->get_canvas();
|
||||
}
|
||||
|
||||
void DirectionalBlurOperation::update_memory_buffer_partial(MemoryBuffer *output,
|
||||
|
|
|
@ -211,10 +211,7 @@ void DisplaceOperation::get_area_of_interest(const int input_idx,
|
|||
{
|
||||
switch (input_idx) {
|
||||
case 0: {
|
||||
r_input_area.xmin = 0;
|
||||
r_input_area.ymin = 0;
|
||||
r_input_area.xmax = getInputOperation(input_idx)->getWidth();
|
||||
r_input_area.ymax = getInputOperation(input_idx)->getHeight();
|
||||
r_input_area = getInputOperation(input_idx)->get_canvas();
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
|
|
|
@ -138,10 +138,7 @@ void DisplaceSimpleOperation::get_area_of_interest(const int input_idx,
|
|||
{
|
||||
switch (input_idx) {
|
||||
case 0: {
|
||||
r_input_area.xmin = 0;
|
||||
r_input_area.ymin = 0;
|
||||
r_input_area.xmax = getInputOperation(input_idx)->getWidth();
|
||||
r_input_area.ymax = getInputOperation(input_idx)->getHeight();
|
||||
r_input_area = get_input_operation(input_idx)->get_canvas();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
|
|
@ -25,7 +25,7 @@ DotproductOperation::DotproductOperation()
|
|||
this->addInputSocket(DataType::Vector);
|
||||
this->addInputSocket(DataType::Vector);
|
||||
this->addOutputSocket(DataType::Value);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->set_canvas_input_index(0);
|
||||
this->m_input1Operation = nullptr;
|
||||
this->m_input2Operation = nullptr;
|
||||
flags.can_be_constant = true;
|
||||
|
|
|
@ -1399,10 +1399,7 @@ void DoubleEdgeMaskOperation::get_area_of_interest(int UNUSED(input_idx),
|
|||
const rcti &UNUSED(output_area),
|
||||
rcti &r_input_area)
|
||||
{
|
||||
r_input_area.xmax = this->getWidth();
|
||||
r_input_area.xmin = 0;
|
||||
r_input_area.ymax = this->getHeight();
|
||||
r_input_area.ymin = 0;
|
||||
r_input_area = this->get_canvas();
|
||||
}
|
||||
|
||||
void DoubleEdgeMaskOperation::update_memory_buffer(MemoryBuffer *output,
|
||||
|
|
|
@ -271,10 +271,7 @@ void FastGaussianBlurOperation::get_area_of_interest(const int input_idx,
|
|||
{
|
||||
switch (input_idx) {
|
||||
case IMAGE_INPUT_INDEX:
|
||||
r_input_area.xmin = 0;
|
||||
r_input_area.xmax = getWidth();
|
||||
r_input_area.ymin = 0;
|
||||
r_input_area.ymax = getHeight();
|
||||
r_input_area = this->get_canvas();
|
||||
break;
|
||||
default:
|
||||
BlurBaseOperation::get_area_of_interest(input_idx, output_area, r_input_area);
|
||||
|
@ -411,10 +408,7 @@ void FastGaussianBlurValueOperation::get_area_of_interest(const int UNUSED(input
|
|||
const rcti &UNUSED(output_area),
|
||||
rcti &r_input_area)
|
||||
{
|
||||
r_input_area.xmin = 0;
|
||||
r_input_area.xmax = getWidth();
|
||||
r_input_area.ymin = 0;
|
||||
r_input_area.ymax = getHeight();
|
||||
r_input_area = this->get_canvas();
|
||||
}
|
||||
|
||||
void FastGaussianBlurValueOperation::update_memory_buffer_started(MemoryBuffer *UNUSED(output),
|
||||
|
|
|
@ -24,7 +24,7 @@ FlipOperation::FlipOperation()
|
|||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->set_canvas_input_index(0);
|
||||
this->m_inputOperation = nullptr;
|
||||
this->m_flipX = true;
|
||||
this->m_flipY = false;
|
||||
|
|
|
@ -30,12 +30,13 @@ GlareThresholdOperation::GlareThresholdOperation()
|
|||
this->m_inputProgram = nullptr;
|
||||
}
|
||||
|
||||
void GlareThresholdOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2])
|
||||
void GlareThresholdOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
NodeOperation::determineResolution(resolution, preferredResolution);
|
||||
resolution[0] = resolution[0] / (1 << this->m_settings->quality);
|
||||
resolution[1] = resolution[1] / (1 << this->m_settings->quality);
|
||||
NodeOperation::determine_canvas(preferred_area, r_area);
|
||||
const int width = BLI_rcti_size_x(&r_area) / (1 << this->m_settings->quality);
|
||||
const int height = BLI_rcti_size_y(&r_area) / (1 << this->m_settings->quality);
|
||||
r_area.xmax = r_area.xmin + width;
|
||||
r_area.ymax = r_area.ymin + height;
|
||||
}
|
||||
|
||||
void GlareThresholdOperation::initExecution()
|
||||
|
|
|
@ -58,8 +58,7 @@ class GlareThresholdOperation : public NodeOperation {
|
|||
this->m_settings = settings;
|
||||
}
|
||||
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
|
|
@ -112,17 +112,14 @@ void BaseImageOperation::deinitExecution()
|
|||
}
|
||||
}
|
||||
|
||||
void BaseImageOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int /*preferredResolution*/[2])
|
||||
void BaseImageOperation::determine_canvas(const rcti &UNUSED(preferred_area), rcti &r_area)
|
||||
{
|
||||
ImBuf *stackbuf = getImBuf();
|
||||
|
||||
resolution[0] = 0;
|
||||
resolution[1] = 0;
|
||||
r_area = COM_AREA_NONE;
|
||||
|
||||
if (stackbuf) {
|
||||
resolution[0] = stackbuf->x;
|
||||
resolution[1] = stackbuf->y;
|
||||
BLI_rcti_init(&r_area, 0, stackbuf->x, 0, stackbuf->y);
|
||||
}
|
||||
|
||||
BKE_image_release_ibuf(this->m_image, stackbuf, nullptr);
|
||||
|
@ -222,7 +219,7 @@ void ImageDepthOperation::executePixelSampled(float output[4],
|
|||
output[0] = 0.0f;
|
||||
}
|
||||
else {
|
||||
int offset = y * this->m_width + x;
|
||||
int offset = y * getWidth() + x;
|
||||
output[0] = this->m_depthBuffer[offset];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,8 +54,7 @@ class BaseImageOperation : public MultiThreadedOperation {
|
|||
/**
|
||||
* Determine the output resolution. The resolution is retrieved from the Renderer
|
||||
*/
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
|
||||
virtual ImBuf *getImBuf();
|
||||
|
||||
|
|
|
@ -293,10 +293,7 @@ void InpaintSimpleOperation::get_area_of_interest(const int input_idx,
|
|||
{
|
||||
BLI_assert(input_idx == 0);
|
||||
UNUSED_VARS_NDEBUG(input_idx);
|
||||
r_input_area.xmin = 0;
|
||||
r_input_area.xmax = this->getWidth();
|
||||
r_input_area.ymin = 0;
|
||||
r_input_area.ymax = this->getHeight();
|
||||
r_input_area = this->get_canvas();
|
||||
}
|
||||
|
||||
void InpaintSimpleOperation::update_memory_buffer(MemoryBuffer *output,
|
||||
|
|
|
@ -29,7 +29,7 @@ InvertOperation::InvertOperation()
|
|||
this->m_inputColorProgram = nullptr;
|
||||
this->m_color = true;
|
||||
this->m_alpha = false;
|
||||
setResolutionInputSocketIndex(1);
|
||||
set_canvas_input_index(1);
|
||||
this->flags.can_be_constant = true;
|
||||
}
|
||||
void InvertOperation::initExecution()
|
||||
|
|
|
@ -303,11 +303,9 @@ void KeyingScreenOperation::deinitializeTileData(rcti * /*rect*/, void *data)
|
|||
MEM_freeN(tile_data);
|
||||
}
|
||||
|
||||
void KeyingScreenOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int /*preferredResolution*/[2])
|
||||
void KeyingScreenOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
resolution[0] = 0;
|
||||
resolution[1] = 0;
|
||||
r_area = COM_AREA_NONE;
|
||||
|
||||
if (this->m_movieClip) {
|
||||
MovieClipUser user = {0};
|
||||
|
@ -317,9 +315,9 @@ void KeyingScreenOperation::determineResolution(unsigned int resolution[2],
|
|||
|
||||
BKE_movieclip_user_set_frame(&user, clip_frame);
|
||||
BKE_movieclip_get_size(this->m_movieClip, &user, &width, &height);
|
||||
|
||||
resolution[0] = width;
|
||||
resolution[1] = height;
|
||||
r_area = preferred_area;
|
||||
r_area.xmax = r_area.xmin + width;
|
||||
r_area.ymax = r_area.ymin + height;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,8 +57,7 @@ class KeyingScreenOperation : public MultiThreadedOperation {
|
|||
/**
|
||||
* Determine the output resolution. The resolution is retrieved from the Renderer
|
||||
*/
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
|
||||
TriangulationData *buildVoronoiTriangulation();
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ MapUVOperation::MapUVOperation()
|
|||
this->addOutputSocket(DataType::Color);
|
||||
this->m_alpha = 0.0f;
|
||||
this->flags.complex = true;
|
||||
setResolutionInputSocketIndex(1);
|
||||
set_canvas_input_index(UV_INPUT_INDEX);
|
||||
|
||||
this->m_inputUVProgram = nullptr;
|
||||
this->m_inputColorProgram = nullptr;
|
||||
|
@ -36,11 +36,11 @@ MapUVOperation::MapUVOperation()
|
|||
|
||||
void MapUVOperation::init_data()
|
||||
{
|
||||
NodeOperation *image_input = get_input_operation(0);
|
||||
NodeOperation *image_input = get_input_operation(IMAGE_INPUT_INDEX);
|
||||
image_width_ = image_input->getWidth();
|
||||
image_height_ = image_input->getHeight();
|
||||
|
||||
NodeOperation *uv_input = get_input_operation(1);
|
||||
NodeOperation *uv_input = get_input_operation(UV_INPUT_INDEX);
|
||||
uv_width_ = uv_input->getWidth();
|
||||
uv_height_ = uv_input->getHeight();
|
||||
}
|
||||
|
@ -205,14 +205,11 @@ void MapUVOperation::get_area_of_interest(const int input_idx,
|
|||
rcti &r_input_area)
|
||||
{
|
||||
switch (input_idx) {
|
||||
case 0: {
|
||||
r_input_area.xmin = 0;
|
||||
r_input_area.xmax = image_width_;
|
||||
r_input_area.ymin = 0;
|
||||
r_input_area.ymax = image_height_;
|
||||
case IMAGE_INPUT_INDEX: {
|
||||
r_input_area = get_input_operation(IMAGE_INPUT_INDEX)->get_canvas();
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
case UV_INPUT_INDEX: {
|
||||
r_input_area = output_area;
|
||||
expand_area_for_sampler(r_input_area, PixelSampler::Bilinear);
|
||||
break;
|
||||
|
@ -224,7 +221,7 @@ void MapUVOperation::update_memory_buffer_started(MemoryBuffer *UNUSED(output),
|
|||
const rcti &UNUSED(area),
|
||||
Span<MemoryBuffer *> inputs)
|
||||
{
|
||||
const MemoryBuffer *uv_input = inputs[1];
|
||||
const MemoryBuffer *uv_input = inputs[UV_INPUT_INDEX];
|
||||
uv_input_read_fn_ = [=](float x, float y, float *out) {
|
||||
uv_input->read_elem_bilinear(x, y, out);
|
||||
};
|
||||
|
@ -234,7 +231,7 @@ void MapUVOperation::update_memory_buffer_partial(MemoryBuffer *output,
|
|||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs)
|
||||
{
|
||||
const MemoryBuffer *input_image = inputs[0];
|
||||
const MemoryBuffer *input_image = inputs[IMAGE_INPUT_INDEX];
|
||||
for (BuffersIterator<float> it = output->iterate_with({}, area); !it.is_end(); ++it) {
|
||||
float xy[2] = {(float)it.x, (float)it.y};
|
||||
float uv[2];
|
||||
|
|
|
@ -24,6 +24,8 @@ namespace blender::compositor {
|
|||
|
||||
class MapUVOperation : public MultiThreadedOperation {
|
||||
private:
|
||||
static constexpr int IMAGE_INPUT_INDEX = 0;
|
||||
static constexpr int UV_INPUT_INDEX = 1;
|
||||
/**
|
||||
* Cached reference to the inputProgram
|
||||
*/
|
||||
|
|
|
@ -109,22 +109,15 @@ void MaskOperation::deinitExecution()
|
|||
}
|
||||
}
|
||||
|
||||
void MaskOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2])
|
||||
void MaskOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
if (this->m_maskWidth == 0 || this->m_maskHeight == 0) {
|
||||
NodeOperation::determineResolution(resolution, preferredResolution);
|
||||
r_area = COM_AREA_NONE;
|
||||
}
|
||||
else {
|
||||
unsigned int nr[2];
|
||||
|
||||
nr[0] = this->m_maskWidth;
|
||||
nr[1] = this->m_maskHeight;
|
||||
|
||||
NodeOperation::determineResolution(resolution, nr);
|
||||
|
||||
resolution[0] = this->m_maskWidth;
|
||||
resolution[1] = this->m_maskHeight;
|
||||
r_area = preferred_area;
|
||||
r_area.xmax = r_area.xmin + m_maskWidth;
|
||||
r_area.ymax = r_area.ymin + m_maskHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,8 +54,7 @@ class MaskOperation : public MultiThreadedOperation {
|
|||
/**
|
||||
* Determine the output resolution. The resolution is retrieved from the Renderer
|
||||
*/
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
|
||||
public:
|
||||
MaskOperation();
|
||||
|
|
|
@ -51,22 +51,19 @@ void MathBaseOperation::deinitExecution()
|
|||
this->m_inputValue3Operation = nullptr;
|
||||
}
|
||||
|
||||
void MathBaseOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2])
|
||||
void MathBaseOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
NodeOperationInput *socket;
|
||||
unsigned int tempPreferredResolution[2] = {0, 0};
|
||||
unsigned int tempResolution[2];
|
||||
|
||||
rcti temp_area;
|
||||
socket = this->getInputSocket(0);
|
||||
socket->determineResolution(tempResolution, tempPreferredResolution);
|
||||
if ((tempResolution[0] != 0) && (tempResolution[1] != 0)) {
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
const bool determined = socket->determine_canvas(COM_AREA_NONE, temp_area);
|
||||
if (determined) {
|
||||
this->set_canvas_input_index(0);
|
||||
}
|
||||
else {
|
||||
this->setResolutionInputSocketIndex(1);
|
||||
this->set_canvas_input_index(1);
|
||||
}
|
||||
NodeOperation::determineResolution(resolution, preferredResolution);
|
||||
NodeOperation::determine_canvas(preferred_area, r_area);
|
||||
}
|
||||
|
||||
void MathBaseOperation::clampIfNeeded(float *color)
|
||||
|
|
|
@ -75,8 +75,7 @@ class MathBaseOperation : public MultiThreadedOperation {
|
|||
/**
|
||||
* Determine resolution
|
||||
*/
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
|
||||
void setUseClamp(bool value)
|
||||
{
|
||||
|
|
|
@ -66,29 +66,27 @@ void MixBaseOperation::executePixelSampled(float output[4], float x, float y, Pi
|
|||
output[3] = inputColor1[3];
|
||||
}
|
||||
|
||||
void MixBaseOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2])
|
||||
void MixBaseOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
NodeOperationInput *socket;
|
||||
unsigned int tempPreferredResolution[2] = {0, 0};
|
||||
unsigned int tempResolution[2];
|
||||
rcti temp_area;
|
||||
|
||||
socket = this->getInputSocket(1);
|
||||
socket->determineResolution(tempResolution, tempPreferredResolution);
|
||||
if ((tempResolution[0] != 0) && (tempResolution[1] != 0)) {
|
||||
this->setResolutionInputSocketIndex(1);
|
||||
bool determined = socket->determine_canvas(COM_AREA_NONE, temp_area);
|
||||
if (determined) {
|
||||
this->set_canvas_input_index(1);
|
||||
}
|
||||
else {
|
||||
socket = this->getInputSocket(2);
|
||||
socket->determineResolution(tempResolution, tempPreferredResolution);
|
||||
if ((tempResolution[0] != 0) && (tempResolution[1] != 0)) {
|
||||
this->setResolutionInputSocketIndex(2);
|
||||
determined = socket->determine_canvas(COM_AREA_NONE, temp_area);
|
||||
if (determined) {
|
||||
this->set_canvas_input_index(2);
|
||||
}
|
||||
else {
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->set_canvas_input_index(0);
|
||||
}
|
||||
}
|
||||
NodeOperation::determineResolution(resolution, preferredResolution);
|
||||
NodeOperation::determine_canvas(preferred_area, r_area);
|
||||
}
|
||||
|
||||
void MixBaseOperation::deinitExecution()
|
||||
|
|
|
@ -87,8 +87,7 @@ class MixBaseOperation : public MultiThreadedOperation {
|
|||
*/
|
||||
void deinitExecution() override;
|
||||
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
|
||||
void setUseValueAlphaMultiply(const bool value)
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@ MovieClipAttributeOperation::MovieClipAttributeOperation()
|
|||
this->m_framenumber = 0;
|
||||
this->m_attribute = MCA_X;
|
||||
this->m_invert = false;
|
||||
needs_resolution_to_get_constant_ = true;
|
||||
needs_canvas_to_get_constant_ = true;
|
||||
is_value_calculated_ = false;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ void MovieClipAttributeOperation::initExecution()
|
|||
|
||||
void MovieClipAttributeOperation::calc_value()
|
||||
{
|
||||
BLI_assert(this->get_flags().is_resolution_set);
|
||||
BLI_assert(this->get_flags().is_canvas_set);
|
||||
is_value_calculated_ = true;
|
||||
if (this->m_clip == nullptr) {
|
||||
return;
|
||||
|
@ -87,11 +87,9 @@ void MovieClipAttributeOperation::executePixelSampled(float output[4],
|
|||
output[0] = this->m_value;
|
||||
}
|
||||
|
||||
void MovieClipAttributeOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2])
|
||||
void MovieClipAttributeOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
resolution[0] = preferredResolution[0];
|
||||
resolution[1] = preferredResolution[1];
|
||||
r_area = preferred_area;
|
||||
}
|
||||
|
||||
const float *MovieClipAttributeOperation::get_constant_elem()
|
||||
|
|
|
@ -55,8 +55,7 @@ class MovieClipAttributeOperation : public ConstantOperation {
|
|||
* The inner loop of this operation.
|
||||
*/
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
|
||||
const float *get_constant_elem() override;
|
||||
|
||||
|
|
|
@ -71,19 +71,13 @@ void MovieClipBaseOperation::deinitExecution()
|
|||
}
|
||||
}
|
||||
|
||||
void MovieClipBaseOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int /*preferredResolution*/[2])
|
||||
void MovieClipBaseOperation::determine_canvas(const rcti &UNUSED(preferred_area), rcti &r_area)
|
||||
{
|
||||
resolution[0] = 0;
|
||||
resolution[1] = 0;
|
||||
|
||||
r_area = COM_AREA_NONE;
|
||||
if (this->m_movieClip) {
|
||||
int width, height;
|
||||
|
||||
BKE_movieclip_get_size(this->m_movieClip, this->m_movieClipUser, &width, &height);
|
||||
|
||||
resolution[0] = width;
|
||||
resolution[1] = height;
|
||||
BLI_rcti_init(&r_area, 0, width, 0, height);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,7 @@ class MovieClipBaseOperation : public MultiThreadedOperation {
|
|||
/**
|
||||
* Determine the output resolution. The resolution is retrieved from the Renderer
|
||||
*/
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
|
||||
public:
|
||||
MovieClipBaseOperation();
|
||||
|
|
|
@ -29,7 +29,7 @@ MovieDistortionOperation::MovieDistortionOperation(bool distortion)
|
|||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->set_canvas_input_index(0);
|
||||
this->m_inputOperation = nullptr;
|
||||
this->m_movieClip = nullptr;
|
||||
this->m_apply = distortion;
|
||||
|
@ -49,10 +49,10 @@ void MovieDistortionOperation::initExecution()
|
|||
float delta[2];
|
||||
rcti full_frame;
|
||||
full_frame.xmin = full_frame.ymin = 0;
|
||||
full_frame.xmax = this->m_width;
|
||||
full_frame.ymax = this->m_height;
|
||||
full_frame.xmax = this->getWidth();
|
||||
full_frame.ymax = this->getHeight();
|
||||
BKE_tracking_max_distortion_delta_across_bound(
|
||||
tracking, this->m_width, this->m_height, &full_frame, !this->m_apply, delta);
|
||||
tracking, this->getWidth(), this->getHeight(), &full_frame, !this->m_apply, delta);
|
||||
|
||||
/* 5 is just in case we didn't hit real max of distortion in
|
||||
* BKE_tracking_max_undistortion_delta_across_bound
|
||||
|
@ -89,8 +89,8 @@ void MovieDistortionOperation::executePixelSampled(float output[4],
|
|||
if (this->m_distortion != nullptr) {
|
||||
/* float overscan = 0.0f; */
|
||||
const float pixel_aspect = this->m_pixel_aspect;
|
||||
const float w = (float)this->m_width /* / (1 + overscan) */;
|
||||
const float h = (float)this->m_height /* / (1 + overscan) */;
|
||||
const float w = (float)this->getWidth() /* / (1 + overscan) */;
|
||||
const float h = (float)this->getHeight() /* / (1 + overscan) */;
|
||||
const float aspx = w / (float)this->m_calibration_width;
|
||||
const float aspy = h / (float)this->m_calibration_height;
|
||||
float in[2];
|
||||
|
@ -152,8 +152,8 @@ void MovieDistortionOperation::update_memory_buffer_partial(MemoryBuffer *output
|
|||
|
||||
/* `float overscan = 0.0f;` */
|
||||
const float pixel_aspect = this->m_pixel_aspect;
|
||||
const float w = (float)this->m_width /* `/ (1 + overscan)` */;
|
||||
const float h = (float)this->m_height /* `/ (1 + overscan)` */;
|
||||
const float w = (float)this->getWidth() /* `/ (1 + overscan)` */;
|
||||
const float h = (float)this->getHeight() /* `/ (1 + overscan)` */;
|
||||
const float aspx = w / (float)this->m_calibration_width;
|
||||
const float aspy = h / (float)this->m_calibration_height;
|
||||
float xy[2];
|
||||
|
|
|
@ -133,11 +133,7 @@ void NormalizeOperation::get_area_of_interest(const int UNUSED(input_idx),
|
|||
const rcti &UNUSED(output_area),
|
||||
rcti &r_input_area)
|
||||
{
|
||||
NodeOperation *input = get_input_operation(0);
|
||||
r_input_area.xmin = 0;
|
||||
r_input_area.xmax = input->getWidth();
|
||||
r_input_area.ymin = 0;
|
||||
r_input_area.ymax = input->getHeight();
|
||||
r_input_area = get_input_operation(0)->get_canvas();
|
||||
}
|
||||
|
||||
void NormalizeOperation::update_memory_buffer_started(MemoryBuffer *UNUSED(output),
|
||||
|
|
|
@ -339,7 +339,7 @@ OutputOpenExrMultiLayerOperation::OutputOpenExrMultiLayerOperation(const Scene *
|
|||
this->m_exr_codec = exr_codec;
|
||||
this->m_exr_half_float = exr_half_float;
|
||||
this->m_viewName = viewName;
|
||||
this->setResolutionInputSocketIndex(RESOLUTION_INPUT_ANY);
|
||||
this->set_canvas_input_index(RESOLUTION_INPUT_ANY);
|
||||
}
|
||||
|
||||
void OutputOpenExrMultiLayerOperation::add_layer(const char *name,
|
||||
|
|
|
@ -24,7 +24,7 @@ PixelateOperation::PixelateOperation(DataType datatype)
|
|||
{
|
||||
this->addInputSocket(datatype);
|
||||
this->addOutputSocket(datatype);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->set_canvas_input_index(0);
|
||||
this->m_inputOperation = nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -209,15 +209,13 @@ void *PlaneCornerPinMaskOperation::initializeTileData(rcti *rect)
|
|||
return data;
|
||||
}
|
||||
|
||||
void PlaneCornerPinMaskOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2])
|
||||
void PlaneCornerPinMaskOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
if (execution_model_ == eExecutionModel::FullFrame) {
|
||||
/* Determine inputs resolution. */
|
||||
PlaneDistortMaskOperation::determineResolution(resolution, preferredResolution);
|
||||
/* Determine input canvases. */
|
||||
PlaneDistortMaskOperation::determine_canvas(preferred_area, r_area);
|
||||
}
|
||||
resolution[0] = preferredResolution[0];
|
||||
resolution[1] = preferredResolution[1];
|
||||
r_area = preferred_area;
|
||||
}
|
||||
|
||||
void PlaneCornerPinMaskOperation::get_area_of_interest(const int UNUSED(input_idx),
|
||||
|
@ -225,7 +223,7 @@ void PlaneCornerPinMaskOperation::get_area_of_interest(const int UNUSED(input_id
|
|||
rcti &r_input_area)
|
||||
{
|
||||
/* All corner inputs are used as constants. */
|
||||
r_input_area = COM_SINGLE_ELEM_AREA;
|
||||
r_input_area = COM_CONSTANT_INPUT_AREA_OF_INTEREST;
|
||||
}
|
||||
|
||||
/* ******** PlaneCornerPinWarpImageOperation ******** */
|
||||
|
@ -322,7 +320,7 @@ void PlaneCornerPinWarpImageOperation::get_area_of_interest(const int input_idx,
|
|||
}
|
||||
else {
|
||||
/* Corner inputs are used as constants. */
|
||||
r_input_area = COM_SINGLE_ELEM_AREA;
|
||||
r_input_area = COM_CONSTANT_INPUT_AREA_OF_INTEREST;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,8 +43,7 @@ class PlaneCornerPinMaskOperation : public PlaneDistortMaskOperation {
|
|||
|
||||
void *initializeTileData(rcti *rect) override;
|
||||
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
|
||||
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override;
|
||||
};
|
||||
|
|
|
@ -196,10 +196,7 @@ void PlaneDistortWarpImageOperation::get_area_of_interest(const int input_idx,
|
|||
}
|
||||
|
||||
/* TODO: figure out the area needed for warping and EWA filtering. */
|
||||
r_input_area.xmin = 0;
|
||||
r_input_area.ymin = 0;
|
||||
r_input_area.xmax = get_input_operation(0)->getWidth();
|
||||
r_input_area.ymax = get_input_operation(0)->getHeight();
|
||||
r_input_area = get_input_operation(0)->get_canvas();
|
||||
|
||||
/* Old implementation but resulting coordinates are way out of input operation bounds and in some
|
||||
* cases the area result may incorrectly cause cropping. */
|
||||
|
|
|
@ -83,19 +83,17 @@ void PlaneTrackCommon::readCornersFromTrack(float corners[4][2], float frame)
|
|||
}
|
||||
}
|
||||
|
||||
void PlaneTrackCommon::determineResolution(unsigned int resolution[2],
|
||||
unsigned int /*preferredResolution*/[2])
|
||||
void PlaneTrackCommon::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
resolution[0] = 0;
|
||||
resolution[1] = 0;
|
||||
|
||||
r_area = COM_AREA_NONE;
|
||||
if (this->m_movieClip) {
|
||||
int width, height;
|
||||
MovieClipUser user = {0};
|
||||
BKE_movieclip_user_set_frame(&user, this->m_framenumber);
|
||||
BKE_movieclip_get_size(this->m_movieClip, &user, &width, &height);
|
||||
resolution[0] = width;
|
||||
resolution[1] = height;
|
||||
r_area = preferred_area;
|
||||
r_area.xmax = r_area.xmin + width;
|
||||
r_area.ymax = r_area.ymin + height;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ class PlaneTrackCommon {
|
|||
* implementation classes must make wrappers to use these methods, see below.
|
||||
*/
|
||||
void read_and_calculate_corners(PlaneDistortBaseOperation *distort_op);
|
||||
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area);
|
||||
|
||||
public:
|
||||
PlaneTrackCommon();
|
||||
|
@ -77,13 +77,13 @@ class PlaneTrackMaskOperation : public PlaneDistortMaskOperation, public PlaneTr
|
|||
|
||||
void initExecution() override;
|
||||
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override
|
||||
{
|
||||
PlaneTrackCommon::determineResolution(resolution, preferredResolution);
|
||||
PlaneTrackCommon::determine_canvas(preferred_area, r_area);
|
||||
|
||||
unsigned int temp[2];
|
||||
NodeOperation::determineResolution(temp, resolution);
|
||||
rcti unused;
|
||||
rcti &preferred = r_area;
|
||||
NodeOperation::determine_canvas(preferred, unused);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -98,12 +98,13 @@ class PlaneTrackWarpImageOperation : public PlaneDistortWarpImageOperation,
|
|||
|
||||
void initExecution() override;
|
||||
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override
|
||||
{
|
||||
PlaneTrackCommon::determineResolution(resolution, preferredResolution);
|
||||
unsigned int temp[2];
|
||||
NodeOperation::determineResolution(temp, resolution);
|
||||
PlaneTrackCommon::determine_canvas(preferred_area, r_area);
|
||||
|
||||
rcti unused;
|
||||
rcti &preferred = r_area;
|
||||
NodeOperation::determine_canvas(preferred, unused);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -130,14 +130,14 @@ bool PreviewOperation::determineDependingAreaOfInterest(rcti *input,
|
|||
|
||||
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
|
||||
}
|
||||
void PreviewOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int /*preferredResolution*/[2])
|
||||
void PreviewOperation::determine_canvas(const rcti &UNUSED(preferred_area), rcti &r_area)
|
||||
{
|
||||
/* Use default preview resolution as preferred ensuring it has size so that
|
||||
* generated inputs (which don't have resolution on their own) are displayed */
|
||||
BLI_assert(this->m_defaultWidth > 0 && this->m_defaultHeight > 0);
|
||||
unsigned int previewPreferredRes[2] = {this->m_defaultWidth, this->m_defaultHeight};
|
||||
NodeOperation::determineResolution(resolution, previewPreferredRes);
|
||||
rcti local_preferred;
|
||||
BLI_rcti_init(&local_preferred, 0, m_defaultWidth, 0, m_defaultHeight);
|
||||
NodeOperation::determine_canvas(local_preferred, r_area);
|
||||
|
||||
/* If resolution is 0 there are two possible scenarios:
|
||||
* - Either node is not connected at all
|
||||
|
@ -148,8 +148,8 @@ void PreviewOperation::determineResolution(unsigned int resolution[2],
|
|||
* The latter case would only happen if an input doesn't set any resolution ignoring output
|
||||
* preferred resolution. In such case preview size will be 0 too.
|
||||
*/
|
||||
int width = resolution[0];
|
||||
int height = resolution[1];
|
||||
int width = BLI_rcti_size_x(&r_area);
|
||||
int height = BLI_rcti_size_y(&r_area);
|
||||
this->m_divider = 0.0f;
|
||||
if (width > 0 && height > 0) {
|
||||
if (width > height) {
|
||||
|
@ -162,8 +162,7 @@ void PreviewOperation::determineResolution(unsigned int resolution[2],
|
|||
width = width * this->m_divider;
|
||||
height = height * this->m_divider;
|
||||
|
||||
resolution[0] = width;
|
||||
resolution[1] = height;
|
||||
BLI_rcti_init(&r_area, 0, width, 0, height);
|
||||
}
|
||||
|
||||
eCompositorPriority PreviewOperation::getRenderPriority() const
|
||||
|
|
|
@ -58,8 +58,7 @@ class PreviewOperation : public MultiThreadedOperation {
|
|||
eCompositorPriority getRenderPriority() const override;
|
||||
|
||||
void executeRegion(rcti *rect, unsigned int tileNumber) override;
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
bool determineDependingAreaOfInterest(rcti *input,
|
||||
ReadBufferOperation *readOperation,
|
||||
rcti *output) override;
|
||||
|
|
|
@ -137,7 +137,7 @@ void ProjectorLensDistortionOperation::get_area_of_interest(const int input_idx,
|
|||
{
|
||||
if (input_idx == 1) {
|
||||
/* Dispersion input is used as constant only. */
|
||||
r_input_area = COM_SINGLE_ELEM_AREA;
|
||||
r_input_area = COM_CONSTANT_INPUT_AREA_OF_INTEREST;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,16 +36,17 @@ void *ReadBufferOperation::initializeTileData(rcti * /*rect*/)
|
|||
return m_buffer;
|
||||
}
|
||||
|
||||
void ReadBufferOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2])
|
||||
void ReadBufferOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
if (this->m_memoryProxy != nullptr) {
|
||||
WriteBufferOperation *operation = this->m_memoryProxy->getWriteBufferOperation();
|
||||
operation->determineResolution(resolution, preferredResolution);
|
||||
operation->setResolution(resolution);
|
||||
operation->determine_canvas(preferred_area, r_area);
|
||||
operation->set_canvas(r_area);
|
||||
|
||||
/** \todo may not occur! But does with blur node. */
|
||||
if (this->m_memoryProxy->getExecutor()) {
|
||||
uint resolution[2] = {static_cast<uint>(BLI_rcti_size_x(&r_area)),
|
||||
static_cast<uint>(BLI_rcti_size_y(&r_area))};
|
||||
this->m_memoryProxy->getExecutor()->setResolution(resolution);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,8 +43,7 @@ class ReadBufferOperation : public NodeOperation {
|
|||
return this->m_memoryProxy;
|
||||
}
|
||||
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
|
||||
void *initializeTileData(rcti *rect) override;
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
|
|
@ -196,15 +196,13 @@ void RenderLayersProg::deinitExecution()
|
|||
}
|
||||
}
|
||||
|
||||
void RenderLayersProg::determineResolution(unsigned int resolution[2],
|
||||
unsigned int /*preferredResolution*/[2])
|
||||
void RenderLayersProg::determine_canvas(const rcti &UNUSED(preferred_area), rcti &r_area)
|
||||
{
|
||||
Scene *sce = this->getScene();
|
||||
Render *re = (sce) ? RE_GetSceneRender(sce) : nullptr;
|
||||
RenderResult *rr = nullptr;
|
||||
|
||||
resolution[0] = 0;
|
||||
resolution[1] = 0;
|
||||
r_area = COM_AREA_NONE;
|
||||
|
||||
if (re) {
|
||||
rr = RE_AcquireResultRead(re);
|
||||
|
@ -215,8 +213,7 @@ void RenderLayersProg::determineResolution(unsigned int resolution[2],
|
|||
if (view_layer) {
|
||||
RenderLayer *rl = RE_GetRenderLayer(rr, view_layer->name);
|
||||
if (rl) {
|
||||
resolution[0] = rl->rectx;
|
||||
resolution[1] = rl->recty;
|
||||
BLI_rcti_init(&r_area, 0, rl->rectx, 0, rl->recty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,8 +73,7 @@ class RenderLayersProg : public MultiThreadedOperation {
|
|||
/**
|
||||
* Determine the output resolution. The resolution is retrieved from the Renderer
|
||||
*/
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
|
||||
/**
|
||||
* retrieve the reference to the float buffer of the renderer.
|
||||
|
|
|
@ -28,7 +28,7 @@ RotateOperation::RotateOperation()
|
|||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->set_canvas_input_index(0);
|
||||
this->m_imageSocket = nullptr;
|
||||
this->m_degreeSocket = nullptr;
|
||||
this->m_doDegree2RadConversion = false;
|
||||
|
@ -164,8 +164,7 @@ void RotateOperation::get_area_of_interest(const int input_idx,
|
|||
rcti &r_input_area)
|
||||
{
|
||||
if (input_idx == DEGREE_INPUT_INDEX) {
|
||||
/* Degrees input is always used as constant. */
|
||||
r_input_area = COM_SINGLE_ELEM_AREA;
|
||||
r_input_area = COM_CONSTANT_INPUT_AREA_OF_INTEREST;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ ScaleOperation::ScaleOperation(DataType data_type) : BaseScaleOperation()
|
|||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(data_type);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->set_canvas_input_index(0);
|
||||
this->m_inputOperation = nullptr;
|
||||
this->m_inputXOperation = nullptr;
|
||||
this->m_inputYOperation = nullptr;
|
||||
|
@ -267,7 +267,7 @@ ScaleFixedSizeOperation::ScaleFixedSizeOperation() : BaseScaleOperation()
|
|||
{
|
||||
this->addInputSocket(DataType::Color, ResizeMode::None);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->set_canvas_input_index(0);
|
||||
this->m_inputOperation = nullptr;
|
||||
this->m_is_offset = false;
|
||||
}
|
||||
|
@ -366,15 +366,14 @@ bool ScaleFixedSizeOperation::determineDependingAreaOfInterest(rcti *input,
|
|||
return BaseScaleOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
|
||||
}
|
||||
|
||||
void ScaleFixedSizeOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int /*preferredResolution*/[2])
|
||||
void ScaleFixedSizeOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
unsigned int nr[2];
|
||||
nr[0] = this->m_newWidth;
|
||||
nr[1] = this->m_newHeight;
|
||||
BaseScaleOperation::determineResolution(resolution, nr);
|
||||
resolution[0] = this->m_newWidth;
|
||||
resolution[1] = this->m_newHeight;
|
||||
rcti local_preferred = preferred_area;
|
||||
local_preferred.xmax = local_preferred.xmin + m_newWidth;
|
||||
local_preferred.ymax = local_preferred.ymin + m_newHeight;
|
||||
BaseScaleOperation::determine_canvas(local_preferred, r_area);
|
||||
r_area.xmax = r_area.xmin + m_newWidth;
|
||||
r_area.ymax = r_area.ymin + m_newHeight;
|
||||
}
|
||||
|
||||
void ScaleFixedSizeOperation::get_area_of_interest(const int input_idx,
|
||||
|
|
|
@ -141,8 +141,7 @@ class ScaleFixedSizeOperation : public BaseScaleOperation {
|
|||
bool determineDependingAreaOfInterest(rcti *input,
|
||||
ReadBufferOperation *readOperation,
|
||||
rcti *output) override;
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
void init_data() override;
|
||||
|
|
|
@ -388,7 +388,7 @@ void ScreenLensDistortionOperation::get_area_of_interest(const int input_idx,
|
|||
{
|
||||
if (input_idx != 0) {
|
||||
/* Dispersion and distortion inputs are used as constants only. */
|
||||
r_input_area = COM_SINGLE_ELEM_AREA;
|
||||
r_input_area = COM_CONSTANT_INPUT_AREA_OF_INTEREST;
|
||||
}
|
||||
|
||||
/* XXX the original method of estimating the area-of-interest does not work
|
||||
|
@ -398,10 +398,7 @@ void ScreenLensDistortionOperation::get_area_of_interest(const int input_idx,
|
|||
*/
|
||||
#if 1
|
||||
NodeOperation *image = getInputOperation(0);
|
||||
r_input_area.xmax = image->getWidth();
|
||||
r_input_area.xmin = 0;
|
||||
r_input_area.ymax = image->getHeight();
|
||||
r_input_area.ymin = 0;
|
||||
r_input_area = image->get_canvas();
|
||||
|
||||
#else /* Original method in tiled implementation. */
|
||||
rcti newInput;
|
||||
|
|
|
@ -34,11 +34,9 @@ void SetColorOperation::executePixelSampled(float output[4],
|
|||
copy_v4_v4(output, this->m_color);
|
||||
}
|
||||
|
||||
void SetColorOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2])
|
||||
void SetColorOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
resolution[0] = preferredResolution[0];
|
||||
resolution[1] = preferredResolution[1];
|
||||
r_area = preferred_area;
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
|
|
@ -83,8 +83,7 @@ class SetColorOperation : public ConstantOperation {
|
|||
*/
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
|
|
@ -34,11 +34,9 @@ void SetValueOperation::executePixelSampled(float output[4],
|
|||
output[0] = this->m_value;
|
||||
}
|
||||
|
||||
void SetValueOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2])
|
||||
void SetValueOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
resolution[0] = preferredResolution[0];
|
||||
resolution[1] = preferredResolution[1];
|
||||
r_area = preferred_area;
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
|
|
@ -54,8 +54,8 @@ class SetValueOperation : public ConstantOperation {
|
|||
* The inner loop of this operation.
|
||||
*/
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
|
|
@ -37,11 +37,9 @@ void SetVectorOperation::executePixelSampled(float output[4],
|
|||
output[2] = vector_.z;
|
||||
}
|
||||
|
||||
void SetVectorOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2])
|
||||
void SetVectorOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
resolution[0] = preferredResolution[0];
|
||||
resolution[1] = preferredResolution[1];
|
||||
r_area = preferred_area;
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
|
|
@ -84,8 +84,7 @@ class SetVectorOperation : public ConstantOperation {
|
|||
*/
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
|
||||
void setVector(const float vector[3])
|
||||
{
|
||||
|
|
|
@ -67,16 +67,14 @@ void SplitOperation::executePixelSampled(float output[4],
|
|||
}
|
||||
}
|
||||
|
||||
void SplitOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2])
|
||||
void SplitOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
unsigned int tempPreferredResolution[2] = {0, 0};
|
||||
unsigned int tempResolution[2];
|
||||
rcti unused_area;
|
||||
|
||||
this->getInputSocket(0)->determineResolution(tempResolution, tempPreferredResolution);
|
||||
this->setResolutionInputSocketIndex((tempResolution[0] && tempResolution[1]) ? 0 : 1);
|
||||
const bool determined = this->getInputSocket(0)->determine_canvas(COM_AREA_NONE, unused_area);
|
||||
this->set_canvas_input_index(determined ? 0 : 1);
|
||||
|
||||
NodeOperation::determineResolution(resolution, preferredResolution);
|
||||
NodeOperation::determine_canvas(preferred_area, r_area);
|
||||
}
|
||||
|
||||
void SplitOperation::update_memory_buffer_partial(MemoryBuffer *output,
|
||||
|
|
|
@ -35,8 +35,7 @@ class SplitOperation : public MultiThreadedOperation {
|
|||
void initExecution() override;
|
||||
void deinitExecution() override;
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
void setSplitPercentage(float splitPercentage)
|
||||
{
|
||||
this->m_splitPercentage = splitPercentage;
|
||||
|
|
|
@ -25,7 +25,7 @@ SunBeamsOperation::SunBeamsOperation()
|
|||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->set_canvas_input_index(0);
|
||||
|
||||
this->flags.complex = true;
|
||||
}
|
||||
|
|
|
@ -72,32 +72,26 @@ void TextureBaseOperation::deinitExecution()
|
|||
NodeOperation::deinitExecution();
|
||||
}
|
||||
|
||||
void TextureBaseOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2])
|
||||
void TextureBaseOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
switch (execution_model_) {
|
||||
case eExecutionModel::Tiled: {
|
||||
if (preferredResolution[0] == 0 || preferredResolution[1] == 0) {
|
||||
r_area = preferred_area;
|
||||
if (BLI_rcti_is_empty(&preferred_area)) {
|
||||
int width = this->m_rd->xsch * this->m_rd->size / 100;
|
||||
int height = this->m_rd->ysch * this->m_rd->size / 100;
|
||||
resolution[0] = width;
|
||||
resolution[1] = height;
|
||||
}
|
||||
else {
|
||||
resolution[0] = preferredResolution[0];
|
||||
resolution[1] = preferredResolution[1];
|
||||
r_area.xmax = preferred_area.xmin + width;
|
||||
r_area.ymax = preferred_area.ymin + height;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case eExecutionModel::FullFrame: {
|
||||
/* Determine inputs resolutions. */
|
||||
unsigned int temp[2];
|
||||
NodeOperation::determineResolution(temp, preferredResolution);
|
||||
/* Determine inputs. */
|
||||
rcti temp;
|
||||
NodeOperation::determine_canvas(preferred_area, temp);
|
||||
|
||||
/* We don't use inputs resolutions because they are only used as parameters, not image data.
|
||||
*/
|
||||
resolution[0] = preferredResolution[0];
|
||||
resolution[1] = preferredResolution[1];
|
||||
/* Don't use input areas, they are only used as parameters. */
|
||||
r_area = preferred_area;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,8 +46,7 @@ class TextureBaseOperation : public MultiThreadedOperation {
|
|||
/**
|
||||
* Determine the output resolution.
|
||||
*/
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
|
|
@ -160,11 +160,7 @@ void TonemapOperation::get_area_of_interest(const int input_idx,
|
|||
rcti &r_input_area)
|
||||
{
|
||||
BLI_assert(input_idx == 0);
|
||||
NodeOperation *operation = getInputOperation(input_idx);
|
||||
r_input_area.xmin = 0;
|
||||
r_input_area.ymin = 0;
|
||||
r_input_area.xmax = operation->getWidth();
|
||||
r_input_area.ymax = operation->getHeight();
|
||||
r_input_area = get_input_operation(input_idx)->get_canvas();
|
||||
}
|
||||
|
||||
struct Luminance {
|
||||
|
|
|
@ -157,11 +157,9 @@ const float *TrackPositionOperation::get_constant_elem()
|
|||
return &track_position_;
|
||||
}
|
||||
|
||||
void TrackPositionOperation::determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2])
|
||||
void TrackPositionOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
|
||||
{
|
||||
resolution[0] = preferredResolution[0];
|
||||
resolution[1] = preferredResolution[1];
|
||||
r_area = preferred_area;
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
|
|
@ -53,8 +53,7 @@ class TrackPositionOperation : public ConstantOperation {
|
|||
/**
|
||||
* Determine the output resolution. The resolution is retrieved from the Renderer
|
||||
*/
|
||||
void determineResolution(unsigned int resolution[2],
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
|
||||
|
||||
public:
|
||||
TrackPositionOperation();
|
||||
|
|
|
@ -99,7 +99,7 @@ void TransformOperation::get_area_of_interest(const int input_idx,
|
|||
case X_INPUT_INDEX:
|
||||
case Y_INPUT_INDEX:
|
||||
case DEGREE_INPUT_INDEX: {
|
||||
r_input_area = COM_SINGLE_ELEM_AREA;
|
||||
r_input_area = COM_CONSTANT_INPUT_AREA_OF_INTEREST;
|
||||
break;
|
||||
}
|
||||
case SCALE_INPUT_INDEX: {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue