Changeset View
Changeset View
Standalone View
Standalone View
doc/python_api/examples/bpy.types.Depsgraph.6.py
| Show All 23 Lines | def execute(self, context): | ||||
| # NOTE: This will create a mesh for every instance, which is not ideal at all. In | # NOTE: This will create a mesh for every instance, which is not ideal at all. In | ||||
| # reality destination format will support some sort of instancing mechanism, so the | # reality destination format will support some sort of instancing mechanism, so the | ||||
| # code here will simply say "instance this object at object_instance.matrix_world". | # code here will simply say "instance this object at object_instance.matrix_world". | ||||
| mesh = self.create_mesh_for_object_instance(object_instance) | mesh = self.create_mesh_for_object_instance(object_instance) | ||||
| if mesh is None: | if mesh is None: | ||||
| # Happens for non-geometry objects. | # Happens for non-geometry objects. | ||||
| continue | continue | ||||
| print(f"Exporting mesh with {len(mesh.vertices)} vertices " | print(f"Exporting mesh with {len(mesh.vertices)} vertices " | ||||
| f"at {object_instance.matrix_world}") | f"at {object_instance.matrix_world}") | ||||
| object_instace.to_mesh_clear() | object_instace.to_mesh_clear() | ||||
| return {'FINISHED'} | return {'FINISHED'} | ||||
| def is_object_instance_from_selected(self, object_instance): | def is_object_instance_from_selected(self, object_instance): | ||||
| # For instanced objects we check selection of their instancer (more accurately: check | # For instanced objects we check selection of their instancer (more accurately: check | ||||
| # selection status of the original object corresponding to the instancer). | # selection status of the original object corresponding to the instancer). | ||||
| if object_instance.parent: | if object_instance.parent: | ||||
| Show All 21 Lines | |||||