[Bf-blender-cvs] [7c227e47404] blender2.8: Py API Docs: Warnings for some properties that are slower to access than expected.
Jacques Lucke
noreply at git.blender.org
Fri Nov 9 12:07:16 CET 2018
Commit: 7c227e4740457dc02afdff733e13c97d983f3aae
Author: Jacques Lucke
Date: Fri Nov 9 12:06:29 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB7c227e4740457dc02afdff733e13c97d983f3aae
Py API Docs: Warnings for some properties that are slower to access than expected.
===================================================================
M release/scripts/modules/bpy_types.py
===================================================================
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index 0ef1f4504e1..dda1ab7b4ed 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -112,21 +112,21 @@ class Object(bpy_types.ID):
@property
def children(self):
- """All the children of this object"""
+ """All the children of this object. Warning: takes O(len(bpy.data.objects)) time."""
import bpy
return tuple(child for child in bpy.data.objects
if child.parent == self)
@property
def users_collection(self):
- """The collections this object is in"""
+ """The collections this object is in. Warning: takes O(len(bpy.data.collections)) time."""
import bpy
return tuple(collection for collection in bpy.data.collections
if self in collection.objects[:])
@property
def users_scene(self):
- """The scenes this object is in"""
+ """The scenes this object is in. Warning: takes O(len(bpy.data.scenes) * len(bpy.data.objects)) time."""
import bpy
return tuple(scene for scene in bpy.data.scenes
if self in scene.objects[:])
@@ -268,12 +268,12 @@ class _GenericBone:
@property
def children(self):
- """A list of all the bones children."""
+ """A list of all the bones children. Warning: takes O(len(bones)) time."""
return [child for child in self._other_bones if child.parent == self]
@property
def children_recursive(self):
- """A list of all children from this bone."""
+ """A list of all children from this bone. Warning: takes O(len(bones)**2) time."""
bones_children = []
for bone in self._other_bones:
index = bone.parent_index(self)
@@ -290,7 +290,7 @@ class _GenericBone:
Returns a chain of children with the same base name as this bone.
Only direct chains are supported, forks caused by multiple children
with matching base names will terminate the function
- and not be returned.
+ and not be returned. Warning: takes O(len(bones)**2) time.
"""
basename = self.basename
chain = []
@@ -946,7 +946,7 @@ class NodeSocket(StructRNA, metaclass=RNAMetaPropGroup):
@property
def links(self):
- """List of node links from or to this socket"""
+ """List of node links from or to this socket. Warning: takes O(len(nodetree.links)) time."""
return tuple(link for link in self.id_data.links
if (link.from_socket == self or
link.to_socket == self))
More information about the Bf-blender-cvs
mailing list