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:
authorJeroen Bakker <jeroen@blender.org>2021-03-30 13:27:53 +0300
committerJeroen Bakker <jeroen@blender.org>2021-03-30 17:03:43 +0300
commit04a92297ddfb86b1766733461f01104bcbd5b38e (patch)
treede724e43767f0bd01b51517c9a4684a2b9c5271c /source/blender/compositor/operations
parentd4e76712d4fdf55815cf59df52ffa35df84ed09a (diff)
Cleanup: Replace std::vector with blender::Vector.
Diffstat (limited to 'source/blender/compositor/operations')
-rw-r--r--source/blender/compositor/operations/COM_CryptomatteOperation.cc10
-rw-r--r--source/blender/compositor/operations/COM_CryptomatteOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_OutputFileOperation.cc11
-rw-r--r--source/blender/compositor/operations/COM_OutputFileOperation.h4
4 files changed, 13 insertions, 16 deletions
diff --git a/source/blender/compositor/operations/COM_CryptomatteOperation.cc b/source/blender/compositor/operations/COM_CryptomatteOperation.cc
index 63bbca66296..52ae1d6d5b5 100644
--- a/source/blender/compositor/operations/COM_CryptomatteOperation.cc
+++ b/source/blender/compositor/operations/COM_CryptomatteOperation.cc
@@ -22,10 +22,10 @@ namespace blender::compositor {
CryptomatteOperation::CryptomatteOperation(size_t num_inputs)
{
+ inputs.resize(num_inputs);
for (size_t i = 0; i < num_inputs; i++) {
this->addInputSocket(DataType::Color);
}
- inputs.resize(num_inputs);
this->addOutputSocket(DataType::Color);
this->flags.complex = true;
}
@@ -40,7 +40,7 @@ void CryptomatteOperation::initExecution()
void CryptomatteOperation::addObjectIndex(float objectIndex)
{
if (objectIndex != 0.0f) {
- m_objectIndex.push_back(objectIndex);
+ m_objectIndex.append(objectIndex);
}
}
@@ -60,11 +60,11 @@ void CryptomatteOperation::executePixel(float output[4], int x, int y, void *dat
output[1] = ((float)((m3hash << 8)) / (float)UINT32_MAX);
output[2] = ((float)((m3hash << 16)) / (float)UINT32_MAX);
}
- for (size_t i = 0; i < m_objectIndex.size(); i++) {
- if (m_objectIndex[i] == input[0]) {
+ for (float hash : m_objectIndex) {
+ if (input[0] == hash) {
output[3] += input[1];
}
- if (m_objectIndex[i] == input[2]) {
+ if (input[2] == hash) {
output[3] += input[3];
}
}
diff --git a/source/blender/compositor/operations/COM_CryptomatteOperation.h b/source/blender/compositor/operations/COM_CryptomatteOperation.h
index 176a1184491..40a1fbf5a80 100644
--- a/source/blender/compositor/operations/COM_CryptomatteOperation.h
+++ b/source/blender/compositor/operations/COM_CryptomatteOperation.h
@@ -24,10 +24,10 @@ namespace blender::compositor {
class CryptomatteOperation : public NodeOperation {
private:
- std::vector<float> m_objectIndex;
+ blender::Vector<float> m_objectIndex;
public:
- std::vector<SocketReader *> inputs;
+ blender::Vector<SocketReader *> inputs;
CryptomatteOperation(size_t num_inputs = 6);
diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cc b/source/blender/compositor/operations/COM_OutputFileOperation.cc
index cb9c2e4a16b..5184cd42b9e 100644
--- a/source/blender/compositor/operations/COM_OutputFileOperation.cc
+++ b/source/blender/compositor/operations/COM_OutputFileOperation.cc
@@ -330,7 +330,7 @@ void OutputOpenExrMultiLayerOperation::add_layer(const char *name,
bool use_layer)
{
this->addInputSocket(datatype);
- this->m_layers.push_back(OutputOpenExrLayer(name, datatype, use_layer));
+ this->m_layers.append(OutputOpenExrLayer(name, datatype, use_layer));
}
StampData *OutputOpenExrMultiLayerOperation::createStampData() const
@@ -340,17 +340,16 @@ StampData *OutputOpenExrMultiLayerOperation::createStampData() const
RenderResult render_result;
StampData *stamp_data = BKE_stamp_info_from_scene_static(m_scene);
render_result.stamp_data = stamp_data;
- for (int i = 0; i < this->m_layers.size(); i++) {
- const OutputOpenExrLayer *layer = &this->m_layers[i];
+ for (const OutputOpenExrLayer &layer : m_layers) {
/* Skip unconnected sockets. */
- if (layer->imageInput == nullptr) {
+ if (layer.imageInput == nullptr) {
continue;
}
- std::unique_ptr<MetaData> meta_data = layer->imageInput->getMetaData();
+ std::unique_ptr<MetaData> meta_data = layer.imageInput->getMetaData();
if (meta_data) {
blender::StringRef layer_name =
blender::bke::cryptomatte::BKE_cryptomatte_extract_layer_name(
- blender::StringRef(layer->name, BLI_strnlen(layer->name, sizeof(layer->name))));
+ blender::StringRef(layer.name, BLI_strnlen(layer.name, sizeof(layer.name))));
meta_data->replaceHashNeutralCryptomatteKeys(layer_name);
meta_data->addToRenderResult(&render_result);
}
diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.h b/source/blender/compositor/operations/COM_OutputFileOperation.h
index 81277ab1ef3..6415891032a 100644
--- a/source/blender/compositor/operations/COM_OutputFileOperation.h
+++ b/source/blender/compositor/operations/COM_OutputFileOperation.h
@@ -88,8 +88,6 @@ struct OutputOpenExrLayer {
/* Writes inputs into OpenEXR multilayer channels. */
class OutputOpenExrMultiLayerOperation : public NodeOperation {
protected:
- typedef std::vector<OutputOpenExrLayer> LayerList;
-
const Scene *m_scene;
const RenderData *m_rd;
const bNodeTree *m_tree;
@@ -97,7 +95,7 @@ class OutputOpenExrMultiLayerOperation : public NodeOperation {
char m_path[FILE_MAX];
char m_exr_codec;
bool m_exr_half_float;
- LayerList m_layers;
+ blender::Vector<OutputOpenExrLayer> m_layers;
const char *m_viewName;
StampData *createStampData() const;