[Bf-blender-cvs] [c696a290587] functions-experimental-refactor: list lengths
Jacques Lucke
noreply at git.blender.org
Tue Oct 15 15:56:56 CEST 2019
Commit: c696a290587a20fc3099c6d8e703a7d208965fa0
Author: Jacques Lucke
Date: Thu Oct 10 21:26:21 2019 +0200
Branches: functions-experimental-refactor
https://developer.blender.org/rBc696a290587a20fc3099c6d8e703a7d208965fa0
list lengths
===================================================================
M source/blender/blenkernel/intern/node_functions.cc
===================================================================
diff --git a/source/blender/blenkernel/intern/node_functions.cc b/source/blender/blenkernel/intern/node_functions.cc
index 413ea6656b9..a74f30e58e5 100644
--- a/source/blender/blenkernel/intern/node_functions.cc
+++ b/source/blender/blenkernel/intern/node_functions.cc
@@ -201,4 +201,26 @@ class MultiFunction_GetListElement : public MultiFunction {
}
};
+class MultiFunction_ListLength : public MultiFunction {
+ private:
+ CPPType &m_base_type;
+
+ public:
+ void signature(Signature &signature) const override
+ {
+ signature.readonly_vector_input("List", m_base_type);
+ signature.single_output<int>("Length");
+ }
+
+ void call(ArrayRef<uint> mask_indices, Params ¶ms) const override
+ {
+ GenericVectorArrayOrSingleRef lists = params.readonly_vector_input(0, "List");
+ MutableArrayRef<int> lengths = params.single_output<int>(1, "Length");
+
+ for (uint i : mask_indices) {
+ lengths[i] = lists[i].size();
+ }
+ }
+};
+
} // namespace BKE
\ No newline at end of file
More information about the Bf-blender-cvs
mailing list