Welcome to mirror list, hosted at ThFree Co, Russian Federation.

bpy.ops.1.py « examples « python_api « doc - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7fdde453abea3299e1748bb04ba13ab6acb86924 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""
Overriding Context
------------------

It is possible to override context members that the operator sees, so that they
act on specified rather than the selected or active data, or to execute an
operator in the different part of the user interface.

The context overrides are passed as a dictionary, with keys matching the context
member names in bpy.context.
For example to override ``bpy.context.active_object``,
you would pass ``{'active_object': object}``.

.. note::

   You will nearly always want to use a copy of the actual current context as basis
   (otherwise, you'll have to find and gather all needed data yourself).
"""

# remove all objects in scene rather than the selected ones
import bpy
override = bpy.context.copy()
override['selected_bases'] = list(bpy.context.scene.object_bases)
bpy.ops.object.delete(override)