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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-05-13 00:23:03 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-05-13 00:25:04 +0300
commitee3dde2d49983906ce7c5fb7d5802aea20ffb3ba (patch)
tree5f45e6f4e8e9cb3d9c351c1cd5340c2a487781d2 /source/blender
parent3e519860e5f0aa6a5cd1a1b71f9b07119e59593e (diff)
UI: ObData support for copy-to-selected
Now multi-object editing works for obdata too.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/interface/interface_ops.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 892bbd8ea97..e0adc391a24 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -33,6 +33,7 @@
#include "DNA_screen_types.h"
#include "DNA_text_types.h" /* for UI_OT_reports_to_text */
+#include "DNA_object_types.h" /* for OB_DATA_SUPPORT_ID */
#include "BLI_blenlib.h"
#include "BLI_math_color.h"
@@ -57,6 +58,7 @@
#include "WM_types.h"
#include "ED_paint.h"
+#include "ED_object.h"
/* only for UI_OT_editsource */
#include "ED_screen.h"
@@ -285,6 +287,51 @@ bool UI_context_copy_to_selected_list(
*r_use_path_from_id = true;
*r_path = RNA_path_from_ID_to_property(ptr, prop);
}
+ 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);
+ }
+
+ /* 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 = 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;
+ }
+ }
+
+ *r_lb = lb;
+ *r_path = path;
+ }
+
+ }
else if (GS(id->name) == ID_SCE) {
/* Sequencer's ID is scene :/ */
/* Try to recursively find an RNA_Sequence ancestor, to handle situations like T41062... */