diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-05-13 00:36:43 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-05-13 00:40:21 +0300 |
commit | b3334d936f9e840d79fe224a71110302fc8cbee9 (patch) | |
tree | 0bb30f9b1844c1518fcb17eef0e07a5d67bc0958 /source/blender/editors/interface | |
parent | ee3dde2d49983906ce7c5fb7d5802aea20ffb3ba (diff) |
Edit last commit, redundant 'data' in RNA path
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface_ops.c | 68 |
1 files changed, 32 insertions, 36 deletions
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index e0adc391a24..7c4ee7b6649 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -58,7 +58,6 @@ #include "WM_types.h" #include "ED_paint.h" -#include "ED_object.h" /* only for UI_OT_editsource */ #include "ED_screen.h" @@ -289,48 +288,45 @@ bool UI_context_copy_to_selected_list( } else if (OB_DATA_SUPPORT_ID(GS(id->name))) { /* check we're using the active object */ - - Object *ob = ED_object_context(C); - if (ob && ob->data == id) { - const short id_code = GS(id->name); - ListBase lb = CTX_data_collection_get(C, "selected_editable_objects"); - char *path = RNA_path_from_ID_to_property(ptr, prop); - - if (path) { - char *path_tmp; - path_tmp = path; - path = BLI_sprintfN("data%s%s", path[0] == '[' ? "" : ".", path); - MEM_freeN(path_tmp); + const short id_code = GS(id->name); + ListBase lb = CTX_data_collection_get(C, "selected_editable_objects"); + char *path = RNA_path_from_ID_to_property(ptr, prop); + + /* de-duplicate obdata */ + if (!BLI_listbase_is_empty(&lb)) { + CollectionPointerLink *link, *link_next; + + for (link = lb.first; link; link = link->next) { + Object *ob = link->ptr.id.data; + if (ob->data) { + ID *id_data = ob->data; + id_data->flag |= LIB_DOIT; + } } - /* de-duplicate obdata */ - if (!BLI_listbase_is_empty(&lb)) { - CollectionPointerLink *link, *link_next; - - for (link = lb.first; link; link = link->next) { - Object *ob = link->ptr.id.data; - if (ob->data) { - ID *id = ob->data; - id->flag |= LIB_DOIT; - } + for (link = lb.first; link; link = link_next) { + Object *ob = link->ptr.id.data; + ID *id_data = ob->data; + link_next = link->next; + + if ((id_data == NULL) || + (id_data->flag & LIB_DOIT) == 0 || + (id_data->lib) || + (GS(id_data->name) != id_code)) + { + BLI_remlink(&lb, link); + MEM_freeN(link); } - - for (link = lb.first; link; link = link_next) { - Object *ob = link->ptr.id.data; - ID *id = ob->data; - link_next = link->next; - if ((id == NULL) || (id->flag & LIB_DOIT) == 0 || (GS(id->name) != id_code)) { - BLI_remlink(&lb, link); - MEM_freeN(link); - } - id->flag &= ~LIB_DOIT; + else { + /* avoid prepending 'data' to the path */ + RNA_id_pointer_create(id_data, &link->ptr); } + id_data->flag &= ~LIB_DOIT; } - - *r_lb = lb; - *r_path = path; } + *r_lb = lb; + *r_path = path; } else if (GS(id->name) == ID_SCE) { /* Sequencer's ID is scene :/ */ |