[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39013] trunk/blender/source/blender/ blenloader/intern/readfile.c: when appending with a NULL context dont print warnigns about scene not being set - was annoying for BGE LibLoad .

Campbell Barton ideasman42 at gmail.com
Thu Aug 4 11:47:10 CEST 2011


Revision: 39013
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39013
Author:   campbellbarton
Date:     2011-08-04 09:47:09 +0000 (Thu, 04 Aug 2011)
Log Message:
-----------
when appending with a NULL context dont print warnigns about scene not being set - was annoying for BGE LibLoad.

Modified Paths:
--------------
    trunk/blender/source/blender/blenloader/intern/readfile.c

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2011-08-04 08:46:17 UTC (rev 39012)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2011-08-04 09:47:09 UTC (rev 39013)
@@ -13047,10 +13047,10 @@
 	}
 }
 
+/* Context == NULL signifies not to do any scene manipulation */
 static void library_append_end(const bContext *C, Main *mainl, FileData **fd, int idcode, short flag)
 {
 	Main *mainvar;
-	Scene *scene= CTX_data_scene(C);
 	Library *curlib;
 
 	/* make main consistent */
@@ -13079,23 +13079,29 @@
 	lib_verify_nodetree(mainvar, FALSE);
 	fix_relpaths_library(G.main->name, mainvar); /* make all relative paths, relative to the open blend file */
 
-	/* give a base to loose objects. If group append, do it for objects too */
-	if(scene) {
-		const short is_link= (flag & FILE_LINK) != 0;
-		if(idcode==ID_SCE) {
-			/* dont instance anything when linking in scenes, assume the scene its self instances the data */
+	if(C) {
+		Scene *scene= CTX_data_scene(C);
+
+		/* give a base to loose objects. If group append, do it for objects too */
+		if(scene) {
+			const short is_link= (flag & FILE_LINK) != 0;
+			if(idcode==ID_SCE) {
+				/* dont instance anything when linking in scenes, assume the scene its self instances the data */
+			}
+			else {
+				give_base_to_objects(mainvar, scene, curlib, idcode, is_link);
+
+				if (flag & FILE_GROUP_INSTANCE) {
+					give_base_to_groups(mainvar, scene);
+				}
+			}
 		}
 		else {
-			give_base_to_objects(mainvar, scene, curlib, idcode, is_link);
+			printf("library_append_end, scene is NULL (objects wont get bases)\n");
+		}
 
-			if (flag & FILE_GROUP_INSTANCE) {
-				give_base_to_groups(mainvar, scene);
-			}
-		}
+		append_do_cursor(scene, curlib, flag);
 	}
-	else {
-		printf("library_append_end, scene is NULL (objects wont get bases)\n");
-	}
 	/* has been removed... erm, why? s..ton) */
 	/* 20040907: looks like they are give base already in append_named_part(); -Nathan L */
 	/* 20041208: put back. It only linked direct, not indirect objects (ton) */
@@ -13105,8 +13111,6 @@
 		blo_freefiledata( *fd );
 		*fd = NULL;
 	}	
-
-	append_do_cursor(scene, curlib, flag);
 }
 
 void BLO_library_append_end(const bContext *C, struct Main *mainl, BlendHandle** bh, int idcode, short flag)




More information about the Bf-blender-cvs mailing list