static BlendFileData *load_game_data(const char *progname, char *filename = NULL, char *relativename = NULL) { ReportList reports; BlendFileData *bfd = NULL; BKE_reports_init(&reports, RPT_STORE); /* try to load ourself, will only work if we are a runtime */ if (BLO_is_a_runtime(progname)) { bfd= BLO_read_runtime(progname, &reports); if (bfd) { bfd->type= BLENFILETYPE_RUNTIME; BLI_strncpy(bfd->main->name, progname, sizeof(bfd->main->name)); } } else { bfd= BLO_read_from_file(progname, &reports); } if (!bfd && filename) { bfd = load_game_data(filename); if (!bfd) { printf("Loading %s failed: ", filename); BKE_reports_print(&reports, RPT_ERROR); } } BKE_reports_clear(&reports); return bfd; }
int BKE_read_file(bContext *C, const char *filepath, ReportList *reports) { BlendFileData *bfd; int retval = BKE_READ_FILE_OK; if (strstr(filepath, BLENDER_STARTUP_FILE) == NULL) /* don't print user-pref loading */ printf("read blend: %s\n", filepath); bfd = BLO_read_from_file(filepath, reports); if (bfd) { if (bfd->user) retval = BKE_READ_FILE_OK_USERPREFS; if (0 == handle_subversion_warning(bfd->main, reports)) { BKE_main_free(bfd->main); MEM_freeN(bfd); bfd = NULL; retval = BKE_READ_FILE_FAIL; } else setup_app_data(C, bfd, filepath); // frees BFD } else BKE_reports_prependf(reports, "Loading '%s' failed: ", filepath); return (bfd ? retval : BKE_READ_FILE_FAIL); }
int BKE_blendfile_read( bContext *C, const char *filepath, const struct BlendFileReadParams *params, ReportList *reports) { BlendFileData *bfd; int retval = BKE_BLENDFILE_READ_OK; /* don't print user-pref loading */ if (strstr(filepath, BLENDER_STARTUP_FILE) == NULL) { printf("Read blend: %s\n", filepath); } bfd = BLO_read_from_file(filepath, params->skip_flags, reports); if (bfd) { if (bfd->user) { retval = BKE_BLENDFILE_READ_OK_USERPREFS; } if (0 == handle_subversion_warning(bfd->main, reports)) { BKE_main_free(bfd->main); MEM_freeN(bfd); bfd = NULL; retval = BKE_BLENDFILE_READ_FAIL; } else { setup_app_data(C, bfd, filepath, params->is_startup, reports); } } else BKE_reports_prependf(reports, "Loading '%s' failed: ", filepath); return (bfd ? retval : BKE_BLENDFILE_READ_FAIL); }
/* only read the userdef from a .blend */ UserDef *BKE_blendfile_userdef_read(const char *filepath, ReportList *reports) { BlendFileData *bfd; UserDef *userdef = NULL; bfd = BLO_read_from_file(filepath, BLO_READ_SKIP_ALL & ~BLO_READ_SKIP_USERDEF, reports); if (bfd) { if (bfd->user) { userdef = bfd->user; } BKE_main_free(bfd->main); MEM_freeN(bfd); } return userdef; }
static BlendFileData *load_game_data(char *filename) { ReportList reports; BlendFileData *bfd; BKE_reports_init(&reports, RPT_STORE); bfd= BLO_read_from_file(filename, &reports); if (!bfd) { printf("Loading %s failed: ", filename); BKE_reports_print(&reports, RPT_ERROR); } BKE_reports_clear(&reports); return bfd; }
/* only read the userdef from a .blend */ int BKE_read_file_userdef(const char *filepath, ReportList *reports) { BlendFileData *bfd; int retval = 0; bfd = BLO_read_from_file(filepath, reports); if (bfd->user) { retval = BKE_READ_FILE_OK_USERPREFS; /* only here free userdef themes... */ BKE_userdef_free(); U = *bfd->user; MEM_freeN(bfd->user); } free_main(bfd->main); MEM_freeN(bfd); return retval; }
bool GPC_Engine::Start(char *filename) { ReportList reports; BlendFileData *bfd; BKE_reports_init(&reports, RPT_STORE); bfd= BLO_read_from_file(filename, &reports); BKE_reports_clear(&reports); if (!bfd) { // XXX, deal with error here cout << "Unable to load: " << filename << endl; return false; } StartKetsji(); if(bfd->type == BLENFILETYPE_PUB) m_canvas->SetBannerDisplayEnabled(false); return true; }