[Bf-blender-cvs] [b3334d9] master: Edit last commit, redundant 'data' in RNA path

Campbell Barton noreply at git.blender.org
Tue May 12 23:41:34 CEST 2015


Commit: b3334d936f9e840d79fe224a71110302fc8cbee9
Author: Campbell Barton
Date:   Wed May 13 07:36:43 2015 +1000
Branches: master
https://developer.blender.org/rBb3334d936f9e840d79fe224a71110302fc8cbee9

Edit last commit, redundant 'data' in RNA path

===================================================================

M	source/blender/editors/interface/interface_ops.c

===================================================================

diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index e0adc39..7c4ee7b 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 :/ */




More information about the Bf-blender-cvs mailing list