Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/compositor/intern/COM_NodeOperation.cc')
-rw-r--r--source/blender/compositor/intern/COM_NodeOperation.cc83
1 files changed, 26 insertions, 57 deletions
diff --git a/source/blender/compositor/intern/COM_NodeOperation.cc b/source/blender/compositor/intern/COM_NodeOperation.cc
index 0cc642479ac..297ef100a1b 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.cc
+++ b/source/blender/compositor/intern/COM_NodeOperation.cc
@@ -24,6 +24,8 @@
#include "COM_NodeOperation.h" /* own include */
+namespace blender::compositor {
+
/*******************
**** NodeOperation ****
*******************/
@@ -31,76 +33,52 @@
NodeOperation::NodeOperation()
{
this->m_resolutionInputSocketIndex = 0;
- this->m_complex = false;
this->m_width = 0;
this->m_height = 0;
- this->m_isResolutionSet = false;
- this->m_openCL = false;
this->m_btree = nullptr;
}
-NodeOperation::~NodeOperation()
-{
- while (!this->m_outputs.empty()) {
- delete (this->m_outputs.back());
- this->m_outputs.pop_back();
- }
- while (!this->m_inputs.empty()) {
- delete (this->m_inputs.back());
- this->m_inputs.pop_back();
- }
-}
-
-NodeOperationOutput *NodeOperation::getOutputSocket(unsigned int index) const
+NodeOperationOutput *NodeOperation::getOutputSocket(unsigned int index)
{
- BLI_assert(index < m_outputs.size());
- return m_outputs[index];
+ return &m_outputs[index];
}
-NodeOperationInput *NodeOperation::getInputSocket(unsigned int index) const
+NodeOperationInput *NodeOperation::getInputSocket(unsigned int index)
{
- BLI_assert(index < m_inputs.size());
- return m_inputs[index];
+ return &m_inputs[index];
}
-void NodeOperation::addInputSocket(DataType datatype, InputResizeMode resize_mode)
+void NodeOperation::addInputSocket(DataType datatype, ResizeMode resize_mode)
{
- NodeOperationInput *socket = new NodeOperationInput(this, datatype, resize_mode);
- m_inputs.push_back(socket);
+ m_inputs.append(NodeOperationInput(this, datatype, resize_mode));
}
void NodeOperation::addOutputSocket(DataType datatype)
{
- NodeOperationOutput *socket = new NodeOperationOutput(this, datatype);
- m_outputs.push_back(socket);
+ m_outputs.append(NodeOperationOutput(this, datatype));
}
void NodeOperation::determineResolution(unsigned int resolution[2],
unsigned int preferredResolution[2])
{
- unsigned int temp[2];
- unsigned int temp2[2];
+ if (m_resolutionInputSocketIndex < m_inputs.size()) {
+ NodeOperationInput &input = m_inputs[m_resolutionInputSocketIndex];
+ input.determineResolution(resolution, preferredResolution);
+ }
+ unsigned int temp2[2] = {resolution[0], resolution[1]};
+ unsigned int temp[2];
for (unsigned int index = 0; index < m_inputs.size(); index++) {
- NodeOperationInput *input = m_inputs[index];
- if (input->isConnected()) {
- if (index == this->m_resolutionInputSocketIndex) {
- input->determineResolution(resolution, preferredResolution);
- temp2[0] = resolution[0];
- temp2[1] = resolution[1];
- break;
- }
+ if (index == this->m_resolutionInputSocketIndex) {
+ continue;
}
- }
- for (unsigned int index = 0; index < m_inputs.size(); index++) {
- NodeOperationInput *input = m_inputs[index];
- if (input->isConnected()) {
- if (index != this->m_resolutionInputSocketIndex) {
- input->determineResolution(temp, temp2);
- }
+ NodeOperationInput &input = m_inputs[index];
+ if (input.isConnected()) {
+ input.determineResolution(temp, temp2);
}
}
}
+
void NodeOperation::setResolutionInputSocketIndex(unsigned int index)
{
this->m_resolutionInputSocketIndex = index;
@@ -149,20 +127,11 @@ NodeOperation *NodeOperation::getInputOperation(unsigned int inputSocketIndex)
return nullptr;
}
-void NodeOperation::getConnectedInputSockets(Inputs *sockets)
-{
- for (NodeOperationInput *input : m_inputs) {
- if (input->isConnected()) {
- sockets->push_back(input);
- }
- }
-}
-
bool NodeOperation::determineDependingAreaOfInterest(rcti *input,
ReadBufferOperation *readOperation,
rcti *output)
{
- if (isInputOperation()) {
+ if (m_inputs.size() == 0) {
BLI_rcti_init(output, input->xmin, input->xmax, input->ymin, input->ymax);
return false;
}
@@ -195,9 +164,7 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti *input,
**** OpInput ****
*****************/
-NodeOperationInput::NodeOperationInput(NodeOperation *op,
- DataType datatype,
- InputResizeMode resizeMode)
+NodeOperationInput::NodeOperationInput(NodeOperation *op, DataType datatype, ResizeMode resizeMode)
: m_operation(op), m_datatype(datatype), m_resizeMode(resizeMode), m_link(nullptr)
{
}
@@ -232,7 +199,7 @@ void NodeOperationOutput::determineResolution(unsigned int resolution[2],
unsigned int preferredResolution[2])
{
NodeOperation &operation = getOperation();
- if (operation.isResolutionSet()) {
+ if (operation.get_flags().is_resolution_set) {
resolution[0] = operation.getWidth();
resolution[1] = operation.getHeight();
}
@@ -241,3 +208,5 @@ void NodeOperationOutput::determineResolution(unsigned int resolution[2],
operation.setResolution(resolution);
}
}
+
+} // namespace blender::compositor