Cleanup: BKE_scene_set_name mixed G.main & bmain arg

This commit is contained in:
Campbell Barton 2014-07-23 20:30:55 +10:00
parent f88593df69
commit 82f16f81fd
3 changed files with 15 additions and 9 deletions

@ -69,9 +69,11 @@ int BKE_read_file(struct bContext *C, const char *filepath, struct ReportList *r
#define BKE_READ_FILE_OK 1 /* OK */ #define BKE_READ_FILE_OK 1 /* OK */
#define BKE_READ_FILE_OK_USERPREFS 2 /* OK, and with new user settings */ #define BKE_READ_FILE_OK_USERPREFS 2 /* OK, and with new user settings */
int BKE_read_file_from_memory(struct bContext *C, const void *filebuf, bool BKE_read_file_from_memory(
int filelength, struct ReportList *reports, int update_defaults); struct bContext *C, const void *filebuf,
int BKE_read_file_from_memfile(struct bContext *C, struct MemFile *memfile, int filelength, struct ReportList *reports, bool update_defaults);
bool BKE_read_file_from_memfile(
struct bContext *C, struct MemFile *memfile,
struct ReportList *reports); struct ReportList *reports);
int BKE_read_file_userdef(const char *filepath, struct ReportList *reports); int BKE_read_file_userdef(const char *filepath, struct ReportList *reports);

@ -479,7 +479,9 @@ int BKE_read_file(bContext *C, const char *filepath, ReportList *reports)
return (bfd ? retval : BKE_READ_FILE_FAIL); return (bfd ? retval : BKE_READ_FILE_FAIL);
} }
int BKE_read_file_from_memory(bContext *C, const void *filebuf, int filelength, ReportList *reports, int update_defaults) bool BKE_read_file_from_memory(
bContext *C, const void *filebuf, int filelength,
ReportList *reports, bool update_defaults)
{ {
BlendFileData *bfd; BlendFileData *bfd;
@ -496,7 +498,9 @@ int BKE_read_file_from_memory(bContext *C, const void *filebuf, int filelength,
} }
/* memfile is the undo buffer */ /* memfile is the undo buffer */
int BKE_read_file_from_memfile(bContext *C, MemFile *memfile, ReportList *reports) bool BKE_read_file_from_memfile(
bContext *C, MemFile *memfile,
ReportList *reports)
{ {
BlendFileData *bfd; BlendFileData *bfd;

@ -719,14 +719,14 @@ void BKE_scene_set_background(Main *bmain, Scene *scene)
/* called from creator.c */ /* called from creator.c */
Scene *BKE_scene_set_name(Main *bmain, const char *name) Scene *BKE_scene_set_name(Main *bmain, const char *name)
{ {
Scene *sce = (Scene *)BKE_libblock_find_name(ID_SCE, name); Scene *sce = (Scene *)BKE_libblock_find_name_ex(bmain, ID_SCE, name);
if (sce) { if (sce) {
BKE_scene_set_background(bmain, sce); BKE_scene_set_background(bmain, sce);
printf("Scene switch: '%s' in file: '%s'\n", name, G.main->name); printf("Scene switch: '%s' in file: '%s'\n", name, bmain->name);
return sce; return sce;
} }
printf("Can't find scene: '%s' in file: '%s'\n", name, G.main->name); printf("Can't find scene: '%s' in file: '%s'\n", name, bmain->name);
return NULL; return NULL;
} }