BGE Blend file loading was using BLO_read_from_memory which meant relative linked...
authorCampbell Barton <ideasman42@gmail.com>
Mon, 18 Aug 2008 23:48:59 +0000 (23:48 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 18 Aug 2008 23:48:59 +0000 (23:48 +0000)
This is odd because BLO_read_from_file was commented out with """//this doesn't work anymore for relative paths, so use BLO_read_from_memory instead"""
Undoing Erwins changes from r7497, just use normal file loading. From the commit log its not clear if he means relative filenames or relative linked libs but from testing both work now.

source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp

index 7de3056e382ff16a8d328bdc8f08818ac3f5520d..c8ba96ac722dad5202830d07dd0acca278c23e9c 100644 (file)
@@ -90,33 +90,10 @@ void update_for_newframe();
 
 static BlendFileData *load_game_data(char *filename) {
        BlendReadError error;
-       //this doesn't work anymore for relative paths, so use BLO_read_from_memory instead
-       //BlendFileData *bfd= BLO_read_from_file(filename, &error);
-       FILE* file = fopen(filename,"rb");
-       BlendFileData *bfd  = 0;
-       if (file)
-       {
-               fseek(file, 0L, SEEK_END);
-               int len= ftell(file);
-               fseek(file, 0L, SEEK_SET);      
-               char* filebuffer= new char[len];//MEM_mallocN(len, "text_buffer");
-               int sizeread = fread(filebuffer,len,1,file);
-               if (sizeread==1){
-                       bfd = BLO_read_from_memory(filebuffer, len, &error);
-               } else {
-                       error = BRE_UNABLE_TO_READ;
-               }
-               fclose(file);
-               // the memory is not released in BLO_read_from_memory, must do it here
-               delete filebuffer;
-       } else {
-               error = BRE_UNABLE_TO_OPEN;
-       }
-
+       BlendFileData *bfd= BLO_read_from_file(filename, &error);
        if (!bfd) {
                printf("Loading %s failed: %s\n", filename, BLO_bre_as_string(error));
        }
-       
        return bfd;
 }