diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-11-10 18:09:53 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-11-10 18:09:53 +0300 |
commit | 7efc2c2375bb591d57f6f3d63b274de48172e43b (patch) | |
tree | 5bf49f58ed3fb4cf6be8a953645d692503afc1c5 /source/blender/editors/screen/screen_context.c | |
parent | 1f2fe7ec1409298527d757cb395358bc02d494c1 (diff) |
modify the python context access so invalid names will raise an exception rather then returning None.
this way the UI scripts are less likely to fail silently and wont let typos work ok.
also allow subclassing of the context, added a copy function,
bpy.context.copy(), returns the context as a python dict to be modified and used in python.
This also showed up an invalid brush member in the screen context.
Diffstat (limited to 'source/blender/editors/screen/screen_context.c')
-rw-r--r-- | source/blender/editors/screen/screen_context.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index 31827e1b9c0..1a1def70717 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -67,7 +67,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult "visible_pchans", "selected_pchans", "active_bone", "active_pchan", "active_base", "active_object", "edit_object", "sculpt_object", "vertex_paint_object", "weight_paint_object", - "texture_paint_object", "brush", "particle_edit_object", NULL}; + "texture_paint_object", "particle_edit_object", NULL}; CTX_data_dir_set(result, dir); return 1; @@ -304,7 +304,10 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult return 1; } + else { + return 0; /* not found */ + } - return 0; + return -1; /* found but not available */ } |