--- Blender version with error, and version that worked ---
Blender 2.60 to 2.69rc all fail and probably early versions as well.
--- Steps for others to reproduce the error ---
1) In the Python console write:
2) >>> override = {'selected_bases': list(bpy.context.scene.object_bases)}
[ ** caution, step (3) will remove all your scene objects ** ]
3) >>> bpy.ops.object.delete(override)
It seems to be working, but I get a lot of error prints such as:
PyContext 'window' not found
PyContext 'scene' not found
PyContext 'region' not found
PyContext 'area' not found
PyContext 'area' not found
PyContext 'screen' not found
PyContext 'screen' not found
PyContext 'active_object' not found
(...)
Those errors show in Debug and Release versions.
Reference documentation:
http://www.blender.org/documentation/blender_python_api_2_68_release/bpy.ops.html#overriding-context
Thanks
Description
Event Timeline
In a related note, I can segfault Blender very easily with this feature:
>>> override = {'selected_bases': [bpy.context.object,]}
>>> bpy.ops.object.delete(override)
I realize (now) that it crashes if I pass objects instead of object_bases (whatever the difference is ;).
This is pretty advanced so it's not the end of the world. It would be nice if we could not segfault though.
Hey Dalai, this is not a bug! You should feature those data in your fake pycontext as well!
Note best way if usually to do:
override = C.copy()
override['selected_bases'] = list(C.scene.object_bases)
bpy.ops.object.delete(override)
This just works fine…
I would say that at least the documentation is 'wrong', don't you agree?
[
and thanks for the instructions, I got what I wanted to do working ;)
https://github.com/dfelinto/addon-samples/blob/master/delete_family.py
]