This would allow you to ask for a new, Blend file that contains no data.
This is mainly useful to Python developers (use case from developer question)
If for example you're writing a script that loads a Blend file and renders it (or saves it to a new file).
Removing all data in a file is not very convenient.
- Calling bpy.ops.wm.read_homefile() will load the users startup.blend, which may contain any number of data-blocks, so there is no certainty that the file can be easily cleared afterwards. Note that a custom file can be passed but this means the developer has to keep an empty file available.
- Calling bpy.ops.wm.read_factory_settings() will give a predicable outcome, however it also re-initializes the user-prefereces, reloads fonts, all add-ons, so this is also not great either.
Here's an example of how this can be done currently.
import bpy def reset_blend(): bpy.ops.wm.read_factory_settings() for scene in bpy.data.scenes: for obj in scene.objects: scene.objects.unlink(obj) # only worry about data in the startup scene for bpy_data_iter in ( bpy.data.objects, bpy.data.meshes, bpy.data.lamps, bpy.data.cameras, ): for id_data in bpy_data_iter: bpy_data_iter.remove(id_data) reset_blend()
Instead, we could have an option to reset with no data. eg:
Internally this will likely just remove the data as the script above is doing, however it can be done in one place so developers don't have to do themselves.