Blender Git Loki

Git Commits -> Revision c508e61

Revision c508e61 by Campbell Barton (master)
October 29, 2009, 09:25 (GMT)
Python can now run operators with their own context (data context).
The aim of this is to avoid having to set the selection each time before running an operator from python.

At the moment this is set as a python dictionary with string keys and rna values... eg.

C = {}
C["active_object"] = bpy.data.objects['SomeOb']
bpy.ops.object.game_property_new(C)

# ofcourse this works too..
bpy.ops.object.game_property_new({"active_object":ob})

# or...
C = {"main":bpy.data, "scene":bpy.data.scenes[0], "active_object":bpy.data.objects['SomeOb'], "selected_editable_objects":list(bpy.data.objects)}
bpy.ops.object.location_apply(C)

Commit Details:

Full Hash: c508e6198a614619bb9d82cd59c0fdb7f55f427d
SVN Revision: 24151
Parent Commit: 40731af
Lines Changed: +150, -46

6 Modified Paths:

/release/scripts/modules/bpy_ops.py (+22, -5) (Diff)
/source/blender/blenkernel/BKE_context.h (+3, -0) (Diff)
/source/blender/blenkernel/intern/context.c (+14, -0) (Diff)
/source/blender/makesrna/intern/rna_curve.c (+2, -2) (Diff)
/source/blender/python/intern/bpy_interface.c (+55, -0) (Diff)
/source/blender/python/intern/bpy_operator.c (+54, -39) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021