diff options
author | Manuel Castilla <manzanillawork@gmail.com> | 2021-08-10 16:24:28 +0300 |
---|---|---|
committer | Manuel Castilla <manzanillawork@gmail.com> | 2021-08-10 17:16:22 +0300 |
commit | 1a9b9dd64df72401df0263ca1e30306e5c675c6d (patch) | |
tree | afee896e361947157cf2e3537ccce5895f5d1c7d /source/blender/compositor/operations/COM_ConstantOperation.cc | |
parent | 5deb3229a0757e2637163c60d7915888cc50c9d8 (diff) |
Compositor: Full frame input nodes
Adds full frame implementation to "Bokeh Image" node, "Track Position"
node, `SetVectorOperation` and `MovieClipAttribute`.
The other nodes in "Input" submenu are implemented separately.
`MovieClipAttribute` needs resolution to calculate its constant value, it can't be constant folded,
which requires it to be a `ConstantOperation`. Now `ConstantOperation` contemplate this case
and any operation that is always constant without depending on inputs should implement it.
If in the future an operation needs to get an input constant element during
`determineResolution` it must first determine its input resolution.
The nodes have no functional changes.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D12090
Diffstat (limited to 'source/blender/compositor/operations/COM_ConstantOperation.cc')
-rw-r--r-- | source/blender/compositor/operations/COM_ConstantOperation.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_ConstantOperation.cc b/source/blender/compositor/operations/COM_ConstantOperation.cc index f905edbde76..33d51cca432 100644 --- a/source/blender/compositor/operations/COM_ConstantOperation.cc +++ b/source/blender/compositor/operations/COM_ConstantOperation.cc @@ -22,7 +22,24 @@ namespace blender::compositor { ConstantOperation::ConstantOperation() { + needs_resolution_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; +} + +void ConstantOperation::update_memory_buffer(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> UNUSED(inputs)) +{ + BLI_assert(output->is_a_single_elem()); + const float *constant = get_constant_elem(); + float *out = output->get_elem(area.xmin, area.ymin); + memcpy(out, constant, output->get_elem_bytes_len()); } } // namespace blender::compositor |