diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-12-19 06:08:58 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-12-19 06:08:58 +0400 |
commit | acfe74351bc33ad11448c3acc18a0d3a88ff4059 (patch) | |
tree | 7f546ba28f0019b48a5bd73d855f6ac07515cb6b /source/blender/windowmanager/intern/wm_operators.c | |
parent | 0ddc77f9137e014bf22ea9a240c3a4ca0d239cd2 (diff) |
improve info view property output for properties.
- Include RNA properties when checking for matches.
- Don't include the context's property store (these are normally set by the UI code and not accessible by a script author)
Note: added CTX_data_dir_get_ex() which has options for returning different members from the context.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_operators.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index cd3d5c97f99..05e949d781e 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -570,7 +570,8 @@ static char *wm_prop_pystring_from_context(bContext *C, PointerRNA *ptr, Propert * - see if the pointers ID is in the context. */ - ListBase lb = CTX_data_dir_get(C); + /* don't get from the context store since this is normally set only for the UI and not usable elsewhere */ + ListBase lb = CTX_data_dir_get_ex(C, FALSE, TRUE, TRUE); LinkData *link; const char *member_found = NULL; @@ -582,21 +583,21 @@ static char *wm_prop_pystring_from_context(bContext *C, PointerRNA *ptr, Propert for (link = lb.first; link; link = link->next) { const char *identifier = link->data; - PointerRNA ctx_ptr = CTX_data_pointer_get(C, identifier); + PointerRNA ctx_item_ptr = CTX_data_pointer_get(C, identifier); - if (ctx_ptr.type == NULL) { + if (ctx_item_ptr.type == NULL) { continue; } - if (ptr->id.data == ctx_ptr.id.data) { - if ((ptr->data == ctx_ptr.data) && - (ptr->type == ctx_ptr.type)) + if (ptr->id.data == ctx_item_ptr.id.data) { + if ((ptr->data == ctx_item_ptr.data) && + (ptr->type == ctx_item_ptr.type)) { /* found! */ member_found = identifier; break; } - else if (RNA_struct_is_ID(ctx_ptr.type)) { + else if (RNA_struct_is_ID(ctx_item_ptr.type)) { /* we found a reference to this ID, * so fallback to it if there is no direct reference */ member_id = identifier; @@ -604,15 +605,6 @@ static char *wm_prop_pystring_from_context(bContext *C, PointerRNA *ptr, Propert } } - /* grr, CTX_data_dir_get skips scene */ - if ((member_id == NULL) && - (ptr->id.data != NULL) && - (GS(((ID *)ptr->id.data)->name) == ID_SCE) && - (CTX_data_scene(C) == ptr->id.data)) - { - member_id = "scene"; - } - if (member_found) { prop_str = RNA_path_property_py(ptr, prop, index); if (prop_str) { |