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:
authorSybren A. Stüvel <sybren@stuvel.eu>2019-05-23 11:28:24 +0300
committerSybren A. Stüvel <sybren@stuvel.eu>2019-05-23 11:29:49 +0300
commit8022bd705908a0e0bfd615a4e64d5140f326a8d1 (patch)
tree5c260556431acfca4fdccb86d70ad1c1033d015b /doc/python_api/examples/bpy.types.Depsgraph.4.py
parent58c4b10a708fbc24bca105dbf26dd991154c91ad (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.4.py')
-rw-r--r--doc/python_api/examples/bpy.types.Depsgraph.4.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/doc/python_api/examples/bpy.types.Depsgraph.4.py b/doc/python_api/examples/bpy.types.Depsgraph.4.py
index c2017afa2f9..468f9610ca2 100644
--- a/doc/python_api/examples/bpy.types.Depsgraph.4.py
+++ b/doc/python_api/examples/bpy.types.Depsgraph.4.py
@@ -34,22 +34,22 @@ class OBJECT_OT_object_to_mesh(bpy.types.Operator):
def execute(self, context):
# Access input original object.
- object = context.object
- if object is None:
+ obj = context.object
+ if obj is None:
self.report({'INFO'}, "No active mesh object to convert to mesh")
return {'CANCELLED'}
# Avoid annoying None checks later on.
- if object.type not in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META'}:
+ if obj.type not in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META'}:
self.report({'INFO'}, "Object can not be converted to mesh")
return {'CANCELLED'}
depsgraph = context.evaluated_depsgraph_get()
# Invoke to_mesh() for original object.
- mesh_from_orig = object.to_mesh()
+ mesh_from_orig = obj.to_mesh()
self.report({'INFO'}, f"{len(mesh_from_orig.vertices)} in new mesh without modifiers.")
# Remove temporary mesh.
- object.to_mesh_clear()
+ obj.to_mesh_clear()
# Invoke to_mesh() for evaluated object.
- object_eval = object.evaluated_get(depsgraph)
+ object_eval = obj.evaluated_get(depsgraph)
mesh_from_eval = object_eval.to_mesh()
self.report({'INFO'}, f"{len(mesh_from_eval.vertices)} in new mesh with modifiers.")
# Remove temporary mesh.