diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-05-09 05:38:29 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-05-09 05:38:29 +0400 |
commit | 31471f644cb9d9c3b88da1977705724649482a82 (patch) | |
tree | 46b5c62b475108e1b1a501a21e53846531ead116 /source/blender/blenloader | |
parent | b1db37dd056d1b2a16e82f1374163de566c2fe10 (diff) | |
parent | f8f4f73cc5e6dfdc2a4f8864a3e1edc2639e6fb2 (diff) |
Merged changes in the trunk up to revision 36551.
Conflicts resolved:
source/creator/SConscript
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readblenentry.c | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 27 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 190 |
3 files changed, 21 insertions, 198 deletions
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index abc469a5355..39fab1929da 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -206,8 +206,6 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to } } else if (bhead->code==ENDB) { break; - } else if (bhead->code==DATA) { - /* DATA blocks between IDBlock and Preview */ } else { looking = 0; new_prv = NULL; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index b4ae2c77f0c..cf1b191cd63 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3770,7 +3770,12 @@ static void lib_link_object(FileData *fd, Main *main) } else if(act->type==ACT_OBJECT) { bObjectActuator *oa= act->data; - oa->reference= newlibadr(fd, ob->id.lib, oa->reference); + if(oa==NULL) { + init_actuator(act); + } + else { + oa->reference= newlibadr(fd, ob->id.lib, oa->reference); + } } else if(act->type==ACT_EDIT_OBJECT) { bEditObjectActuator *eoa= act->data; @@ -3782,15 +3787,6 @@ static void lib_link_object(FileData *fd, Main *main) eoa->me= newlibadr(fd, ob->id.lib, eoa->me); } } - else if(act->type==ACT_OBJECT) { - bObjectActuator *oa= act->data; - if(oa==NULL) { - init_actuator(act); - } - else { - oa->reference= newlibadr(fd, ob->id.lib, oa->reference); - } - } else if(act->type==ACT_SCENE) { bSceneActuator *sa= act->data; sa->camera= newlibadr(fd, ob->id.lib, sa->camera); @@ -4127,6 +4123,13 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) SWITCH_INT(mmd->bindcos[a]) } } + else if (md->type==eModifierType_Warp) { + WarpModifierData *tmd = (WarpModifierData *) md; + + tmd->curfalloff= newdataadr(fd, tmd->curfalloff); + if(tmd->curfalloff) + direct_link_curvemapping(fd, tmd->curfalloff); + } } } @@ -8866,11 +8869,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ima->gen_x= 256; ima->gen_y= 256; ima->gen_type= 1; - if(0==strncmp(ima->id.name+2, "Viewer Node", sizeof(ima->id.name+2))) { + if(0==strncmp(ima->id.name+2, "Viewer Node", sizeof(ima->id.name)-2)) { ima->source= IMA_SRC_VIEWER; ima->type= IMA_TYPE_COMPOSITE; } - if(0==strncmp(ima->id.name+2, "Render Result", sizeof(ima->id.name+2))) { + if(0==strncmp(ima->id.name+2, "Render Result", sizeof(ima->id.name)-2)) { ima->source= IMA_SRC_VIEWER; ima->type= IMA_TYPE_R_RESULT; } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index e0b773a5eb5..2093400b952 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1275,6 +1275,12 @@ static void write_modifiers(WriteData *wd, ListBase *modbase) writestruct(wd, DATA, "MDefInfluence", mmd->totinfluence, mmd->dyninfluences); writedata(wd, DATA, sizeof(int)*mmd->totvert, mmd->dynverts); } + else if (md->type==eModifierType_Warp) { + WarpModifierData *tmd = (WarpModifierData*) md; + if(tmd->curfalloff) { + write_curvemapping(wd, tmd->curfalloff); + } + } } } @@ -2752,187 +2758,3 @@ int BLO_write_file_mem(Main *mainvar, MemFile *compare, MemFile *current, int wr if(err==0) return 1; return 0; } - - - /* Runtime writing */ - -static char *get_runtime_path(char *exename) { - char *installpath= get_install_dir(); - - if (!installpath) { - return NULL; - } - else { - char *path= BLI_sprintfN("%s%c%s", installpath, SEP, exename); - - if (path == NULL) { - MEM_freeN(installpath); - return NULL; - } - - MEM_freeN(installpath); - - return path; - } -} - -#ifdef __APPLE__ - -static int recursive_copy_runtime(const char *outname, char *exename, ReportList *reports) -{ - char *runtime = get_runtime_path(exename); - char command[2 * (FILE_MAXDIR+FILE_MAXFILE) + 32]; - int progfd = -1, error= 0; - - if (!runtime) { - BKE_report(reports, RPT_ERROR, "Unable to find runtime"); - error= 1; - goto cleanup; - } - //printf("runtimepath %s\n", runtime); - - progfd= open(runtime, O_BINARY|O_RDONLY, 0); - if (progfd==-1) { - BKE_report(reports, RPT_ERROR, "Unable to find runtime"); - error= 1; - goto cleanup; - } - - sprintf(command, "/bin/cp -R \"%s\" \"%s\"", runtime, outname); - //printf("command %s\n", command); - if (system(command) == -1) { - BKE_report(reports, RPT_ERROR, "Couldn't copy runtime"); - error= 1; - } - -cleanup: - if (progfd!=-1) - close(progfd); - if (runtime) - MEM_freeN(runtime); - - return !error; -} - -int BLO_write_runtime(Main *mainvar, const char *file, char *exename, ReportList *reports) -{ - char gamename[FILE_MAXDIR+FILE_MAXFILE]; - int outfd = -1, error= 0; - - // remove existing file / bundle - //printf("Delete file %s\n", file); - BLI_delete(file, 0, TRUE); - - if (!recursive_copy_runtime(file, exename, reports)) { - error= 1; - goto cleanup; - } - - BLI_snprintf(gamename, sizeof(gamename), "%s/Contents/Resources/game.blend", file); - //printf("gamename %s\n", gamename); - outfd= open(gamename, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, 0777); - if (outfd != -1) { - - write_file_handle(mainvar, outfd, NULL,NULL, 0, G.fileflags, NULL); - - if (write(outfd, " ", 1) != 1) { - BKE_report(reports, RPT_ERROR, "Unable to write to output file."); - error= 1; - goto cleanup; - } - } else { - BKE_report(reports, RPT_ERROR, "Unable to open blenderfile."); - error= 1; - } - -cleanup: - if (outfd!=-1) - close(outfd); - - BKE_reports_prepend(reports, "Unable to make runtime: "); - return !error; -} - -#else /* !__APPLE__ */ - -static int handle_append_runtime(int handle, char *exename, ReportList *reports) -{ - char *runtime= get_runtime_path(exename); - unsigned char buf[1024]; - int count, progfd= -1, error= 0; - - if (!BLI_exists(runtime)) { - BKE_report(reports, RPT_ERROR, "Unable to find runtime."); - error= 1; - goto cleanup; - } - - progfd= open(runtime, O_BINARY|O_RDONLY, 0); - if (progfd==-1) { - BKE_report(reports, RPT_ERROR, "Unable to find runtime.@"); - error= 1; - goto cleanup; - } - - while ((count= read(progfd, buf, sizeof(buf)))>0) { - if (write(handle, buf, count)!=count) { - BKE_report(reports, RPT_ERROR, "Unable to write to output file."); - error= 1; - goto cleanup; - } - } - -cleanup: - if (progfd!=-1) - close(progfd); - if (runtime) - MEM_freeN(runtime); - - return !error; -} - -static int handle_write_msb_int(int handle, int i) -{ - unsigned char buf[4]; - buf[0]= (i>>24)&0xFF; - buf[1]= (i>>16)&0xFF; - buf[2]= (i>>8)&0xFF; - buf[3]= (i>>0)&0xFF; - - return (write(handle, buf, 4)==4); -} - -int BLO_write_runtime(Main *mainvar, const char *file, char *exename, ReportList *reports) -{ - int outfd= open(file, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, 0777); - int datastart, error= 0; - - if (!outfd) { - BKE_report(reports, RPT_ERROR, "Unable to open output file."); - error= 1; - goto cleanup; - } - if (!handle_append_runtime(outfd, exename, reports)) { - error= 1; - goto cleanup; - } - - datastart= lseek(outfd, 0, SEEK_CUR); - - write_file_handle(mainvar, outfd, NULL,NULL, 0, G.fileflags, NULL); - - if (!handle_write_msb_int(outfd, datastart) || (write(outfd, "BRUNTIME", 8)!=8)) { - BKE_report(reports, RPT_ERROR, "Unable to write to output file."); - error= 1; - goto cleanup; - } - -cleanup: - if (outfd!=-1) - close(outfd); - - BKE_reports_prepend(reports, "Unable to make runtime: "); - return !error; -} - -#endif /* !__APPLE__ */ |