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 'doc/python_api/examples/bpy.types.bpy_prop_collection.foreach_set.py')
-rw-r--r--doc/python_api/examples/bpy.types.bpy_prop_collection.foreach_set.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/python_api/examples/bpy.types.bpy_prop_collection.foreach_set.py b/doc/python_api/examples/bpy.types.bpy_prop_collection.foreach_set.py
new file mode 100644
index 00000000000..06ed4840b24
--- /dev/null
+++ b/doc/python_api/examples/bpy.types.bpy_prop_collection.foreach_set.py
@@ -0,0 +1,11 @@
+"""
+Only works for 'basic type' properties (bool, int and float)!
+seq must be uni-dimensional, multi-dimensional arrays (like array of vectors) will be re-created from it.
+"""
+
+collection.foreach_set(attr, some_seq)
+
+# Python equivalent
+for i in range(len(some_seq)):
+ setattr(collection[i], attr, some_seq[i])
+