From a04d0b932f36df690cc0cf28c8d214ad1a0cd896 Mon Sep 17 00:00:00 2001 From: Matthew Hinson Date: Wed, 12 Jun 2024 17:21:52 +0200 Subject: [PATCH] Fix: Broken Dependency Graph Python API example Fix blender/blender-manual#104712 Pull Request: https://projects.blender.org/blender/blender/pulls/122563 --- doc/python_api/examples/bpy.types.Depsgraph.6.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/python_api/examples/bpy.types.Depsgraph.6.py b/doc/python_api/examples/bpy.types.Depsgraph.6.py index 1f809356b13..7d46fe8b5bd 100644 --- a/doc/python_api/examples/bpy.types.Depsgraph.6.py +++ b/doc/python_api/examples/bpy.types.Depsgraph.6.py @@ -30,7 +30,8 @@ class OBJECT_OT_simple_exporter(bpy.types.Operator): continue print(f"Exporting mesh with {len(mesh.vertices)} vertices " f"at {object_instance.matrix_world}") - object_instace.to_mesh_clear() + + self.clear_mesh_for_object_instance(object_instance) return {'FINISHED'} @@ -47,6 +48,12 @@ class OBJECT_OT_simple_exporter(bpy.types.Operator): return object_instance.object.to_mesh() else: return object_instance.object.original.to_mesh() + + def clear_mesh_for_object_instance(self, object_instance): + if self.apply_modifiers: + return object_instance.object.to_mesh_clear() + else: + return object_instance.object.original.to_mesh_clear() def register():