[Bf-blender-cvs] [cbeb6623dbe] cycles-x: Cleanup: De-duplicate pass find logic

Sergey Sharybin noreply at git.blender.org
Thu Jun 10 20:01:32 CEST 2021


Commit: cbeb6623dbec925cdf00bf2b235c49d639cd5ac5
Author: Sergey Sharybin
Date:   Thu Jun 10 19:57:30 2021 +0200
Branches: cycles-x
https://developer.blender.org/rBcbeb6623dbec925cdf00bf2b235c49d639cd5ac5

Cleanup: De-duplicate pass find logic

The code of `Pass::contains()` and `Pass::find()` was almost identical.

===================================================================

M	intern/cycles/render/pass.cpp

===================================================================

diff --git a/intern/cycles/render/pass.cpp b/intern/cycles/render/pass.cpp
index 1a0416479db..1930ab84a63 100644
--- a/intern/cycles/render/pass.cpp
+++ b/intern/cycles/render/pass.cpp
@@ -454,11 +454,7 @@ bool Pass::equals_exact(const vector<Pass> &A, const vector<Pass> &B)
 
 bool Pass::contains(const vector<Pass> &passes, PassType type)
 {
-  for (size_t i = 0; i < passes.size(); i++)
-    if (passes[i].type == type)
-      return true;
-
-  return false;
+  return find(passes, type) != nullptr;
 }
 
 void Pass::remove_all_auto(vector<Pass> &passes)



More information about the Bf-blender-cvs mailing list