[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25802] trunk/blender/source/blender: group instance still didnt work in some cases, now tag ID flag when linking as well as appending so its easy to know if an ID is newly added or not .

Campbell Barton ideasman42 at gmail.com
Thu Jan 7 17:19:38 CET 2010


Revision: 25802
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25802
Author:   campbellbarton
Date:     2010-01-07 17:19:38 +0100 (Thu, 07 Jan 2010)

Log Message:
-----------
group instance still didnt work in some cases, now tag ID flag when linking as well as appending so its easy to know if an ID is newly added or not.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/library.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/makesdna/DNA_ID.h
    trunk/blender/source/blender/windowmanager/intern/wm_operators.c

Modified: trunk/blender/source/blender/blenkernel/intern/library.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/library.c	2010-01-07 14:59:22 UTC (rev 25801)
+++ trunk/blender/source/blender/blenkernel/intern/library.c	2010-01-07 16:19:38 UTC (rev 25802)
@@ -1280,7 +1280,7 @@
 			 * (very nasty to discover all your links are lost after appending)  
 			 * */
 			if(id->flag & (LIB_EXTERN|LIB_INDIRECT|LIB_NEW) &&
-			  (untagged_only==0 || !(id->flag & LIB_APPEND_TAG)))
+			  (untagged_only==0 || !(id->flag & LIB_PRE_EXISTING)))
 			{
 				if(lib==NULL || id->lib==lib) {
 					id->flag &= ~(LIB_EXTERN|LIB_INDIRECT|LIB_NEW);

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2010-01-07 14:59:22 UTC (rev 25801)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2010-01-07 16:19:38 UTC (rev 25802)
@@ -11619,15 +11619,13 @@
 }
 
 /* when *lib set, it also does objects that were in the appended group */
-static void give_base_to_groups(Main *mainvar, Scene *scene, Library *lib, int flag)
+static void give_base_to_groups(Main *mainvar, Scene *scene)
 {
 	Group *group;
 
 	/* give all objects which are LIB_INDIRECT a base, or for a group when *lib has been set */
 	for(group= mainvar->group.first; group; group= group->id.next) {
-		if(	((flag & FILE_LINK)    && (group->id.lib == lib) && (group->id.flag & LIB_INDIRECT)==0) || /* linking, directly */
-			((flag & FILE_LINK)==0 && (group->id.flag & LIB_APPEND_TAG)==0) /* appending */
-		) {
+		if(((group->id.flag & LIB_INDIRECT)==0 && (group->id.flag & LIB_PRE_EXISTING)==0)) {
 			Base *base;
 
 			/* add_object(...) messes with the selection */
@@ -11854,7 +11852,7 @@
 			}
 
 			if (flag & FILE_GROUP_INSTANCE) {
-				give_base_to_groups(mainvar, scene, mainl->curlib, flag);
+				give_base_to_groups(mainvar, scene);
 			}
 		} else {
 			give_base_to_objects(mainvar, scene, NULL, 0);

Modified: trunk/blender/source/blender/makesdna/DNA_ID.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_ID.h	2010-01-07 14:59:22 UTC (rev 25801)
+++ trunk/blender/source/blender/makesdna/DNA_ID.h	2010-01-07 16:19:38 UTC (rev 25802)
@@ -212,8 +212,8 @@
 #define LIB_FAKEUSER	512
 /* free test flag */
 #define LIB_DOIT		1024
-/*  */
-#define LIB_APPEND_TAG	2048 
+/* tag existing data before linking so we know what is new */
+#define LIB_PRE_EXISTING	2048
 
 #ifdef __cplusplus
 }

Modified: trunk/blender/source/blender/windowmanager/intern/wm_operators.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_operators.c	2010-01-07 14:59:22 UTC (rev 25801)
+++ trunk/blender/source/blender/windowmanager/intern/wm_operators.c	2010-01-07 16:19:38 UTC (rev 25802)
@@ -1240,9 +1240,6 @@
 	/* make local */
 	if(lib) {
 		all_local(lib, 1);
-		/* important we unset, otherwise these object wont
-		 * link into other scenes from this blend file */
-		flag_all_listbases_ids(LIB_APPEND_TAG, 0);
 	}
 }
 
@@ -1300,9 +1297,11 @@
 	
 	flag = wm_link_append_flag(op);
 
-	/* tag everything, all untagged data can be made local */
-	if((flag & FILE_LINK)==0)
-		flag_all_listbases_ids(LIB_APPEND_TAG, 1);
+	/* tag everything, all untagged data can be made local
+	 * its also generally useful to know what is new
+	 *
+	 * take extra care flag_all_listbases_ids(LIB_LINK_TAG, 0) is called after! */
+	flag_all_listbases_ids(LIB_PRE_EXISTING, 1);
 
 	/* here appending/linking starts */
 	mainl = BLO_library_append_begin(C, &bh, libname);
@@ -1325,6 +1324,10 @@
 	if((flag & FILE_LINK)==0)
 		wm_link_make_library_local(bmain, libname);
 
+	/* important we unset, otherwise these object wont
+	 * link into other scenes from this blend file */
+	flag_all_listbases_ids(LIB_PRE_EXISTING, 0);
+
 	/* recreate dependency graph to include new objects */
 	DAG_scene_sort(scene);
 	DAG_ids_flush_update(0);





More information about the Bf-blender-cvs mailing list