diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2019-05-23 11:28:24 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2019-05-23 11:29:49 +0300 |
commit | 8022bd705908a0e0bfd615a4e64d5140f326a8d1 (patch) | |
tree | 5c260556431acfca4fdccb86d70ad1c1033d015b /doc/python_api/examples/bpy.types.Depsgraph.3.py | |
parent | 58c4b10a708fbc24bca105dbf26dd991154c91ad (diff) |
Depsgraph examples: don't assign to names of built-in Python objects
`object` is the superclass of all objects. Old-style code could still be
using `class SomeClass(object)` and assigning something else to `object`
could have unexpected results.
This is now also documented in the
[Python style guide](https://wiki.blender.org/wiki/Style_Guide/Python)
on the wiki.
Differential Revision: https://developer.blender.org/D4922
Reviewed by: sergey
Diffstat (limited to 'doc/python_api/examples/bpy.types.Depsgraph.3.py')
-rw-r--r-- | doc/python_api/examples/bpy.types.Depsgraph.3.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/doc/python_api/examples/bpy.types.Depsgraph.3.py b/doc/python_api/examples/bpy.types.Depsgraph.3.py index 25411597dd3..dc542c1b2f4 100644 --- a/doc/python_api/examples/bpy.types.Depsgraph.3.py +++ b/doc/python_api/examples/bpy.types.Depsgraph.3.py @@ -18,15 +18,15 @@ class OBJECT_OT_object_instances(bpy.types.Operator): depsgraph = context.evaluated_depsgraph_get() for object_instance in depsgraph.object_instances: # This is an object which is being instanced. - object = object_instance.object + obj = object_instance.object # `is_instance` denotes whether the object is coming from instances (as an opposite of # being an emitting object. ) if not object_instance.is_instance: - print(f"Object {object.name} at {object_instance.matrix_world}") + print(f"Object {obj.name} at {object_instance.matrix_world}") else: # Instanced will additionally have fields like uv, random_id and others which are # specific for instances. See Python API for DepsgraphObjectInstance for details, - print(f"Instance of {object.name} at {object_instance.matrix_world}") + print(f"Instance of {obj.name} at {object_instance.matrix_world}") return {'FINISHED'} |