int BKE_read_file_from_memory(bContext *C, char *filebuf, int filelength, ReportList *reports) { BlendFileData *bfd; bfd = BLO_read_from_memory(filebuf, filelength, reports); if (bfd) setup_app_data(C, bfd, "<memory2>"); else BKE_reports_prepend(reports, "Loading failed: "); return (bfd ? 1 : 0); }
int BKE_read_file_from_memory(bContext *C, const void *filebuf, int filelength, ReportList *reports, int update_defaults) { BlendFileData *bfd; bfd = BLO_read_from_memory(filebuf, filelength, reports); if (bfd) { if (update_defaults) BLO_update_defaults_startup_blend(bfd->main); setup_app_data(C, bfd, "<memory2>"); } else BKE_reports_prepend(reports, "Loading failed: "); return (bfd ? 1 : 0); }
static Main *load_main_from_memory(const void *blend, int blend_size) { const int fileflags = G.fileflags; Main *bmain = NULL; BlendFileData *bfd; G.fileflags |= G_FILE_NO_UI; bfd = BLO_read_from_memory(blend, blend_size, NULL); if (bfd) { bmain = bfd->main; MEM_freeN(bfd); } G.fileflags = fileflags; return bmain; }
void ED_preview_init_dbase(void) { #ifndef WITH_HEADLESS BlendFileData *bfd; extern int datatoc_preview_blend_size; extern char datatoc_preview_blend[]; const int fileflags= G.fileflags; G.fileflags |= G_FILE_NO_UI; bfd= BLO_read_from_memory(datatoc_preview_blend, datatoc_preview_blend_size, NULL); if (bfd) { pr_main= bfd->main; MEM_freeN(bfd); } G.fileflags= fileflags; #endif }
bool BKE_blendfile_read_from_memory( bContext *C, const void *filebuf, int filelength, ReportList *reports, int skip_flags, bool update_defaults) { BlendFileData *bfd; bfd = BLO_read_from_memory(filebuf, filelength, reports, skip_flags); if (bfd) { if (update_defaults) BLO_update_defaults_startup_blend(bfd->main); setup_app_data(C, bfd, "<memory2>", reports); } else { BKE_reports_prepend(reports, "Loading failed: "); } return (bfd != NULL); }
UserDef *BKE_blendfile_userdef_read_from_memory( const void *filebuf, int filelength, ReportList *reports) { BlendFileData *bfd; UserDef *userdef = NULL; bfd = BLO_read_from_memory(filebuf, filelength, reports, BLO_READ_SKIP_ALL & ~BLO_READ_SKIP_USERDEF); if (bfd) { if (bfd->user) { userdef = bfd->user; } BKE_main_free(bfd->main); MEM_freeN(bfd); } else { BKE_reports_prepend(reports, "Loading failed: "); } return userdef; }
bool GPC_Engine::Start(unsigned char *blenderDataBuffer, unsigned int blenderDataBufferSize) { ReportList reports; BlendFileData *bfd; BKE_reports_init(&reports, RPT_STORE); bfd= BLO_read_from_memory(blenderDataBuffer, blenderDataBufferSize, &reports); BKE_reports_clear(&reports); if (!bfd) { // XXX, deal with error here cout << "Unable to load. " << endl; return false; } StartKetsji(); if(bfd->type == BLENFILETYPE_PUB) m_canvas->SetBannerDisplayEnabled(false); return true; }