When extracting data via temporary mesh, like this:
mesh = object.to_mesh(bpy.context.scene, apply_modifiers=True, settings='RENDER')
Do I need to delete this mesh, after I'm done extracting data? Will it stay in memory after running the script?
When extracting data via temporary mesh, like this:
mesh = object.to_mesh(bpy.context.scene, apply_modifiers=True, settings='RENDER')
Do I need to delete this mesh, after I'm done extracting data? Will it stay in memory after running the script?
Yes, you need to deleted them by yourself.
If you print that mesh object in script multiple times, you will find out that the name change by adding post-fix serial number to its based name as follow:
<bpy_struct, Mesh("Suzanne.002")>
<bpy_struct, Mesh("Suzanne.003")>
<bpy_struct, Mesh("Suzanne.004")>
And if you are using Blender 2.8, in the Outliner Panel, you can change display type from View Layer to Orphan Data (what an adorable name), the meshes you created will stay at there. You can pin them by pressing the cross button, making a fake user to let Blender keep the data-block.
If you need to delete it in script, you cannot del mesh since the object data-block was already binded in to bpy.data.meshes, use bpy.data.meshes.remove(mesh) instead to delete it.
bpy.data.meshes.remove(mesh). – May 05 '19 at 15:27bpy.data.meshes, use the methodremove()to delete it.bpy.data.meshes.remove(the_suzanne)– HikariTW May 05 '19 at 15:34