Merge branch 'master' into blender2.8
Conflicts: source/blender/blenkernel/intern/blendfile.c source/blender/blenloader/intern/readfile.h source/blender/blenloader/intern/versioning_250.c source/blender/blenloader/intern/versioning_260.c source/blender/blenloader/intern/versioning_270.c source/blender/blenloader/intern/versioning_legacy.c source/blender/editors/render/render_shading.c source/blender/makesrna/intern/rna_movieclip.c source/blender/render/intern/source/pipeline.c source/blender/render/intern/source/voxeldata.c
This commit is contained in:
commit
f0d9dbae0d
|
@ -182,6 +182,9 @@ struct BlendThumbnail *BKE_main_thumbnail_from_imbuf(struct Main *bmain, struct
|
|||
struct ImBuf *BKE_main_thumbnail_to_imbuf(struct Main *bmain, struct BlendThumbnail *data);
|
||||
void BKE_main_thumbnail_create(struct Main *bmain);
|
||||
|
||||
const char *BKE_main_blendfile_path(const struct Main *bmain) ATTR_NONNULL();
|
||||
const char *BKE_main_blendfile_path_from_global(void);
|
||||
|
||||
void BKE_main_id_tag_idcode(struct Main *mainvar, const short type, const int tag, const bool value);
|
||||
void BKE_main_id_tag_listbase(struct ListBase *lb, const int tag, const bool value);
|
||||
void BKE_main_id_tag_all(struct Main *mainvar, const int tag, const bool value);
|
||||
|
|
|
@ -49,7 +49,7 @@ void BKE_movieclip_make_local(struct Main *bmain, struct MovieClip *clip, const
|
|||
struct MovieClip *BKE_movieclip_file_add(struct Main *bmain, const char *name);
|
||||
struct MovieClip *BKE_movieclip_file_add_exists_ex(struct Main *bmain, const char *name, bool *r_exists);
|
||||
struct MovieClip *BKE_movieclip_file_add_exists(struct Main *bmain, const char *name);
|
||||
void BKE_movieclip_reload(struct MovieClip *clip);
|
||||
void BKE_movieclip_reload(struct Main *bmain, struct MovieClip *clip);
|
||||
void BKE_movieclip_clear_cache(struct MovieClip *clip);
|
||||
void BKE_movieclip_clear_proxy_cache(struct MovieClip *clip);
|
||||
|
||||
|
|
|
@ -67,10 +67,11 @@
|
|||
|
||||
bool BKE_memfile_undo_decode(MemFileUndoData *mfu, bContext *C)
|
||||
{
|
||||
char mainstr[sizeof(G.main->name)];
|
||||
Main *bmain = CTX_data_main(C);
|
||||
char mainstr[sizeof(bmain->name)];
|
||||
int success = 0, fileflags;
|
||||
|
||||
BLI_strncpy(mainstr, G.main->name, sizeof(mainstr)); /* temporal store */
|
||||
BLI_strncpy(mainstr, BKE_main_blendfile_path(bmain), sizeof(mainstr)); /* temporal store */
|
||||
|
||||
fileflags = G.fileflags;
|
||||
G.fileflags |= G_FILE_NO_UI;
|
||||
|
@ -83,7 +84,7 @@ bool BKE_memfile_undo_decode(MemFileUndoData *mfu, bContext *C)
|
|||
}
|
||||
|
||||
/* restore */
|
||||
BLI_strncpy(G.main->name, mainstr, sizeof(G.main->name)); /* restore */
|
||||
BLI_strncpy(bmain->name, mainstr, sizeof(bmain->name)); /* restore */
|
||||
G.fileflags = fileflags;
|
||||
|
||||
if (success) {
|
||||
|
|
|
@ -116,6 +116,7 @@ static void setup_app_data(
|
|||
bContext *C, BlendFileData *bfd,
|
||||
const char *filepath, ReportList *reports)
|
||||
{
|
||||
Main *bmain = G.main; /* Valid usage */
|
||||
Scene *curscene = NULL;
|
||||
const bool is_startup = (bfd->filename[0] == '\0');
|
||||
const bool recover = (G.fileflags & G_FILE_RECOVER) != 0;
|
||||
|
@ -172,9 +173,9 @@ static void setup_app_data(
|
|||
bool track_undo_scene;
|
||||
|
||||
/* comes from readfile.c */
|
||||
SWAP(ListBase, G.main->wm, bfd->main->wm);
|
||||
SWAP(ListBase, G.main->workspaces, bfd->main->workspaces);
|
||||
SWAP(ListBase, G.main->screen, bfd->main->screen);
|
||||
SWAP(ListBase, bmain->wm, bfd->main->wm);
|
||||
SWAP(ListBase, bmain->workspaces, bfd->main->workspaces);
|
||||
SWAP(ListBase, bmain->screen, bfd->main->screen);
|
||||
|
||||
/* we re-use current window and screen */
|
||||
win = CTX_wm_window(C);
|
||||
|
@ -236,9 +237,9 @@ static void setup_app_data(
|
|||
/* clear old property update cache, in case some old references are left dangling */
|
||||
RNA_property_update_cache_free();
|
||||
|
||||
G.main = bfd->main;
|
||||
bmain = G.main = bfd->main;
|
||||
|
||||
CTX_data_main_set(C, G.main);
|
||||
CTX_data_main_set(C, bmain);
|
||||
|
||||
if (bfd->user) {
|
||||
|
||||
|
@ -266,7 +267,7 @@ static void setup_app_data(
|
|||
/* Keep state from preferences. */
|
||||
const int fileflags_skip = G_FILE_FLAGS_RUNTIME;
|
||||
G.fileflags = (G.fileflags & fileflags_skip) | (bfd->fileflags & ~fileflags_skip);
|
||||
CTX_wm_manager_set(C, G.main->wm.first);
|
||||
CTX_wm_manager_set(C, bmain->wm.first);
|
||||
CTX_wm_screen_set(C, bfd->curscreen);
|
||||
CTX_data_scene_set(C, bfd->curscene);
|
||||
CTX_wm_area_set(C, NULL);
|
||||
|
@ -280,10 +281,10 @@ static void setup_app_data(
|
|||
wmWindow *win = CTX_wm_window(C);
|
||||
|
||||
/* in case we don't even have a local scene, add one */
|
||||
if (!G.main->scene.first)
|
||||
BKE_scene_add(G.main, "Empty");
|
||||
if (!bmain->scene.first)
|
||||
BKE_scene_add(bmain, "Empty");
|
||||
|
||||
CTX_data_scene_set(C, G.main->scene.first);
|
||||
CTX_data_scene_set(C, bmain->scene.first);
|
||||
win->scene = CTX_data_scene(C);
|
||||
curscene = CTX_data_scene(C);
|
||||
}
|
||||
|
@ -307,35 +308,35 @@ static void setup_app_data(
|
|||
|
||||
/* FIXME: this version patching should really be part of the file-reading code,
|
||||
* but we still get too many unrelated data-corruption crashes otherwise... */
|
||||
if (G.main->versionfile < 250)
|
||||
do_versions_ipos_to_animato(G.main);
|
||||
if (bmain->versionfile < 250)
|
||||
do_versions_ipos_to_animato(bmain);
|
||||
|
||||
G.main->recovered = 0;
|
||||
bmain->recovered = 0;
|
||||
|
||||
/* startup.blend or recovered startup */
|
||||
if (bfd->filename[0] == 0) {
|
||||
G.main->name[0] = 0;
|
||||
bmain->name[0] = '\0';
|
||||
}
|
||||
else if (recover && G.relbase_valid) {
|
||||
/* in case of autosave or quit.blend, use original filename instead
|
||||
* use relbase_valid to make sure the file is saved, else we get <memory2> in the filename */
|
||||
filepath = bfd->filename;
|
||||
G.main->recovered = 1;
|
||||
bmain->recovered = 1;
|
||||
|
||||
/* these are the same at times, should never copy to the same location */
|
||||
if (G.main->name != filepath)
|
||||
BLI_strncpy(G.main->name, filepath, FILE_MAX);
|
||||
if (bmain->name != filepath)
|
||||
BLI_strncpy(bmain->name, filepath, FILE_MAX);
|
||||
}
|
||||
|
||||
/* baseflags, groups, make depsgraph, etc */
|
||||
/* first handle case if other windows have different scenes visible */
|
||||
if (mode == LOAD_UI) {
|
||||
wmWindowManager *wm = G.main->wm.first;
|
||||
wmWindowManager *wm = bmain->wm.first;
|
||||
|
||||
if (wm) {
|
||||
for (wmWindow *win = wm->windows.first; win; win = win->next) {
|
||||
if (win->scene && win->scene != curscene) {
|
||||
BKE_scene_set_background(G.main, win->scene);
|
||||
BKE_scene_set_background(bmain, win->scene);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -346,10 +347,10 @@ static void setup_app_data(
|
|||
* constructing dependency graph.
|
||||
*/
|
||||
if (mode != LOAD_UNDO) {
|
||||
IMB_colormanagement_check_file_config(G.main);
|
||||
IMB_colormanagement_check_file_config(bmain);
|
||||
}
|
||||
|
||||
BKE_scene_set_background(G.main, curscene);
|
||||
BKE_scene_set_background(bmain, curscene);
|
||||
|
||||
if (mode != LOAD_UNDO) {
|
||||
/* TODO(sergey): Can this be also move above? */
|
||||
|
@ -431,9 +432,10 @@ bool BKE_blendfile_read_from_memfile(
|
|||
bContext *C, struct MemFile *memfile,
|
||||
ReportList *reports, int skip_flags)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
BlendFileData *bfd;
|
||||
|
||||
bfd = BLO_read_from_memfile(CTX_data_main(C), G.main->name, memfile, reports, skip_flags);
|
||||
bfd = BLO_read_from_memfile(bmain, BKE_main_blendfile_path(bmain), memfile, reports, skip_flags);
|
||||
if (bfd) {
|
||||
/* remove the unused screens and wm */
|
||||
while (bfd->main->wm.first)
|
||||
|
|
|
@ -325,7 +325,7 @@ void BKE_bpath_missing_files_find(Main *bmain, const char *searchpath, ReportLis
|
|||
struct BPathFind_Data data = {NULL};
|
||||
const int flag = BKE_BPATH_TRAVERSE_ABS | BKE_BPATH_TRAVERSE_RELOAD_EDITED;
|
||||
|
||||
data.basedir = bmain->name;
|
||||
data.basedir = BKE_main_blendfile_path(bmain);
|
||||
data.reports = reports;
|
||||
data.searchdir = searchpath;
|
||||
data.find_all = find_all;
|
||||
|
|
|
@ -3216,7 +3216,7 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char *filenam
|
|||
BKE_image_path_ensure_ext_from_imtype(output_file, format);
|
||||
|
||||
/* Validate output file path */
|
||||
BLI_path_abs(output_file, G.main->name);
|
||||
BLI_path_abs(output_file, BKE_main_blendfile_path_from_global());
|
||||
BLI_make_existing_file(output_file);
|
||||
|
||||
/* Init image buffer */
|
||||
|
|
|
@ -255,8 +255,8 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath)
|
|||
}
|
||||
else {
|
||||
BLI_split_file_part(filepath, filename, sizeof(filename));
|
||||
pf = newPackedFile(NULL, filepath, bmain->name);
|
||||
temp_pf = newPackedFile(NULL, filepath, bmain->name);
|
||||
pf = newPackedFile(NULL, filepath, BKE_main_blendfile_path(bmain));
|
||||
temp_pf = newPackedFile(NULL, filepath, BKE_main_blendfile_path(bmain));
|
||||
|
||||
is_builtin = false;
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ VFont *BKE_vfont_load_exists_ex(struct Main *bmain, const char *filepath, bool *
|
|||
char str[FILE_MAX], strtest[FILE_MAX];
|
||||
|
||||
BLI_strncpy(str, filepath, sizeof(str));
|
||||
BLI_path_abs(str, bmain->name);
|
||||
BLI_path_abs(str, BKE_main_blendfile_path(bmain));
|
||||
|
||||
/* first search an identical filepath */
|
||||
for (vfont = bmain->vfont.first; vfont; vfont = vfont->id.next) {
|
||||
|
|
|
@ -592,7 +592,7 @@ Image *BKE_image_load(Main *bmain, const char *filepath)
|
|||
char str[FILE_MAX];
|
||||
|
||||
STRNCPY(str, filepath);
|
||||
BLI_path_abs(str, bmain->name);
|
||||
BLI_path_abs(str, BKE_main_blendfile_path(bmain));
|
||||
|
||||
/* exists? */
|
||||
file = BLI_open(str, O_BINARY | O_RDONLY, 0);
|
||||
|
@ -621,7 +621,7 @@ Image *BKE_image_load_exists_ex(const char *filepath, bool *r_exists)
|
|||
char str[FILE_MAX], strtest[FILE_MAX];
|
||||
|
||||
STRNCPY(str, filepath);
|
||||
BLI_path_abs(str, G.main->name);
|
||||
BLI_path_abs(str, BKE_main_blendfile_path_from_global());
|
||||
|
||||
/* first search an identical filepath */
|
||||
for (ima = G.main->image.first; ima; ima = ima->id.next) {
|
||||
|
@ -1648,7 +1648,8 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
|
|||
time_t t;
|
||||
|
||||
if (scene->r.stamp & R_STAMP_FILENAME) {
|
||||
SNPRINTF(stamp_data->file, do_prefix ? "File %s" : "%s", G.relbase_valid ? G.main->name : "<untitled>");
|
||||
SNPRINTF(stamp_data->file, do_prefix ? "File %s" : "%s",
|
||||
G.relbase_valid ? BKE_main_blendfile_path_from_global() : "<untitled>");
|
||||
}
|
||||
else {
|
||||
stamp_data->file[0] = '\0';
|
||||
|
@ -4698,7 +4699,7 @@ static void image_update_views_format(Image *ima, ImageUser *iuser)
|
|||
char str[FILE_MAX];
|
||||
|
||||
STRNCPY(str, iv->filepath);
|
||||
BLI_path_abs(str, G.main->name);
|
||||
BLI_path_abs(str, BKE_main_blendfile_path_from_global());
|
||||
|
||||
/* exists? */
|
||||
file = BLI_open(str, O_BINARY | O_RDONLY, 0);
|
||||
|
|
|
@ -155,7 +155,7 @@
|
|||
* also note that the id _must_ have a library - campbell */
|
||||
void BKE_id_lib_local_paths(Main *bmain, Library *lib, ID *id)
|
||||
{
|
||||
const char *bpath_user_data[2] = {bmain->name, lib->filepath};
|
||||
const char *bpath_user_data[2] = {BKE_main_blendfile_path(bmain), lib->filepath};
|
||||
|
||||
BKE_bpath_traverse_id(bmain, id,
|
||||
BKE_bpath_relocate_visitor,
|
||||
|
@ -1737,6 +1737,24 @@ void BKE_main_thumbnail_create(struct Main *bmain)
|
|||
bmain->blen_thumb->height = BLEN_THUMB_SIZE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return filepath of given \a main.
|
||||
*/
|
||||
const char *BKE_main_blendfile_path(const Main *bmain)
|
||||
{
|
||||
return bmain->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return filepath of global main (G.main).
|
||||
*
|
||||
* \warning Usage is not recommended, you should always try to get a velid Main pointer from context...
|
||||
*/
|
||||
const char *BKE_main_blendfile_path_from_global(void)
|
||||
{
|
||||
return BKE_main_blendfile_path(G.main);
|
||||
}
|
||||
|
||||
/* ***************** ID ************************ */
|
||||
ID *BKE_libblock_find_name(struct Main *bmain, const short type, const char *name)
|
||||
{
|
||||
|
@ -2525,7 +2543,7 @@ void BKE_library_filepath_set(Main *bmain, Library *lib, const char *filepath)
|
|||
*/
|
||||
/* Never make paths relative to parent lib - reading code (blenloader) always set *all* lib->name relative to
|
||||
* current main, not to their parent for indirectly linked ones. */
|
||||
const char *basepath = bmain->name;
|
||||
const char *basepath = BKE_main_blendfile_path(bmain);
|
||||
BLI_path_abs(lib->filepath, basepath);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -199,7 +199,7 @@ static void get_proxy_fname(const MovieClip *clip,
|
|||
else
|
||||
BLI_snprintf(name, FILE_MAX, "%s/%s/proxy_%d/%08d", dir, clipfile, size, proxynr);
|
||||
|
||||
BLI_path_abs(name, G.main->name);
|
||||
BLI_path_abs(name, BKE_main_blendfile_path_from_global());
|
||||
BLI_path_frame(name, 1, 0);
|
||||
|
||||
strcat(name, ".jpg");
|
||||
|
@ -270,7 +270,7 @@ static void movieclip_open_anim_file(MovieClip *clip)
|
|||
if (clip->flag & MCLIP_USE_PROXY_CUSTOM_DIR) {
|
||||
char dir[FILE_MAX];
|
||||
BLI_strncpy(dir, clip->proxy.dir, sizeof(dir));
|
||||
BLI_path_abs(dir, G.main->name);
|
||||
BLI_path_abs(dir, BKE_main_blendfile_path_from_global());
|
||||
IMB_anim_set_index_dir(clip->anim, dir);
|
||||
}
|
||||
}
|
||||
|
@ -627,13 +627,13 @@ static void movieclip_load_get_size(MovieClip *clip)
|
|||
}
|
||||
}
|
||||
|
||||
static void detect_clip_source(MovieClip *clip)
|
||||
static void detect_clip_source(Main *bmain, MovieClip *clip)
|
||||
{
|
||||
ImBuf *ibuf;
|
||||
char name[FILE_MAX];
|
||||
|
||||
BLI_strncpy(name, clip->name, sizeof(name));
|
||||
BLI_path_abs(name, G.main->name);
|
||||
BLI_path_abs(name, BKE_main_blendfile_path(bmain));
|
||||
|
||||
ibuf = IMB_testiffname(name, IB_rect | IB_multilayer);
|
||||
if (ibuf) {
|
||||
|
@ -656,7 +656,7 @@ MovieClip *BKE_movieclip_file_add(Main *bmain, const char *name)
|
|||
char str[FILE_MAX];
|
||||
|
||||
BLI_strncpy(str, name, sizeof(str));
|
||||
BLI_path_abs(str, bmain->name);
|
||||
BLI_path_abs(str, BKE_main_blendfile_path(bmain));
|
||||
|
||||
/* exists? */
|
||||
file = BLI_open(str, O_BINARY | O_RDONLY, 0);
|
||||
|
@ -670,7 +670,7 @@ MovieClip *BKE_movieclip_file_add(Main *bmain, const char *name)
|
|||
clip = movieclip_alloc(bmain, BLI_path_basename(name));
|
||||
BLI_strncpy(clip->name, name, sizeof(clip->name));
|
||||
|
||||
detect_clip_source(clip);
|
||||
detect_clip_source(bmain, clip);
|
||||
|
||||
movieclip_load_get_size(clip);
|
||||
if (clip->lastsize[0]) {
|
||||
|
@ -690,7 +690,7 @@ MovieClip *BKE_movieclip_file_add_exists_ex(Main *bmain, const char *filepath, b
|
|||
char str[FILE_MAX], strtest[FILE_MAX];
|
||||
|
||||
BLI_strncpy(str, filepath, sizeof(str));
|
||||
BLI_path_abs(str, bmain->name);
|
||||
BLI_path_abs(str, BKE_main_blendfile_path(bmain));
|
||||
|
||||
/* first search an identical filepath */
|
||||
for (clip = bmain->movieclip.first; clip; clip = clip->id.next) {
|
||||
|
@ -1282,13 +1282,13 @@ void BKE_movieclip_clear_proxy_cache(MovieClip *clip)
|
|||
}
|
||||
}
|
||||
|
||||
void BKE_movieclip_reload(MovieClip *clip)
|
||||
void BKE_movieclip_reload(Main *bmain, MovieClip *clip)
|
||||
{
|
||||
/* clear cache */
|
||||
free_buffers(clip);
|
||||
|
||||
/* update clip source */
|
||||
detect_clip_source(clip);
|
||||
detect_clip_source(bmain, clip);
|
||||
|
||||
clip->lastsize[0] = clip->lastsize[1] = 0;
|
||||
movieclip_load_get_size(clip);
|
||||
|
|
|
@ -246,14 +246,14 @@ void packAll(Main *bmain, ReportList *reports, bool verbose)
|
|||
|
||||
for (vfont = bmain->vfont.first; vfont; vfont = vfont->id.next) {
|
||||
if (vfont->packedfile == NULL && !ID_IS_LINKED(vfont) && BKE_vfont_is_builtin(vfont) == false) {
|
||||
vfont->packedfile = newPackedFile(reports, vfont->name, bmain->name);
|
||||
vfont->packedfile = newPackedFile(reports, vfont->name, BKE_main_blendfile_path(bmain));
|
||||
tot ++;
|
||||
}
|
||||
}
|
||||
|
||||
for (sound = bmain->sound.first; sound; sound = sound->id.next) {
|
||||
if (sound->packedfile == NULL && !ID_IS_LINKED(sound)) {
|
||||
sound->packedfile = newPackedFile(reports, sound->name, bmain->name);
|
||||
sound->packedfile = newPackedFile(reports, sound->name, BKE_main_blendfile_path(bmain));
|
||||
tot++;
|
||||
}
|
||||
}
|
||||
|
@ -542,7 +542,7 @@ int unpackVFont(Main *bmain, ReportList *reports, VFont *vfont, int how)
|
|||
|
||||
if (vfont != NULL) {
|
||||
unpack_generate_paths(vfont->name, (ID *)vfont, absname, localname, sizeof(absname), sizeof(localname));
|
||||
newname = unpackFile(reports, bmain->name, absname, localname, vfont->packedfile, how);
|
||||
newname = unpackFile(reports, BKE_main_blendfile_path(bmain), absname, localname, vfont->packedfile, how);
|
||||
if (newname != NULL) {
|
||||
ret_value = RET_OK;
|
||||
freePackedFile(vfont->packedfile);
|
||||
|
@ -563,7 +563,7 @@ int unpackSound(Main *bmain, ReportList *reports, bSound *sound, int how)
|
|||
|
||||
if (sound != NULL) {
|
||||
unpack_generate_paths(sound->name, (ID *)sound, absname, localname, sizeof(absname), sizeof(localname));
|
||||
newname = unpackFile(reports, bmain->name, absname, localname, sound->packedfile, how);
|
||||
newname = unpackFile(reports, BKE_main_blendfile_path(bmain), absname, localname, sound->packedfile, how);
|
||||
if (newname != NULL) {
|
||||
BLI_strncpy(sound->name, newname, sizeof(sound->name));
|
||||
MEM_freeN(newname);
|
||||
|
@ -591,7 +591,7 @@ int unpackImage(Main *bmain, ReportList *reports, Image *ima, int how)
|
|||
ImagePackedFile *imapf = ima->packedfiles.last;
|
||||
|
||||
unpack_generate_paths(imapf->filepath, (ID *)ima, absname, localname, sizeof(absname), sizeof(localname));
|
||||
newname = unpackFile(reports, bmain->name, absname, localname, imapf->packedfile, how);
|
||||
newname = unpackFile(reports, BKE_main_blendfile_path(bmain), absname, localname, imapf->packedfile, how);
|
||||
|
||||
if (newname != NULL) {
|
||||
ImageView *iv;
|
||||
|
@ -637,7 +637,7 @@ int unpackLibraries(Main *bmain, ReportList *reports)
|
|||
for (lib = bmain->library.first; lib; lib = lib->id.next) {
|
||||
if (lib->packedfile && lib->name[0]) {
|
||||
|
||||
newname = unpackFile(reports, bmain->name, lib->filepath, lib->filepath, lib->packedfile, PF_WRITE_ORIGINAL);
|
||||
newname = unpackFile(reports, BKE_main_blendfile_path(bmain), lib->filepath, lib->filepath, lib->packedfile, PF_WRITE_ORIGINAL);
|
||||
if (newname != NULL) {
|
||||
ret_value = RET_OK;
|
||||
|
||||
|
@ -670,7 +670,7 @@ void packLibraries(Main *bmain, ReportList *reports)
|
|||
|
||||
for (lib = bmain->library.first; lib; lib = lib->id.next)
|
||||
if (lib->packedfile == NULL)
|
||||
lib->packedfile = newPackedFile(reports, lib->name, bmain->name);
|
||||
lib->packedfile = newPackedFile(reports, lib->name, BKE_main_blendfile_path(bmain));
|
||||
}
|
||||
|
||||
void unpackAll(Main *bmain, ReportList *reports, int how)
|
||||
|
|
|
@ -1802,7 +1802,7 @@ static int ptcache_frame_from_filename(const char *filename, const char *ext)
|
|||
static int ptcache_path(PTCacheID *pid, char *filename)
|
||||
{
|
||||
Library *lib = (pid->ob) ? pid->ob->id.lib : NULL;
|
||||
const char *blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: G.main->name;
|
||||
const char *blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: BKE_main_blendfile_path_from_global();
|
||||
size_t i;
|
||||
|
||||
if (pid->cache->flag & PTCACHE_EXTERNAL) {
|
||||
|
|
|
@ -945,11 +945,11 @@ Scene *BKE_scene_set_name(Main *bmain, const char *name)
|
|||
Scene *sce = (Scene *)BKE_libblock_find_name(bmain, ID_SCE, name);
|
||||
if (sce) {
|
||||
BKE_scene_set_background(bmain, sce);
|
||||
printf("Scene switch for render: '%s' in file: '%s'\n", name, bmain->name);
|
||||
printf("Scene switch for render: '%s' in file: '%s'\n", name, BKE_main_blendfile_path(bmain));
|
||||
return sce;
|
||||
}
|
||||
|
||||
printf("Can't find scene: '%s' in file: '%s'\n", name, bmain->name);
|
||||
printf("Can't find scene: '%s' in file: '%s'\n", name, BKE_main_blendfile_path(bmain));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -898,7 +898,7 @@ void BKE_sequence_reload_new_file(Scene *scene, Sequence *seq, const bool lock_r
|
|||
|
||||
BLI_join_dirfile(path, sizeof(path), seq->strip->dir,
|
||||
seq->strip->stripdata->name);
|
||||
BLI_path_abs(path, G.main->name);
|
||||
BLI_path_abs(path, BKE_main_blendfile_path_from_global());
|
||||
|
||||
BKE_sequence_free_anim(seq);
|
||||
|
||||
|
@ -1546,7 +1546,7 @@ static void seq_open_anim_file(Scene *scene, Sequence *seq, bool openfile)
|
|||
|
||||
BLI_join_dirfile(name, sizeof(name),
|
||||
seq->strip->dir, seq->strip->stripdata->name);
|
||||
BLI_path_abs(name, G.main->name);
|
||||
BLI_path_abs(name, BKE_main_blendfile_path_from_global());
|
||||
|
||||
proxy = seq->strip->proxy;
|
||||
|
||||
|
@ -1563,7 +1563,7 @@ static void seq_open_anim_file(Scene *scene, Sequence *seq, bool openfile)
|
|||
else {
|
||||
BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir));
|
||||
}
|
||||
BLI_path_abs(dir, G.main->name);
|
||||
BLI_path_abs(dir, BKE_main_blendfile_path_from_global());
|
||||
}
|
||||
|
||||
if (is_multiview && seq->views_format == R_IMF_VIEWS_INDIVIDUAL) {
|
||||
|
@ -1691,7 +1691,7 @@ static bool seq_proxy_get_fname(Editing *ed, Sequence *seq, int cfra, int render
|
|||
return false;
|
||||
}
|
||||
BLI_path_append(dir, sizeof(dir), fname);
|
||||
BLI_path_abs(name, G.main->name);
|
||||
BLI_path_abs(name, BKE_main_blendfile_path_from_global());
|
||||
}
|
||||
else if ((proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_DIR) && (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE)) {
|
||||
BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir));
|
||||
|
@ -1723,7 +1723,7 @@ static bool seq_proxy_get_fname(Editing *ed, Sequence *seq, int cfra, int render
|
|||
{
|
||||
char fname[FILE_MAXFILE];
|
||||
BLI_join_dirfile(fname, PROXY_MAXFILE, dir, proxy->file);
|
||||
BLI_path_abs(fname, G.main->name);
|
||||
BLI_path_abs(fname, BKE_main_blendfile_path_from_global());
|
||||
if (suffix[0] != '\0') {
|
||||
/* TODO(sergey): This will actually append suffix after extension
|
||||
* which is weird but how was originally coded in multiview branch.
|
||||
|
@ -1749,7 +1749,7 @@ static bool seq_proxy_get_fname(Editing *ed, Sequence *seq, int cfra, int render
|
|||
BLI_snprintf(name, PROXY_MAXFILE, "%s/proxy_misc/%d/####%s", dir, render_size, suffix);
|
||||
}
|
||||
|
||||
BLI_path_abs(name, G.main->name);
|
||||
BLI_path_abs(name, BKE_main_blendfile_path_from_global());
|
||||
BLI_path_frame(name, frameno, 0);
|
||||
|
||||
strcat(name, ".jpg");
|
||||
|
@ -1894,7 +1894,7 @@ static bool seq_proxy_multiview_context_invalid(Sequence *seq, Scene *scene, con
|
|||
char path[FILE_MAX];
|
||||
BLI_join_dirfile(path, sizeof(path), seq->strip->dir,
|
||||
seq->strip->stripdata->name);
|
||||
BLI_path_abs(path, G.main->name);
|
||||
BLI_path_abs(path, BKE_main_blendfile_path_from_global());
|
||||
BKE_scene_multiview_view_prefix_get(scene, path, prefix, &ext);
|
||||
}
|
||||
else {
|
||||
|
@ -2846,7 +2846,7 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context, Sequence *seq
|
|||
|
||||
if (s_elem) {
|
||||
BLI_join_dirfile(name, sizeof(name), seq->strip->dir, s_elem->name);
|
||||
BLI_path_abs(name, G.main->name);
|
||||
BLI_path_abs(name, BKE_main_blendfile_path_from_global());
|
||||
}
|
||||
|
||||
flag = IB_rect | IB_metadata;
|
||||
|
@ -5151,7 +5151,7 @@ void BKE_sequence_init_colorspace(Sequence *seq)
|
|||
ImBuf *ibuf;
|
||||
|
||||
BLI_join_dirfile(name, sizeof(name), seq->strip->dir, seq->strip->stripdata->name);
|
||||
BLI_path_abs(name, G.main->name);
|
||||
BLI_path_abs(name, BKE_main_blendfile_path_from_global());
|
||||
|
||||
/* initialize input color space */
|
||||
if (seq->type == SEQ_TYPE_IMAGE) {
|
||||
|
@ -5319,6 +5319,7 @@ static void seq_anim_add_suffix(Scene *scene, struct anim *anim, const int view_
|
|||
|
||||
Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C); /* only for sound */
|
||||
char path[sizeof(seq_load->path)];
|
||||
|
||||
|
@ -5333,7 +5334,7 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad
|
|||
int i;
|
||||
|
||||
BLI_strncpy(path, seq_load->path, sizeof(path));
|
||||
BLI_path_abs(path, G.main->name);
|
||||
BLI_path_abs(path, BKE_main_blendfile_path(bmain));
|
||||
|
||||
anim_arr = MEM_callocN(sizeof(struct anim *) * totfiles, "Video files");
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ bSound *BKE_sound_new_file(struct Main *bmain, const char *filepath)
|
|||
|
||||
BLI_strncpy(str, filepath, sizeof(str));
|
||||
|
||||
path = /*bmain ? bmain->name :*/ G.main->name;
|
||||
path = BKE_main_blendfile_path(bmain);
|
||||
|
||||
BLI_path_abs(str, path);
|
||||
|
||||
|
@ -96,7 +96,7 @@ bSound *BKE_sound_new_file_exists_ex(struct Main *bmain, const char *filepath, b
|
|||
char str[FILE_MAX], strtest[FILE_MAX];
|
||||
|
||||
BLI_strncpy(str, filepath, sizeof(str));
|
||||
BLI_path_abs(str, bmain->name);
|
||||
BLI_path_abs(str, BKE_main_blendfile_path(bmain));
|
||||
|
||||
/* first search an identical filepath */
|
||||
for (sound = bmain->sound.first; sound; sound = sound->id.next) {
|
||||
|
|
|
@ -388,7 +388,7 @@ bool BKE_text_reload(Text *text)
|
|||
}
|
||||
|
||||
BLI_strncpy(filepath_abs, text->name, FILE_MAX);
|
||||
BLI_path_abs(filepath_abs, G.main->name);
|
||||
BLI_path_abs(filepath_abs, BKE_main_blendfile_path_from_global());
|
||||
|
||||
buffer = BLI_file_read_text_as_mem(filepath_abs, 0, &buffer_len);
|
||||
if (buffer == NULL) {
|
||||
|
@ -557,7 +557,7 @@ int BKE_text_file_modified_check(Text *text)
|
|||
return 0;
|
||||
|
||||
BLI_strncpy(file, text->name, FILE_MAX);
|
||||
BLI_path_abs(file, G.main->name);
|
||||
BLI_path_abs(file, BKE_main_blendfile_path_from_global());
|
||||
|
||||
if (!BLI_exists(file))
|
||||
return 2;
|
||||
|
@ -585,7 +585,7 @@ void BKE_text_file_modified_ignore(Text *text)
|
|||
if (!text->name) return;
|
||||
|
||||
BLI_strncpy(file, text->name, FILE_MAX);
|
||||
BLI_path_abs(file, G.main->name);
|
||||
BLI_path_abs(file, BKE_main_blendfile_path_from_global());
|
||||
|
||||
if (!BLI_exists(file)) return;
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ static void filepath_avi(char *string, RenderData *rd, bool preview, const char
|
|||
}
|
||||
|
||||
strcpy(string, rd->pic);
|
||||
BLI_path_abs(string, G.main->name);
|
||||
BLI_path_abs(string, BKE_main_blendfile_path_from_global());
|
||||
|
||||
BLI_make_existing_file(string);
|
||||
|
||||
|
|
|
@ -1127,7 +1127,7 @@ static void ffmpeg_filepath_get(FFMpegContext *context, char *string, RenderData
|
|||
}
|
||||
|
||||
strcpy(string, rd->pic);
|
||||
BLI_path_abs(string, G.main->name);
|
||||
BLI_path_abs(string, BKE_main_blendfile_path_from_global());
|
||||
|
||||
BLI_make_existing_file(string);
|
||||
|
||||
|
|
|
@ -8489,11 +8489,11 @@ static BHead *read_global(BlendFileData *bfd, FileData *fd, BHead *bhead)
|
|||
if (bfd->filename[0] == 0) {
|
||||
if (fd->fileversion < 265 || (fd->fileversion == 265 && fg->subversion < 1))
|
||||
if ((G.fileflags & G_FILE_RECOVER)==0)
|
||||
BLI_strncpy(bfd->filename, bfd->main->name, sizeof(bfd->filename));
|
||||
BLI_strncpy(bfd->filename, BKE_main_blendfile_path(bfd->main), sizeof(bfd->filename));
|
||||
|
||||
/* early 2.50 version patch - filename not in FileGlobal struct at all */
|
||||
if (fd->fileversion <= 250)
|
||||
BLI_strncpy(bfd->filename, bfd->main->name, sizeof(bfd->filename));
|
||||
BLI_strncpy(bfd->filename, BKE_main_blendfile_path(bfd->main), sizeof(bfd->filename));
|
||||
}
|
||||
|
||||
if (G.fileflags & G_FILE_RECOVER)
|
||||
|
@ -10319,7 +10319,7 @@ static Main *library_link_begin(Main *mainvar, FileData **fd, const char *filepa
|
|||
blo_split_main((*fd)->mainlist, mainvar);
|
||||
|
||||
/* which one do we need? */
|
||||
mainl = blo_find_main(*fd, filepath, G.main->name);
|
||||
mainl = blo_find_main(*fd, filepath, BKE_main_blendfile_path(mainvar));
|
||||
|
||||
/* needed for do_version */
|
||||
mainl->versionfile = (*fd)->fileversion;
|
||||
|
@ -10394,7 +10394,7 @@ static void library_link_end(Main *mainl, FileData **fd, const short flag, Main
|
|||
BLI_strncpy(curlib->name, curlib->filepath, sizeof(curlib->name));
|
||||
|
||||
/* uses current .blend file as reference */
|
||||
BLI_path_rel(curlib->name, G.main->name);
|
||||
BLI_path_rel(curlib->name, BKE_main_blendfile_path_from_global());
|
||||
}
|
||||
|
||||
blo_join_main((*fd)->mainlist);
|
||||
|
@ -10424,7 +10424,7 @@ static void library_link_end(Main *mainl, FileData **fd, const short flag, Main
|
|||
BKE_main_id_tag_all(mainvar, LIB_TAG_NEW, false);
|
||||
|
||||
lib_verify_nodetree(mainvar, false);
|
||||
fix_relpaths_library(G.main->name, mainvar); /* make all relative paths, relative to the open blend file */
|
||||
fix_relpaths_library(BKE_main_blendfile_path(mainvar), mainvar); /* make all relative paths, relative to the open blend file */
|
||||
|
||||
/* Give a base to loose objects and collections.
|
||||
* Only directly linked objects & collections are instantiated by `BLO_library_link_named_part_ex()` & co,
|
||||
|
@ -10545,7 +10545,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
|
|||
while (fd == NULL) {
|
||||
char newlib_path[FILE_MAX] = {0};
|
||||
printf("Missing library...'\n");
|
||||
printf(" current file: %s\n", G.main->name);
|
||||
printf(" current file: %s\n", BKE_main_blendfile_path_from_global());
|
||||
printf(" absolute lib: %s\n", mainptr->curlib->filepath);
|
||||
printf(" relative lib: %s\n", mainptr->curlib->name);
|
||||
printf(" enter a new path:\n");
|
||||
|
@ -10553,7 +10553,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
|
|||
if (scanf("%1023s", newlib_path) > 0) { /* Warning, keep length in sync with FILE_MAX! */
|
||||
BLI_strncpy(mainptr->curlib->name, newlib_path, sizeof(mainptr->curlib->name));
|
||||
BLI_strncpy(mainptr->curlib->filepath, newlib_path, sizeof(mainptr->curlib->filepath));
|
||||
BLI_cleanup_path(G.main->name, mainptr->curlib->filepath);
|
||||
BLI_cleanup_path(BKE_main_blendfile_path_from_global(), mainptr->curlib->filepath);
|
||||
|
||||
fd = blo_openblenderfile(mainptr->curlib->filepath, basefd->reports);
|
||||
|
||||
|
|
|
@ -169,14 +169,14 @@ void blo_do_version_old_trackto_to_constraints(struct Object *ob);
|
|||
void blo_do_versions_view3d_split_250(struct View3D *v3d, struct ListBase *regions);
|
||||
void blo_do_versions_key_uidgen(struct Key *key);
|
||||
|
||||
void blo_do_versions_pre250(struct FileData *fd, struct Library *lib, struct Main *main);
|
||||
void blo_do_versions_250(struct FileData *fd, struct Library *lib, struct Main *main);
|
||||
void blo_do_versions_260(struct FileData *fd, struct Library *lib, struct Main *main);
|
||||
void blo_do_versions_270(struct FileData *fd, struct Library *lib, struct Main *main);
|
||||
void blo_do_versions_280(struct FileData *fd, struct Library *lib, struct Main *main);
|
||||
void blo_do_versions_pre250(struct FileData *fd, struct Library *lib, struct Main *bmain);
|
||||
void blo_do_versions_250(struct FileData *fd, struct Library *lib, struct Main *bmain);
|
||||
void blo_do_versions_260(struct FileData *fd, struct Library *lib, struct Main *bmain);
|
||||
void blo_do_versions_270(struct FileData *fd, struct Library *lib, struct Main *bmain);
|
||||
void blo_do_versions_280(struct FileData *fd, struct Library *lib, struct Main *bmain);
|
||||
|
||||
void do_versions_after_linking_270(struct Main *main);
|
||||
void do_versions_after_linking_280(struct Main *main);
|
||||
void do_versions_after_linking_270(struct Main *bmain);
|
||||
void do_versions_after_linking_280(struct Main *bmain);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ void memfile_chunk_add(
|
|||
struct Main *BLO_memfile_main_get(struct MemFile *memfile, struct Main *oldmain, struct Scene **r_scene)
|
||||
{
|
||||
struct Main *bmain_undo = NULL;
|
||||
BlendFileData *bfd = BLO_read_from_memfile(oldmain, oldmain->name, memfile, NULL, BLO_READ_SKIP_NONE);
|
||||
BlendFileData *bfd = BLO_read_from_memfile(oldmain, BKE_main_blendfile_path(oldmain), memfile, NULL, BLO_READ_SKIP_NONE);
|
||||
|
||||
if (bfd) {
|
||||
bmain_undo = bfd->main;
|
||||
|
|
|
@ -641,11 +641,11 @@ static void do_versions_socket_default_value_259(bNodeSocket *sock)
|
|||
}
|
||||
}
|
||||
|
||||
void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
||||
void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
|
||||
{
|
||||
/* WATCH IT!!!: pointers from libdata have not been converted */
|
||||
|
||||
if (main->versionfile < 250) {
|
||||
if (bmain->versionfile < 250) {
|
||||
bScreen *screen;
|
||||
Scene *scene;
|
||||
Base *base;
|
||||
|
@ -663,22 +663,22 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
bSound *sound;
|
||||
Sequence *seq;
|
||||
|
||||
for (sound = main->sound.first; sound; sound = sound->id.next) {
|
||||
for (sound = bmain->sound.first; sound; sound = sound->id.next) {
|
||||
if (sound->newpackedfile) {
|
||||
sound->packedfile = sound->newpackedfile;
|
||||
sound->newpackedfile = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for (scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
if (scene->ed && scene->ed->seqbasep) {
|
||||
SEQ_BEGIN (scene->ed, seq)
|
||||
{
|
||||
if (seq->type == SEQ_TYPE_SOUND_HD) {
|
||||
char str[FILE_MAX];
|
||||
BLI_join_dirfile(str, sizeof(str), seq->strip->dir, seq->strip->stripdata->name);
|
||||
BLI_path_abs(str, main->name);
|
||||
seq->sound = BKE_sound_new_file(main, str);
|
||||
BLI_path_abs(str, BKE_main_blendfile_path(bmain));
|
||||
seq->sound = BKE_sound_new_file(bmain, str);
|
||||
}
|
||||
#define SEQ_USE_PROXY_CUSTOM_DIR (1 << 19)
|
||||
#define SEQ_USE_PROXY_CUSTOM_FILE (1 << 21)
|
||||
|
@ -695,21 +695,21 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
for (screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
do_versions_windowmanager_2_50(screen);
|
||||
do_versions_gpencil_2_50(main, screen);
|
||||
do_versions_gpencil_2_50(bmain, screen);
|
||||
}
|
||||
|
||||
/* shader, composite and texture node trees have id.name empty, put something in
|
||||
* to have them show in RNA viewer and accessible otherwise.
|
||||
*/
|
||||
for (ma = main->mat.first; ma; ma = ma->id.next) {
|
||||
for (ma = bmain->mat.first; ma; ma = ma->id.next) {
|
||||
if (ma->nodetree && ma->nodetree->id.name[0] == '\0')
|
||||
strcpy(ma->nodetree->id.name, "NTShader Nodetree");
|
||||
}
|
||||
|
||||
/* and composite trees */
|
||||
for (sce = main->scene.first; sce; sce = sce->id.next) {
|
||||
for (sce = bmain->scene.first; sce; sce = sce->id.next) {
|
||||
if (sce->nodetree && sce->nodetree->id.name[0] == '\0')
|
||||
strcpy(sce->nodetree->id.name, "NTCompositing Nodetree");
|
||||
|
||||
|
@ -729,7 +729,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
|
||||
/* and texture trees */
|
||||
for (tx = main->tex.first; tx; tx = tx->id.next) {
|
||||
for (tx = bmain->tex.first; tx; tx = tx->id.next) {
|
||||
bNode *node;
|
||||
|
||||
if (tx->nodetree) {
|
||||
|
@ -744,12 +744,12 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
|
||||
/* copy standard draw flag to meshes(used to be global, is not available here) */
|
||||
for (me = main->mesh.first; me; me = me->id.next) {
|
||||
for (me = bmain->mesh.first; me; me = me->id.next) {
|
||||
me->drawflag = ME_DRAWEDGES|ME_DRAWFACES|ME_DRAWCREASES;
|
||||
}
|
||||
|
||||
/* particle draw and render types */
|
||||
for (part = main->particle.first; part; part = part->id.next) {
|
||||
for (part = bmain->particle.first; part; part = part->id.next) {
|
||||
if (part->draw_as) {
|
||||
if (part->draw_as == PART_DRAW_DOT) {
|
||||
part->ren_as = PART_DRAW_HALO;
|
||||
|
@ -768,7 +768,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
|
||||
/* set old pointcaches to have disk cache flag */
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
|
||||
//BKE_ptcache_ids_from_object(&pidlist, ob);
|
||||
|
||||
|
@ -779,7 +779,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
|
||||
/* type was a mixed flag & enum. move the 2d flag elsewhere */
|
||||
for (cu = main->curve.first; cu; cu = cu->id.next) {
|
||||
for (cu = bmain->curve.first; cu; cu = cu->id.next) {
|
||||
Nurb *nu;
|
||||
|
||||
for (nu = cu->nurb.first; nu; nu = nu->next) {
|
||||
|
@ -789,7 +789,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 1)) {
|
||||
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 1)) {
|
||||
Object *ob;
|
||||
Tex *tex;
|
||||
Scene *sce;
|
||||
|
@ -797,7 +797,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
//PTCacheID *pid;
|
||||
//ListBase pidlist;
|
||||
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
//BKE_ptcache_ids_from_object(&pidlist, ob);
|
||||
|
||||
//for (pid = pidlist.first; pid; pid = pid->next) {
|
||||
|
@ -831,12 +831,12 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
|
||||
/* texture filter */
|
||||
for (tex = main->tex.first; tex; tex = tex->id.next) {
|
||||
for (tex = bmain->tex.first; tex; tex = tex->id.next) {
|
||||
if (tex->afmax == 0)
|
||||
tex->afmax = 8;
|
||||
}
|
||||
|
||||
for (sce = main->scene.first; sce; sce = sce->id.next) {
|
||||
for (sce = bmain->scene.first; sce; sce = sce->id.next) {
|
||||
ts = sce->toolsettings;
|
||||
if (!ts->uv_selectmode || ts->vgroup_weight == 0.0f) {
|
||||
ts->selectmode = SCE_SELECT_VERTEX;
|
||||
|
@ -854,26 +854,26 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 2)) {
|
||||
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 2)) {
|
||||
Object *ob;
|
||||
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
if (ob->flag & 8192) // OB_POSEMODE = 8192
|
||||
ob->mode |= OB_MODE_POSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 4)) {
|
||||
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 4)) {
|
||||
Scene *sce;
|
||||
Object *ob;
|
||||
ParticleSettings *part;
|
||||
bool do_gravity = false;
|
||||
|
||||
for (sce = main->scene.first; sce; sce = sce->id.next)
|
||||
for (sce = bmain->scene.first; sce; sce = sce->id.next)
|
||||
if (sce->unit.scale_length == 0.0f)
|
||||
sce->unit.scale_length = 1.0f;
|
||||
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
/* fluid-sim stuff */
|
||||
FluidsimModifierData *fluidmd = (FluidsimModifierData *) modifiers_findByType(ob, eModifierType_Fluidsim);
|
||||
if (fluidmd)
|
||||
|
@ -883,7 +883,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
ob->rotmode = ROT_MODE_EUL;
|
||||
}
|
||||
|
||||
for (sce = main->scene.first; sce; sce = sce->id.next) {
|
||||
for (sce = bmain->scene.first; sce; sce = sce->id.next) {
|
||||
if (sce->audio.main == 0.0f)
|
||||
sce->audio.main = 1.0f;
|
||||
|
||||
|
@ -895,7 +895,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
|
||||
/* Add default gravity to scenes */
|
||||
for (sce = main->scene.first; sce; sce = sce->id.next) {
|
||||
for (sce = bmain->scene.first; sce; sce = sce->id.next) {
|
||||
if ((sce->physics_settings.flag & PHYS_GLOBAL_GRAVITY) == 0 &&
|
||||
is_zero_v3(sce->physics_settings.gravity))
|
||||
{
|
||||
|
@ -908,11 +908,11 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
|
||||
/* Assign proper global gravity weights for dynamics (only z-coordinate is taken into account) */
|
||||
if (do_gravity) {
|
||||
for (part = main->particle.first; part; part = part->id.next)
|
||||
for (part = bmain->particle.first; part; part = part->id.next)
|
||||
part->effector_weights->global_gravity = part->acc[2]/-9.81f;
|
||||
}
|
||||
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
ModifierData *md;
|
||||
|
||||
if (do_gravity) {
|
||||
|
@ -941,11 +941,11 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 6)) {
|
||||
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 6)) {
|
||||
Object *ob;
|
||||
|
||||
/* New variables for axis-angle rotations and/or quaternion rotations were added, and need proper initialization */
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
/* new variables for all objects */
|
||||
ob->quat[0] = 1.0f;
|
||||
ob->rotAxis[1] = 1.0f;
|
||||
|
@ -962,7 +962,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 7)) {
|
||||
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 7)) {
|
||||
Mesh *me;
|
||||
Nurb *nu;
|
||||
Lattice *lt;
|
||||
|
@ -974,7 +974,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
/* shape keys are no longer applied to the mesh itself, but rather
|
||||
* to the derivedmesh/displist, so here we ensure that the basis
|
||||
* shape key is always set in the mesh coordinates. */
|
||||
for (me = main->mesh.first; me; me = me->id.next) {
|
||||
for (me = bmain->mesh.first; me; me = me->id.next) {
|
||||
if ((key = blo_do_versions_newlibadr(fd, lib, me->key)) && key->refkey) {
|
||||
data = key->refkey->data;
|
||||
tot = MIN2(me->totvert, key->refkey->totelem);
|
||||
|
@ -984,7 +984,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
for (lt = main->latt.first; lt; lt = lt->id.next) {
|
||||
for (lt = bmain->latt.first; lt; lt = lt->id.next) {
|
||||
if ((key = blo_do_versions_newlibadr(fd, lib, lt->key)) && key->refkey) {
|
||||
data = key->refkey->data;
|
||||
tot = MIN2(lt->pntsu*lt->pntsv*lt->pntsw, key->refkey->totelem);
|
||||
|
@ -994,7 +994,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
for (cu = main->curve.first; cu; cu = cu->id.next) {
|
||||
for (cu = bmain->curve.first; cu; cu = cu->id.next) {
|
||||
if ((key = blo_do_versions_newlibadr(fd, lib, cu->key)) && key->refkey) {
|
||||
data = key->refkey->data;
|
||||
|
||||
|
@ -1022,9 +1022,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 8)) {
|
||||
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 8)) {
|
||||
{
|
||||
Scene *sce = main->scene.first;
|
||||
Scene *sce = bmain->scene.first;
|
||||
while (sce) {
|
||||
if (sce->r.frame_step == 0)
|
||||
sce->r.frame_step = 1;
|
||||
|
@ -1039,7 +1039,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
|
||||
{
|
||||
/* ensure all nodes have unique names */
|
||||
bNodeTree *ntree = main->nodetree.first;
|
||||
bNodeTree *ntree = bmain->nodetree.first;
|
||||
while (ntree) {
|
||||
bNode *node = ntree->nodes.first;
|
||||
|
||||
|
@ -1053,7 +1053,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
|
||||
{
|
||||
Object *ob = main->object.first;
|
||||
Object *ob = bmain->object.first;
|
||||
while (ob) {
|
||||
/* shaded mode disabled for now */
|
||||
if (ob->dt == OB_MATERIAL)
|
||||
|
@ -1067,7 +1067,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
ScrArea *sa;
|
||||
SpaceLink *sl;
|
||||
|
||||
for (screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
for (sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_VIEW3D) {
|
||||
|
@ -1081,10 +1081,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
|
||||
/* only convert old 2.50 files with color management */
|
||||
if (main->versionfile == 250) {
|
||||
Scene *sce = main->scene.first;
|
||||
Material *ma = main->mat.first;
|
||||
Tex *tex = main->tex.first;
|
||||
if (bmain->versionfile == 250) {
|
||||
Scene *sce = bmain->scene.first;
|
||||
Material *ma = bmain->mat.first;
|
||||
Tex *tex = bmain->tex.first;
|
||||
int i, convert = 0;
|
||||
|
||||
/* convert to new color management system:
|
||||
|
@ -1120,20 +1120,20 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 9)) {
|
||||
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 9)) {
|
||||
Scene *sce;
|
||||
Mesh *me;
|
||||
Object *ob;
|
||||
|
||||
for (sce = main->scene.first; sce; sce = sce->id.next)
|
||||
for (sce = bmain->scene.first; sce; sce = sce->id.next)
|
||||
if (!sce->toolsettings->particle.selectmode)
|
||||
sce->toolsettings->particle.selectmode = SCE_SELECT_PATH;
|
||||
|
||||
if (main->versionfile == 250 && main->subversionfile > 1) {
|
||||
for (me = main->mesh.first; me; me = me->id.next)
|
||||
if (bmain->versionfile == 250 && bmain->subversionfile > 1) {
|
||||
for (me = bmain->mesh.first; me; me = me->id.next)
|
||||
multires_load_old_250(me);
|
||||
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
MultiresModifierData *mmd = (MultiresModifierData *) modifiers_findByType(ob, eModifierType_Multires);
|
||||
|
||||
if (mmd) {
|
||||
|
@ -1146,11 +1146,11 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 10)) {
|
||||
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 10)) {
|
||||
Object *ob;
|
||||
|
||||
/* properly initialize hair clothsim data on old files */
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
ModifierData *md;
|
||||
for (md = ob->modifiers.first; md; md = md->next) {
|
||||
if (md->type == eModifierType_Cloth) {
|
||||
|
@ -1163,14 +1163,14 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
|
||||
/* fix bad area setup in subversion 10 */
|
||||
if (main->versionfile == 250 && main->subversionfile == 10) {
|
||||
if (bmain->versionfile == 250 && bmain->subversionfile == 10) {
|
||||
/* fix for new view type in sequencer */
|
||||
bScreen *screen;
|
||||
ScrArea *sa;
|
||||
SpaceLink *sl;
|
||||
|
||||
/* remove all preview window in wrong spaces */
|
||||
for (screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
for (sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype != SPACE_SEQ) {
|
||||
|
@ -1200,14 +1200,14 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 11)) {
|
||||
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 11)) {
|
||||
{
|
||||
/* fix for new view type in sequencer */
|
||||
bScreen *screen;
|
||||
ScrArea *sa;
|
||||
SpaceLink *sl;
|
||||
|
||||
for (screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
for (sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_SEQ) {
|
||||
|
@ -1243,12 +1243,12 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 12)) {
|
||||
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 12)) {
|
||||
Object *ob;
|
||||
Brush *brush;
|
||||
|
||||
/* anim viz changes */
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
/* initialize object defaults */
|
||||
animviz_settings_init(&ob->avs);
|
||||
|
||||
|
@ -1323,19 +1323,19 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
|
||||
/* brush texture changes */
|
||||
for (brush = main->brush.first; brush; brush = brush->id.next) {
|
||||
for (brush = bmain->brush.first; brush; brush = brush->id.next) {
|
||||
BKE_texture_mtex_default(&brush->mtex);
|
||||
BKE_texture_mtex_default(&brush->mask_mtex);
|
||||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 13)) {
|
||||
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 13)) {
|
||||
/* NOTE: if you do more conversion, be sure to do it outside of this and
|
||||
* increase subversion again, otherwise it will not be correct */
|
||||
Object *ob;
|
||||
|
||||
/* convert degrees to radians for internal use */
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
bPoseChannel *pchan;
|
||||
|
||||
do_version_constraints_radians_degrees_250(&ob->constraints);
|
||||
|
@ -1355,13 +1355,13 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 14)) {
|
||||
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 14)) {
|
||||
/* fix for bad View2D extents for Animation Editors */
|
||||
bScreen *screen;
|
||||
ScrArea *sa;
|
||||
SpaceLink *sl;
|
||||
|
||||
for (screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
for (sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
ListBase *regionbase;
|
||||
|
@ -1385,12 +1385,12 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 17)) {
|
||||
if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 17)) {
|
||||
Scene *sce;
|
||||
Sequence *seq;
|
||||
|
||||
/* initialize to sane default so toggling on border shows something */
|
||||
for (sce = main->scene.first; sce; sce = sce->id.next) {
|
||||
for (sce = bmain->scene.first; sce; sce = sce->id.next) {
|
||||
if (sce->r.border.xmin == 0.0f && sce->r.border.ymin == 0.0f &&
|
||||
sce->r.border.xmax == 0.0f && sce->r.border.ymax == 0.0f)
|
||||
{
|
||||
|
@ -1411,7 +1411,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
|
||||
/* particle brush strength factor was changed from int to float */
|
||||
for (sce = main->scene.first; sce; sce = sce->id.next) {
|
||||
for (sce = bmain->scene.first; sce; sce = sce->id.next) {
|
||||
ParticleEditSettings *pset = &sce->toolsettings->particle;
|
||||
int a;
|
||||
|
||||
|
@ -1425,7 +1425,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
ScrArea *sa;
|
||||
SpaceLink *sl;
|
||||
|
||||
for (screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
for (sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_SEQ) {
|
||||
|
@ -1454,14 +1454,14 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
} /* sequencer changes */
|
||||
}
|
||||
|
||||
if (main->versionfile <= 251) { /* 2.5.1 had no subversions */
|
||||
if (bmain->versionfile <= 251) { /* 2.5.1 had no subversions */
|
||||
bScreen *sc;
|
||||
|
||||
/* Blender 2.5.2 - subversion 0 introduced a new setting: V3D_RENDER_OVERRIDE.
|
||||
* This bit was used in the past for V3D_TRANSFORM_SNAP, which is now deprecated.
|
||||
* Here we clear it for old files so they don't come in with V3D_RENDER_OVERRIDE set,
|
||||
* which would cause cameras, lamps, etc to become invisible */
|
||||
for (sc = main->screen.first; sc; sc = sc->id.next) {
|
||||
for (sc = bmain->screen.first; sc; sc = sc->id.next) {
|
||||
ScrArea *sa;
|
||||
for (sa = sc->areabase.first; sa; sa = sa->next) {
|
||||
SpaceLink *sl;
|
||||
|
@ -1475,19 +1475,19 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 252 || (main->versionfile == 252 && main->subversionfile < 1)) {
|
||||
if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 1)) {
|
||||
Brush *brush;
|
||||
Object *ob;
|
||||
Scene *scene;
|
||||
bNodeTree *ntree;
|
||||
|
||||
for (brush = main->brush.first; brush; brush = brush->id.next) {
|
||||
for (brush = bmain->brush.first; brush; brush = brush->id.next) {
|
||||
if (brush->curve)
|
||||
brush->curve->preset = CURVE_PRESET_SMOOTH;
|
||||
}
|
||||
|
||||
/* properly initialize active flag for fluidsim modifiers */
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
ModifierData *md;
|
||||
for (md = ob->modifiers.first; md; md = md->next) {
|
||||
if (md->type == eModifierType_Fluidsim) {
|
||||
|
@ -1499,7 +1499,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
|
||||
/* adjustment to color balance node values */
|
||||
for (scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
if (scene->nodetree) {
|
||||
bNode *node = scene->nodetree->nodes.first;
|
||||
|
||||
|
@ -1515,7 +1515,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
/* check inside node groups too */
|
||||
for (ntree = main->nodetree.first; ntree; ntree = ntree->id.next) {
|
||||
for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next) {
|
||||
bNode *node = ntree->nodes.first;
|
||||
|
||||
while (node) {
|
||||
|
@ -1532,18 +1532,18 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
|
||||
/* old-track -> constraints (this time we're really doing it!) */
|
||||
if (main->versionfile < 252 || (main->versionfile == 252 && main->subversionfile < 2)) {
|
||||
if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 2)) {
|
||||
Object *ob;
|
||||
|
||||
for (ob = main->object.first; ob; ob = ob->id.next)
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next)
|
||||
blo_do_version_old_trackto_to_constraints(ob);
|
||||
}
|
||||
|
||||
if (main->versionfile < 252 || (main->versionfile == 252 && main->subversionfile < 5)) {
|
||||
if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 5)) {
|
||||
bScreen *sc;
|
||||
|
||||
/* Image editor scopes */
|
||||
for (sc = main->screen.first; sc; sc = sc->id.next) {
|
||||
for (sc = bmain->screen.first; sc; sc = sc->id.next) {
|
||||
ScrArea *sa;
|
||||
|
||||
for (sa = sc->areabase.first; sa; sa = sa->next) {
|
||||
|
@ -1559,14 +1559,14 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 253) {
|
||||
if (bmain->versionfile < 253) {
|
||||
Object *ob;
|
||||
Scene *scene;
|
||||
bScreen *sc;
|
||||
Tex *tex;
|
||||
Brush *brush;
|
||||
|
||||
for (sc = main->screen.first; sc; sc = sc->id.next) {
|
||||
for (sc = bmain->screen.first; sc; sc = sc->id.next) {
|
||||
ScrArea *sa;
|
||||
for (sa = sc->areabase.first; sa; sa = sa->next) {
|
||||
SpaceLink *sl;
|
||||
|
@ -1600,10 +1600,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
do_version_mdef_250(main);
|
||||
do_version_mdef_250(bmain);
|
||||
|
||||
/* parent type to modifier */
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
if (ob->parent) {
|
||||
Object *parent = (Object *) blo_do_versions_newlibadr(fd, lib, ob->parent);
|
||||
if (parent) { /* parent may not be in group */
|
||||
|
@ -1638,7 +1638,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
|
||||
/* initialize scene active layer */
|
||||
for (scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
int i;
|
||||
for (i = 0; i < 20; i++) {
|
||||
if (scene->lay & (1<<i)) {
|
||||
|
@ -1648,7 +1648,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
for (tex = main->tex.first; tex; tex = tex->id.next) {
|
||||
for (tex = bmain->tex.first; tex; tex = tex->id.next) {
|
||||
/* if youre picky, this isn't correct until we do a version bump
|
||||
* since you could set saturation to be 0.0*/
|
||||
if (tex->saturation == 0.0f)
|
||||
|
@ -1657,12 +1657,12 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
|
||||
{
|
||||
Curve *cu;
|
||||
for (cu = main->curve.first; cu; cu = cu->id.next) {
|
||||
for (cu = bmain->curve.first; cu; cu = cu->id.next) {
|
||||
cu->smallcaps_scale = 0.75f;
|
||||
}
|
||||
}
|
||||
|
||||
for (scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
if (scene) {
|
||||
Sequence *seq;
|
||||
SEQ_BEGIN (scene->ed, seq)
|
||||
|
@ -1677,7 +1677,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
|
||||
/* GSOC 2010 Sculpt - New settings for Brush */
|
||||
|
||||
for (brush = main->brush.first; brush; brush = brush->id.next) {
|
||||
for (brush = bmain->brush.first; brush; brush = brush->id.next) {
|
||||
/* Sanity Check */
|
||||
|
||||
/* infinite number of dabs */
|
||||
|
@ -1721,7 +1721,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
brush->rate = 0.1f;
|
||||
|
||||
/* New Settings */
|
||||
if (main->versionfile < 252 || (main->versionfile == 252 && main->subversionfile < 5)) {
|
||||
if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 5)) {
|
||||
brush->flag |= BRUSH_SPACE_ATTEN; // explicitly enable adaptive space
|
||||
|
||||
/* spacing was originally in pixels, convert it to percentage for new version
|
||||
|
@ -1751,9 +1751,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
|
||||
/* GSOC Sculpt 2010 - Sanity check on Sculpt/Paint settings */
|
||||
if (main->versionfile < 253) {
|
||||
if (bmain->versionfile < 253) {
|
||||
Scene *sce;
|
||||
for (sce = main->scene.first; sce; sce = sce->id.next) {
|
||||
for (sce = bmain->scene.first; sce; sce = sce->id.next) {
|
||||
if (sce->toolsettings->sculpt_paint_unified_alpha == 0)
|
||||
sce->toolsettings->sculpt_paint_unified_alpha = 0.5f;
|
||||
|
||||
|
@ -1765,10 +1765,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 253 || (main->versionfile == 253 && main->subversionfile < 1)) {
|
||||
if (bmain->versionfile < 253 || (bmain->versionfile == 253 && bmain->subversionfile < 1)) {
|
||||
Object *ob;
|
||||
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
ModifierData *md;
|
||||
|
||||
for (md = ob->modifiers.first; md; md = md->next) {
|
||||
|
@ -1788,7 +1788,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
/* for now just add it to all flow objects in the scene */
|
||||
{
|
||||
Object *ob2;
|
||||
for (ob2 = main->object.first; ob2; ob2 = ob2->id.next) {
|
||||
for (ob2 = bmain->object.first; ob2; ob2 = ob2->id.next) {
|
||||
ModifierData *md2;
|
||||
for (md2 = ob2->modifiers.first; md2; md2 = md2->next) {
|
||||
if (md2->type == eModifierType_Smoke) {
|
||||
|
@ -1811,17 +1811,17 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 255 || (main->versionfile == 255 && main->subversionfile < 1)) {
|
||||
if (bmain->versionfile < 255 || (bmain->versionfile == 255 && bmain->subversionfile < 1)) {
|
||||
Brush *br;
|
||||
ParticleSettings *part;
|
||||
bScreen *sc;
|
||||
|
||||
for (br = main->brush.first; br; br = br->id.next) {
|
||||
for (br = bmain->brush.first; br; br = br->id.next) {
|
||||
if (br->ob_mode == 0)
|
||||
br->ob_mode = OB_MODE_ALL_PAINT;
|
||||
}
|
||||
|
||||
for (part = main->particle.first; part; part = part->id.next) {
|
||||
for (part = bmain->particle.first; part; part = part->id.next) {
|
||||
if (part->boids)
|
||||
part->boids->pitch = 1.0f;
|
||||
|
||||
|
@ -1829,7 +1829,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
part->kink_amp_clump = 1.f; /* keep old files looking similar */
|
||||
}
|
||||
|
||||
for (sc = main->screen.first; sc; sc = sc->id.next) {
|
||||
for (sc = bmain->screen.first; sc; sc = sc->id.next) {
|
||||
ScrArea *sa;
|
||||
for (sa = sc->areabase.first; sa; sa = sa->next) {
|
||||
SpaceLink *sl;
|
||||
|
@ -1856,11 +1856,11 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 255 || (main->versionfile == 255 && main->subversionfile < 3)) {
|
||||
if (bmain->versionfile < 255 || (bmain->versionfile == 255 && bmain->subversionfile < 3)) {
|
||||
Object *ob;
|
||||
|
||||
/* ocean res is now squared, reset old ones - will be massive */
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
ModifierData *md;
|
||||
for (md = ob->modifiers.first; md; md = md->next) {
|
||||
if (md->type == eModifierType_Ocean) {
|
||||
|
@ -1872,13 +1872,13 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 256) {
|
||||
if (bmain->versionfile < 256) {
|
||||
bScreen *sc;
|
||||
ScrArea *sa;
|
||||
Key *key;
|
||||
|
||||
/* Fix for sample line scope initializing with no height */
|
||||
for (sc = main->screen.first; sc; sc = sc->id.next) {
|
||||
for (sc = bmain->screen.first; sc; sc = sc->id.next) {
|
||||
sa = sc->areabase.first;
|
||||
while (sa) {
|
||||
SpaceLink *sl;
|
||||
|
@ -1897,7 +1897,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
* 2.4x would never reveal this to users as a dummy value always ended up getting used
|
||||
* instead
|
||||
*/
|
||||
for (key = main->key.first; key; key = key->id.next) {
|
||||
for (key = bmain->key.first; key; key = key->id.next) {
|
||||
KeyBlock *kb;
|
||||
|
||||
for (kb = key->block.first; kb; kb = kb->next) {
|
||||
|
@ -1907,19 +1907,19 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 1)) {
|
||||
if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 1)) {
|
||||
/* fix for bones that didn't have arm_roll before */
|
||||
bArmature *arm;
|
||||
Bone *bone;
|
||||
Object *ob;
|
||||
|
||||
for (arm = main->armature.first; arm; arm = arm->id.next)
|
||||
for (arm = bmain->armature.first; arm; arm = arm->id.next)
|
||||
for (bone = arm->bonebase.first; bone; bone = bone->next)
|
||||
do_version_bone_roll_256(bone);
|
||||
|
||||
/* fix for objects which have zero dquat's
|
||||
* since this is multiplied with the quat rather than added */
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
if (is_zero_v4(ob->dquat)) {
|
||||
unit_qt(ob->dquat);
|
||||
}
|
||||
|
@ -1929,7 +1929,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 2)) {
|
||||
if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 2)) {
|
||||
bNodeTree *ntree;
|
||||
bNode *node;
|
||||
bNodeSocket *sock, *gsock;
|
||||
|
@ -1938,7 +1938,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
/* node sockets are not exposed automatically any more,
|
||||
* this mimics the old behavior by adding all unlinked sockets to groups.
|
||||
*/
|
||||
for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) {
|
||||
for (ntree=bmain->nodetree.first; ntree; ntree=ntree->id.next) {
|
||||
/* this adds copies and links from all unlinked internal sockets to group inputs/outputs. */
|
||||
|
||||
/* first make sure the own_index for new sockets is valid */
|
||||
|
@ -2007,14 +2007,14 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 3)) {
|
||||
if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 3)) {
|
||||
bScreen *sc;
|
||||
Brush *brush;
|
||||
Object *ob;
|
||||
ParticleSettings *part;
|
||||
|
||||
/* redraws flag in SpaceTime has been moved to Screen level */
|
||||
for (sc = main->screen.first; sc; sc = sc->id.next) {
|
||||
for (sc = bmain->screen.first; sc; sc = sc->id.next) {
|
||||
if (sc->redraws_flag == 0) {
|
||||
/* just initialize to default? */
|
||||
/* XXX: we could also have iterated through areas, and taken them from the first timeline available... */
|
||||
|
@ -2022,13 +2022,13 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
for (brush = main->brush.first; brush; brush = brush->id.next) {
|
||||
for (brush = bmain->brush.first; brush; brush = brush->id.next) {
|
||||
if (brush->height == 0)
|
||||
brush->height = 0.4f;
|
||||
}
|
||||
|
||||
/* replace 'rim material' option for in offset*/
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
ModifierData *md;
|
||||
for (md = ob->modifiers.first; md; md = md->next) {
|
||||
if (md->type == eModifierType_Solidify) {
|
||||
|
@ -2042,24 +2042,24 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
|
||||
/* particle draw color from material */
|
||||
for (part = main->particle.first; part; part = part->id.next) {
|
||||
for (part = bmain->particle.first; part; part = part->id.next) {
|
||||
if (part->draw & PART_DRAW_MAT_COL)
|
||||
part->draw_col = PART_DRAW_COL_MAT;
|
||||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 6)) {
|
||||
if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 6)) {
|
||||
Mesh *me;
|
||||
|
||||
for (me = main->mesh.first; me; me = me->id.next)
|
||||
for (me = bmain->mesh.first; me; me = me->id.next)
|
||||
BKE_mesh_calc_normals_tessface(me->mvert, me->totvert, me->mface, me->totface, NULL);
|
||||
}
|
||||
|
||||
if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 2)) {
|
||||
if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 2)) {
|
||||
/* update blur area sizes from 0..1 range to 0..100 percentage */
|
||||
Scene *scene;
|
||||
bNode *node;
|
||||
for (scene = main->scene.first; scene; scene = scene->id.next)
|
||||
for (scene = bmain->scene.first; scene; scene = scene->id.next)
|
||||
if (scene->nodetree)
|
||||
for (node = scene->nodetree->nodes.first; node; node = node->next)
|
||||
if (node->type == CMP_NODE_BLUR) {
|
||||
|
@ -2069,13 +2069,13 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 258 || (main->versionfile == 258 && main->subversionfile < 1)) {
|
||||
if (bmain->versionfile < 258 || (bmain->versionfile == 258 && bmain->subversionfile < 1)) {
|
||||
/* screen view2d settings were not properly initialized [#27164]
|
||||
* v2d->scroll caused the bug but best reset other values too which are in old blend files only.
|
||||
* need to make less ugly - possibly an iterator? */
|
||||
bScreen *screen;
|
||||
|
||||
for (screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
ScrArea *sa;
|
||||
/* add regions */
|
||||
for (sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
|
@ -2106,19 +2106,19 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
|
||||
{
|
||||
ParticleSettings *part;
|
||||
for (part = main->particle.first; part; part = part->id.next) {
|
||||
for (part = bmain->particle.first; part; part = part->id.next) {
|
||||
/* Initialize particle billboard scale */
|
||||
part->bb_size[0] = part->bb_size[1] = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 1)) {
|
||||
if (bmain->versionfile < 259 || (bmain->versionfile == 259 && bmain->subversionfile < 1)) {
|
||||
{
|
||||
Scene *scene;
|
||||
Sequence *seq;
|
||||
|
||||
for (scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
scene->r.ffcodecdata.audio_channels = 2;
|
||||
scene->audio.volume = 1.0f;
|
||||
SEQ_BEGIN (scene->ed, seq)
|
||||
|
@ -2131,7 +2131,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
|
||||
{
|
||||
bScreen *screen;
|
||||
for (screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
ScrArea *sa;
|
||||
|
||||
/* add regions */
|
||||
|
@ -2172,7 +2172,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
bAction *act;
|
||||
FCurve *fcu;
|
||||
|
||||
for (act = main->action.first; act; act = act->id.next) {
|
||||
for (act = bmain->action.first; act; act = act->id.next) {
|
||||
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
|
||||
BezTriple *bezt;
|
||||
unsigned int i = 0;
|
||||
|
@ -2197,10 +2197,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 2)) {
|
||||
if (bmain->versionfile < 259 || (bmain->versionfile == 259 && bmain->subversionfile < 2)) {
|
||||
{
|
||||
/* Convert default socket values from bNodeStack */
|
||||
FOREACH_NODETREE(main, ntree, id) {
|
||||
FOREACH_NODETREE(bmain, ntree, id) {
|
||||
bNode *node;
|
||||
bNodeSocket *sock;
|
||||
|
||||
|
@ -2227,17 +2227,17 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
|
|||
* associate them with specific node types for polling.
|
||||
*/
|
||||
bNodeTree *ntree;
|
||||
/* all node trees in main->nodetree are considered groups */
|
||||
for (ntree = main->nodetree.first; ntree; ntree = ntree->id.next)
|
||||
/* all node trees in bmain->nodetree are considered groups */
|
||||
for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next)
|
||||
ntree->nodetype = NODE_GROUP;
|
||||
}
|
||||
}
|
||||
|
||||
if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 4)) {
|
||||
if (bmain->versionfile < 259 || (bmain->versionfile == 259 && bmain->subversionfile < 4)) {
|
||||
{
|
||||
/* Adaptive time step for particle systems */
|
||||
ParticleSettings *part;
|
||||
for (part = main->particle.first; part; part = part->id.next) {
|
||||
for (part = bmain->particle.first; part; part = part->id.next) {
|
||||
part->courant_target = 0.2f;
|
||||
part->time_flag &= ~PART_TIME_AUTOSF;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -346,14 +346,14 @@ static void do_version_bbone_easing_fcurve_fix(ID *UNUSED(id), FCurve *fcu, void
|
|||
}
|
||||
|
||||
|
||||
void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
||||
void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
{
|
||||
if (!MAIN_VERSION_ATLEAST(main, 270, 0)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 270, 0)) {
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "BevelModifierData", "float", "profile")) {
|
||||
Object *ob;
|
||||
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
ModifierData *md;
|
||||
for (md = ob->modifiers.first; md; md = md->next) {
|
||||
if (md->type == eModifierType_Bevel) {
|
||||
|
@ -366,7 +366,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
|
||||
/* nodes don't use fixed node->id any more, clean up */
|
||||
FOREACH_NODETREE(main, ntree, id) {
|
||||
FOREACH_NODETREE(bmain, ntree, id) {
|
||||
if (ntree->type == NTREE_COMPOSIT) {
|
||||
bNode *node;
|
||||
for (node = ntree->nodes.first; node; node = node->next) {
|
||||
|
@ -380,7 +380,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
{
|
||||
bScreen *screen;
|
||||
|
||||
for (screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
ScrArea *area;
|
||||
for (area = screen->areabase.first; area; area = area->next) {
|
||||
SpaceLink *space_link;
|
||||
|
@ -398,17 +398,17 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingSettings", "float", "default_weight")) {
|
||||
MovieClip *clip;
|
||||
for (clip = main->movieclip.first; clip; clip = clip->id.next) {
|
||||
for (clip = bmain->movieclip.first; clip; clip = clip->id.next) {
|
||||
clip->tracking.settings.default_weight = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 270, 1)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 270, 1)) {
|
||||
Object *ob;
|
||||
|
||||
/* Update Transform constraint (another deg -> rad stuff). */
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
do_version_constraints_radians_degrees_270_1(&ob->constraints);
|
||||
|
||||
if (ob->pose) {
|
||||
|
@ -421,32 +421,32 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 270, 2)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 270, 2)) {
|
||||
Mesh *me;
|
||||
|
||||
/* Mesh smoothresh deg->rad. */
|
||||
for (me = main->mesh.first; me; me = me->id.next) {
|
||||
for (me = bmain->mesh.first; me; me = me->id.next) {
|
||||
me->smoothresh = DEG2RADF(me->smoothresh);
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 270, 3)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 270, 3)) {
|
||||
FreestyleLineStyle *linestyle;
|
||||
|
||||
for (linestyle = main->linestyle.first; linestyle; linestyle = linestyle->id.next) {
|
||||
for (linestyle = bmain->linestyle.first; linestyle; linestyle = linestyle->id.next) {
|
||||
linestyle->flag |= LS_NO_SORTING;
|
||||
linestyle->sort_key = LS_SORT_KEY_DISTANCE_FROM_CAMERA;
|
||||
linestyle->integration_type = LS_INTEGRATION_MEAN;
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 270, 4)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 270, 4)) {
|
||||
/* ui_previews were not handled correctly when copying areas, leading to corrupted files (see T39847).
|
||||
* This will always reset situation to a valid state.
|
||||
*/
|
||||
bScreen *sc;
|
||||
|
||||
for (sc = main->screen.first; sc; sc = sc->id.next) {
|
||||
for (sc = bmain->screen.first; sc; sc = sc->id.next) {
|
||||
ScrArea *sa;
|
||||
for (sa = sc->areabase.first; sa; sa = sa->next) {
|
||||
SpaceLink *sl;
|
||||
|
@ -463,11 +463,11 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 270, 5)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 270, 5)) {
|
||||
Object *ob;
|
||||
|
||||
/* Update Transform constraint (again :|). */
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
do_version_constraints_radians_degrees_270_5(&ob->constraints);
|
||||
|
||||
if (ob->pose) {
|
||||
|
@ -480,11 +480,11 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 271, 0)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 271, 0)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "BakeData", "bake")) {
|
||||
Scene *sce;
|
||||
|
||||
for (sce = main->scene.first; sce; sce = sce->id.next) {
|
||||
for (sce = bmain->scene.first; sce; sce = sce->id.next) {
|
||||
sce->r.bake.flag = R_BAKE_CLEAR;
|
||||
sce->r.bake.width = 512;
|
||||
sce->r.bake.height = 512;
|
||||
|
@ -506,7 +506,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
if (!DNA_struct_elem_find(fd->filesdna, "FreestyleLineStyle", "float", "texstep")) {
|
||||
FreestyleLineStyle *linestyle;
|
||||
|
||||
for (linestyle = main->linestyle.first; linestyle; linestyle = linestyle->id.next) {
|
||||
for (linestyle = bmain->linestyle.first; linestyle; linestyle = linestyle->id.next) {
|
||||
linestyle->flag |= LS_TEXTURE;
|
||||
linestyle->texstep = 1.0;
|
||||
}
|
||||
|
@ -514,18 +514,18 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
|
||||
{
|
||||
Scene *scene;
|
||||
for (scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
int num_layers = BLI_listbase_count(&scene->r.layers);
|
||||
scene->r.actlay = min_ff(scene->r.actlay, num_layers - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 271, 1)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 271, 1)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Material", "float", "line_col[4]")) {
|
||||
Material *mat;
|
||||
|
||||
for (mat = main->mat.first; mat; mat = mat->id.next) {
|
||||
for (mat = bmain->mat.first; mat; mat = mat->id.next) {
|
||||
mat->line_col[0] = mat->line_col[1] = mat->line_col[2] = 0.0f;
|
||||
mat->line_col[3] = mat->alpha;
|
||||
}
|
||||
|
@ -533,22 +533,22 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "int", "preview_start_resolution")) {
|
||||
Scene *scene;
|
||||
for (scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
scene->r.preview_start_resolution = 64;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 271, 3)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 271, 3)) {
|
||||
Brush *br;
|
||||
|
||||
for (br = main->brush.first; br; br = br->id.next) {
|
||||
for (br = bmain->brush.first; br; br = br->id.next) {
|
||||
br->fill_threshold = 0.2f;
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "BevelModifierData", "int", "mat")) {
|
||||
Object *ob;
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
ModifierData *md;
|
||||
|
||||
for (md = ob->modifiers.first; md; md = md->next) {
|
||||
|
@ -561,9 +561,9 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 271, 6)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 271, 6)) {
|
||||
Object *ob;
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
ModifierData *md;
|
||||
|
||||
for (md = ob->modifiers.first; md; md = md->next) {
|
||||
|
@ -577,27 +577,27 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 272, 0)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 272, 0)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "int", "preview_start_resolution")) {
|
||||
Scene *scene;
|
||||
for (scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
scene->r.preview_start_resolution = 64;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 272, 1)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 272, 1)) {
|
||||
Brush *br;
|
||||
for (br = main->brush.first; br; br = br->id.next) {
|
||||
for (br = bmain->brush.first; br; br = br->id.next) {
|
||||
if ((br->ob_mode & OB_MODE_SCULPT) && ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK))
|
||||
br->alpha = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 272, 2)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 272, 2)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Image", "float", "gen_color")) {
|
||||
Image *image;
|
||||
for (image = main->image.first; image != NULL; image = image->id.next) {
|
||||
for (image = bmain->image.first; image != NULL; image = image->id.next) {
|
||||
image->gen_color[3] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
@ -606,7 +606,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
Object *ob;
|
||||
|
||||
/* Update Transform constraint (again :|). */
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
do_version_constraints_stretch_to_limits(&ob->constraints);
|
||||
|
||||
if (ob->pose) {
|
||||
|
@ -620,13 +620,13 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 273, 1)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 273, 1)) {
|
||||
#define BRUSH_RAKE (1 << 7)
|
||||
#define BRUSH_RANDOM_ROTATION (1 << 25)
|
||||
|
||||
Brush *br;
|
||||
|
||||
for (br = main->brush.first; br; br = br->id.next) {
|
||||
for (br = bmain->brush.first; br; br = br->id.next) {
|
||||
if (br->flag & BRUSH_RAKE) {
|
||||
br->mtex.brush_angle_mode |= MTEX_ANGLE_RAKE;
|
||||
br->mask_mtex.brush_angle_mode |= MTEX_ANGLE_RAKE;
|
||||
|
@ -644,11 +644,11 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
#undef BRUSH_RANDOM_ROTATION
|
||||
|
||||
/* Customizable Safe Areas */
|
||||
if (!MAIN_VERSION_ATLEAST(main, 273, 2)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 273, 2)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Scene", "DisplaySafeAreas", "safe_areas")) {
|
||||
Scene *scene;
|
||||
|
||||
for (scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
copy_v2_fl2(scene->safe_areas.title, 3.5f / 100.0f, 3.5f / 100.0f);
|
||||
copy_v2_fl2(scene->safe_areas.action, 10.0f / 100.0f, 5.0f / 100.0f);
|
||||
copy_v2_fl2(scene->safe_areas.title_center, 17.5f / 100.0f, 5.0f / 100.0f);
|
||||
|
@ -657,9 +657,9 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 273, 3)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 273, 3)) {
|
||||
ParticleSettings *part;
|
||||
for (part = main->particle.first; part; part = part->id.next) {
|
||||
for (part = bmain->particle.first; part; part = part->id.next) {
|
||||
if (part->clumpcurve)
|
||||
part->child_flag |= PART_CHILD_USE_CLUMP_CURVE;
|
||||
if (part->roughcurve)
|
||||
|
@ -667,11 +667,11 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 273, 6)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 273, 6)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ClothSimSettings", "float", "bending_damping")) {
|
||||
Object *ob;
|
||||
ModifierData *md;
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
for (md = ob->modifiers.first; md; md = md->next) {
|
||||
if (md->type == eModifierType_Cloth) {
|
||||
ClothModifierData *clmd = (ClothModifierData *)md;
|
||||
|
@ -689,21 +689,21 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ParticleSettings", "float", "clump_noise_size")) {
|
||||
ParticleSettings *part;
|
||||
for (part = main->particle.first; part; part = part->id.next) {
|
||||
for (part = bmain->particle.first; part; part = part->id.next) {
|
||||
part->clump_noise_size = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ParticleSettings", "int", "kink_extra_steps")) {
|
||||
ParticleSettings *part;
|
||||
for (part = main->particle.first; part; part = part->id.next) {
|
||||
for (part = bmain->particle.first; part; part = part->id.next) {
|
||||
part->kink_extra_steps = 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "MTex", "float", "kinkampfac")) {
|
||||
ParticleSettings *part;
|
||||
for (part = main->particle.first; part; part = part->id.next) {
|
||||
for (part = bmain->particle.first; part; part = part->id.next) {
|
||||
int a;
|
||||
for (a = 0; a < MAX_MTEX; a++) {
|
||||
MTex *mtex = part->mtex[a];
|
||||
|
@ -717,7 +717,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
if (!DNA_struct_elem_find(fd->filesdna, "HookModifierData", "char", "flag")) {
|
||||
Object *ob;
|
||||
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
ModifierData *md;
|
||||
for (md = ob->modifiers.first; md; md = md->next) {
|
||||
if (md->type == eModifierType_Hook) {
|
||||
|
@ -729,7 +729,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "NodePlaneTrackDeformData", "char", "flag")) {
|
||||
FOREACH_NODETREE(main, ntree, id) {
|
||||
FOREACH_NODETREE(bmain, ntree, id) {
|
||||
if (ntree->type == NTREE_COMPOSIT) {
|
||||
bNode *node;
|
||||
for (node = ntree->nodes.first; node; node = node->next) {
|
||||
|
@ -747,7 +747,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Camera", "GPUDOFSettings", "gpu_dof")) {
|
||||
Camera *ca;
|
||||
for (ca = main->camera.first; ca; ca = ca->id.next) {
|
||||
for (ca = bmain->camera.first; ca; ca = ca->id.next) {
|
||||
ca->gpu_dof.fstop = 128.0f;
|
||||
ca->gpu_dof.focal_length = 1.0f;
|
||||
ca->gpu_dof.focus_distance = 1.0f;
|
||||
|
@ -756,9 +756,9 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 273, 8)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 273, 8)) {
|
||||
Object *ob;
|
||||
for (ob = main->object.first; ob != NULL; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob != NULL; ob = ob->id.next) {
|
||||
ModifierData *md;
|
||||
for (md = ob->modifiers.last; md != NULL; md = md->prev) {
|
||||
if (modifier_unique_name(&ob->modifiers, md)) {
|
||||
|
@ -770,14 +770,14 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 273, 9)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 273, 9)) {
|
||||
bScreen *scr;
|
||||
ScrArea *sa;
|
||||
SpaceLink *sl;
|
||||
ARegion *ar;
|
||||
|
||||
/* Make sure sequencer preview area limits zoom */
|
||||
for (scr = main->screen.first; scr; scr = scr->id.next) {
|
||||
for (scr = bmain->screen.first; scr; scr = scr->id.next) {
|
||||
for (sa = scr->areabase.first; sa; sa = sa->next) {
|
||||
for (sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_SEQ) {
|
||||
|
@ -795,12 +795,12 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 274, 1)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 274, 1)) {
|
||||
/* particle systems need to be forced to redistribute for jitter mode fix */
|
||||
{
|
||||
Object *ob;
|
||||
ParticleSystem *psys;
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
|
||||
if ((psys->pointcache->flag & PTCACHE_BAKED) == 0) {
|
||||
psys->recalc |= PSYS_RECALC_RESET;
|
||||
|
@ -812,7 +812,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
/* hysteresis setted to 10% but not actived */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "LodLevel", "int", "obhysteresis")) {
|
||||
Object *ob;
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
LodLevel *level;
|
||||
for (level = ob->lodlevels.first; level; level = level->next) {
|
||||
level->obhysteresis = 10;
|
||||
|
@ -821,7 +821,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 274, 4)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 274, 4)) {
|
||||
SceneRenderView *srv;
|
||||
wmWindowManager *wm;
|
||||
bScreen *screen;
|
||||
|
@ -830,7 +830,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
Camera *cam;
|
||||
Image *ima;
|
||||
|
||||
for (scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
Sequence *seq;
|
||||
|
||||
BKE_scene_add_render_view(scene, STEREO_LEFT_NAME);
|
||||
|
@ -860,7 +860,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
SEQ_END
|
||||
}
|
||||
|
||||
for (screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
ScrArea *sa;
|
||||
for (sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
SpaceLink *sl;
|
||||
|
@ -887,12 +887,12 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
for (cam = main->camera.first; cam; cam = cam->id.next) {
|
||||
for (cam = bmain->camera.first; cam; cam = cam->id.next) {
|
||||
cam->stereo.interocular_distance = 0.065f;
|
||||
cam->stereo.convergence_distance = 30.0f * 0.065f;
|
||||
}
|
||||
|
||||
for (ima = main->image.first; ima; ima = ima->id.next) {
|
||||
for (ima = bmain->image.first; ima; ima = ima->id.next) {
|
||||
ima->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Image Stereo 3d Format");
|
||||
|
||||
if (ima->packedfile) {
|
||||
|
@ -905,18 +905,18 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
for (wm = main->wm.first; wm; wm = wm->id.next) {
|
||||
for (wm = bmain->wm.first; wm; wm = wm->id.next) {
|
||||
for (win = wm->windows.first; win; win = win->next) {
|
||||
win->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Stereo Display 3d Format");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 274, 6)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 274, 6)) {
|
||||
bScreen *screen;
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "FileSelectParams", "int", "thumbnail_size")) {
|
||||
for (screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
ScrArea *sa;
|
||||
|
||||
for (sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
|
@ -937,7 +937,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "short", "simplify_subsurf_render")) {
|
||||
Scene *scene;
|
||||
for (scene = main->scene.first; scene != NULL; scene = scene->id.next) {
|
||||
for (scene = bmain->scene.first; scene != NULL; scene = scene->id.next) {
|
||||
scene->r.simplify_subsurf_render = scene->r.simplify_subsurf;
|
||||
scene->r.simplify_particles_render = scene->r.simplify_particles;
|
||||
}
|
||||
|
@ -946,7 +946,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
if (!DNA_struct_elem_find(fd->filesdna, "DecimateModifierData", "float", "defgrp_factor")) {
|
||||
Object *ob;
|
||||
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
ModifierData *md;
|
||||
for (md = ob->modifiers.first; md; md = md->next) {
|
||||
if (md->type == eModifierType_Decimate) {
|
||||
|
@ -958,20 +958,20 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 275, 3)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 275, 3)) {
|
||||
Brush *br;
|
||||
#define BRUSH_TORUS (1 << 1)
|
||||
for (br = main->brush.first; br; br = br->id.next) {
|
||||
for (br = bmain->brush.first; br; br = br->id.next) {
|
||||
br->flag &= ~BRUSH_TORUS;
|
||||
}
|
||||
#undef BRUSH_TORUS
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 276, 2)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 276, 2)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bPoseChannel", "float", "custom_scale")) {
|
||||
Object *ob;
|
||||
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
if (ob->pose) {
|
||||
bPoseChannel *pchan;
|
||||
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
|
||||
|
@ -984,7 +984,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
{
|
||||
bScreen *screen;
|
||||
#define RV3D_VIEW_PERSPORTHO 7
|
||||
for (screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
ScrArea *sa;
|
||||
for (sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
SpaceLink *sl;
|
||||
|
@ -1013,7 +1013,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
{
|
||||
Lamp *lamp;
|
||||
#define LA_YF_PHOTON 5
|
||||
for (lamp = main->lamp.first; lamp; lamp = lamp->id.next) {
|
||||
for (lamp = bmain->lamp.first; lamp; lamp = lamp->id.next) {
|
||||
if (lamp->type == LA_YF_PHOTON) {
|
||||
lamp->type = LA_LOCAL;
|
||||
}
|
||||
|
@ -1022,10 +1022,10 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 276, 3)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 276, 3)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "CurveMapping", "mblur_shutter_curve")) {
|
||||
Scene *scene;
|
||||
for (scene = main->scene.first; scene != NULL; scene = scene->id.next) {
|
||||
for (scene = bmain->scene.first; scene != NULL; scene = scene->id.next) {
|
||||
CurveMapping *curve_mapping = &scene->r.mblur_shutter_curve;
|
||||
curvemapping_set_defaults(curve_mapping, 1, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
curvemapping_initialize(curve_mapping);
|
||||
|
@ -1037,8 +1037,8 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 276, 4)) {
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 276, 4)) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
|
||||
if (ts->gp_sculpt.brush[0].size == 0) {
|
||||
|
@ -1113,7 +1113,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
for (bGPdata *gpd = main->gpencil.first; gpd; gpd = gpd->id.next) {
|
||||
for (bGPdata *gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) {
|
||||
bool enabled = false;
|
||||
|
||||
/* Ensure that the datablock's onionskinning toggle flag
|
||||
|
@ -1131,13 +1131,13 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
gpd->flag &= ~GP_DATA_SHOW_ONIONSKINS;
|
||||
}
|
||||
}
|
||||
if (!MAIN_VERSION_ATLEAST(main, 276, 5)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 276, 5)) {
|
||||
ListBase *lbarray[MAX_LIBARRAY];
|
||||
int a;
|
||||
|
||||
/* Important to clear all non-persistent flags from older versions here, otherwise they could collide
|
||||
* with any new persistent flag we may add in the future. */
|
||||
a = set_listbasepointers(main, lbarray);
|
||||
a = set_listbasepointers(bmain, lbarray);
|
||||
while (a--) {
|
||||
for (ID *id = lbarray[a]->first; id; id = id->next) {
|
||||
id->flag &= LIB_FAKEUSER;
|
||||
|
@ -1145,15 +1145,15 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 276, 7)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 276, 7)) {
|
||||
Scene *scene;
|
||||
for (scene = main->scene.first; scene != NULL; scene = scene->id.next) {
|
||||
for (scene = bmain->scene.first; scene != NULL; scene = scene->id.next) {
|
||||
scene->r.bake.pass_filter = R_BAKE_PASS_FILTER_ALL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 277, 1)) {
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 277, 1)) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
ParticleEditSettings *pset = &scene->toolsettings->particle;
|
||||
for (int a = 0; a < ARRAY_SIZE(pset->brush); a++) {
|
||||
if (pset->brush[a].strength > 1.0f) {
|
||||
|
@ -1162,7 +1162,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
|
||||
|
@ -1195,7 +1195,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
CurvePaintSettings *cps = &scene->toolsettings->curve_paint_settings;
|
||||
if (cps->error_threshold == 0) {
|
||||
cps->curve_type = CU_BEZIER;
|
||||
|
@ -1206,7 +1206,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
Sequence *seq;
|
||||
|
||||
SEQ_BEGIN (scene->ed, seq)
|
||||
|
@ -1230,7 +1230,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
|
||||
/* Adding "Properties" region to DopeSheet */
|
||||
for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
/* handle pushed-back space data first */
|
||||
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
|
@ -1248,14 +1248,14 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 277, 2)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 277, 2)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Bone", "float", "scaleIn")) {
|
||||
for (bArmature *arm = main->armature.first; arm; arm = arm->id.next) {
|
||||
for (bArmature *arm = bmain->armature.first; arm; arm = arm->id.next) {
|
||||
do_version_bones_super_bbone(&arm->bonebase);
|
||||
}
|
||||
}
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bPoseChannel", "float", "scaleIn")) {
|
||||
for (Object *ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
if (ob->pose) {
|
||||
for (bPoseChannel *pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
|
||||
/* see do_version_bones_super_bbone()... */
|
||||
|
@ -1275,7 +1275,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
for (Camera *camera = main->camera.first; camera != NULL; camera = camera->id.next) {
|
||||
for (Camera *camera = bmain->camera.first; camera != NULL; camera = camera->id.next) {
|
||||
if (camera->stereo.pole_merge_angle_from == 0.0f &&
|
||||
camera->stereo.pole_merge_angle_to == 0.0f)
|
||||
{
|
||||
|
@ -1287,7 +1287,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
if (!DNA_struct_elem_find(fd->filesdna, "NormalEditModifierData", "float", "mix_limit")) {
|
||||
Object *ob;
|
||||
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
ModifierData *md;
|
||||
for (md = ob->modifiers.first; md; md = md->next) {
|
||||
if (md->type == eModifierType_NormalEdit) {
|
||||
|
@ -1300,7 +1300,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "BooleanModifierData", "float", "double_threshold")) {
|
||||
Object *ob;
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
ModifierData *md;
|
||||
for (md = ob->modifiers.first; md; md = md->next) {
|
||||
if (md->type == eModifierType_Boolean) {
|
||||
|
@ -1311,7 +1311,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
for (Brush *br = main->brush.first; br; br = br->id.next) {
|
||||
for (Brush *br = bmain->brush.first; br; br = br->id.next) {
|
||||
if (br->sculpt_tool == SCULPT_TOOL_FLATTEN) {
|
||||
br->flag |= BRUSH_ACCUMULATE;
|
||||
}
|
||||
|
@ -1320,7 +1320,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
if (!DNA_struct_elem_find(fd->filesdna, "ClothSimSettings", "float", "time_scale")) {
|
||||
Object *ob;
|
||||
ModifierData *md;
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
for (md = ob->modifiers.first; md; md = md->next) {
|
||||
if (md->type == eModifierType_Cloth) {
|
||||
ClothModifierData *clmd = (ClothModifierData *)md;
|
||||
|
@ -1337,10 +1337,10 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 277, 3)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 277, 3)) {
|
||||
/* ------- init of grease pencil initialization --------------- */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bGPDstroke", "bGPDpalettecolor", "*palcolor")) {
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
/* initialize use position for sculpt brushes */
|
||||
ts->gp_sculpt.flag |= GP_BRUSHEDIT_FLAG_APPLY_POSITION;
|
||||
|
@ -1359,8 +1359,8 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
/* create a default grease pencil drawing brushes set */
|
||||
if (!BLI_listbase_is_empty(&main->gpencil)) {
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
if (!BLI_listbase_is_empty(&bmain->gpencil)) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
if (BLI_listbase_is_empty(&ts->gp_brushes)) {
|
||||
BKE_gpencil_brush_init_presets(ts);
|
||||
|
@ -1370,7 +1370,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
/* Convert Grease Pencil to new palettes/brushes
|
||||
* Loop all strokes and create the palette and all colors
|
||||
*/
|
||||
for (bGPdata *gpd = main->gpencil.first; gpd; gpd = gpd->id.next) {
|
||||
for (bGPdata *gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) {
|
||||
if (BLI_listbase_is_empty(&gpd->palettes)) {
|
||||
/* create palette */
|
||||
bGPDpalette *palette = BKE_gpencil_palette_addnew(gpd, "GP_Palette", true);
|
||||
|
@ -1423,10 +1423,10 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
/* ------- end of grease pencil initialization --------------- */
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 278, 0)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 278, 0)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingTrack", "float", "weight_stab")) {
|
||||
MovieClip *clip;
|
||||
for (clip = main->movieclip.first; clip; clip = clip->id.next) {
|
||||
for (clip = bmain->movieclip.first; clip; clip = clip->id.next) {
|
||||
MovieTracking *tracking = &clip->tracking;
|
||||
MovieTrackingObject *tracking_object;
|
||||
for (tracking_object = tracking->objects.first;
|
||||
|
@ -1447,7 +1447,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingStabilization", "int", "tot_rot_track")) {
|
||||
MovieClip *clip;
|
||||
for (clip = main->movieclip.first; clip != NULL; clip = clip->id.next) {
|
||||
for (clip = bmain->movieclip.first; clip != NULL; clip = clip->id.next) {
|
||||
if (clip->tracking.stabilization.rot_track) {
|
||||
migrate_single_rot_stabilization_track_settings(&clip->tracking.stabilization);
|
||||
}
|
||||
|
@ -1467,15 +1467,15 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!MAIN_VERSION_ATLEAST(main, 278, 2)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 278, 2)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "FFMpegCodecData", "int", "ffmpeg_preset")) {
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
/* "medium" is the preset FFmpeg uses when no presets are given. */
|
||||
scene->r.ffcodecdata.ffmpeg_preset = FFM_PRESET_MEDIUM;
|
||||
}
|
||||
}
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "FFMpegCodecData", "int", "constant_rate_factor")) {
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
/* fall back to behaviour from before we introduced CRF for old files */
|
||||
scene->r.ffcodecdata.constant_rate_factor = FFM_CRF_NONE;
|
||||
}
|
||||
|
@ -1485,7 +1485,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
Object *ob;
|
||||
ModifierData *md;
|
||||
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
for (md = ob->modifiers.first; md; md = md->next) {
|
||||
if (md->type == eModifierType_Smoke) {
|
||||
SmokeModifierData *smd = (SmokeModifierData *)md;
|
||||
|
@ -1500,8 +1500,8 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 278, 3)) {
|
||||
for (Scene *scene = main->scene.first; scene != NULL; scene = scene->id.next) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 278, 3)) {
|
||||
for (Scene *scene = bmain->scene.first; scene != NULL; scene = scene->id.next) {
|
||||
if (scene->toolsettings != NULL) {
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
ParticleEditSettings *pset = &ts->particle;
|
||||
|
@ -1515,7 +1515,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "RigidBodyCon", "float", "spring_stiffness_ang_x")) {
|
||||
Object *ob;
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
RigidBodyCon *rbc = ob->rigidbody_constraint;
|
||||
if (rbc) {
|
||||
rbc->spring_stiffness_ang_x = 10.0;
|
||||
|
@ -1530,7 +1530,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
|
||||
/* constant detail for sculpting is now a resolution value instead of
|
||||
* a percentage, we reuse old DNA struct member but convert it */
|
||||
for (Scene *scene = main->scene.first; scene != NULL; scene = scene->id.next) {
|
||||
for (Scene *scene = bmain->scene.first; scene != NULL; scene = scene->id.next) {
|
||||
if (scene->toolsettings != NULL) {
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
if (ts->sculpt && ts->sculpt->constant_detail != 0.0f) {
|
||||
|
@ -1540,16 +1540,16 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 278, 4)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 278, 4)) {
|
||||
const float sqrt_3 = (float)M_SQRT3;
|
||||
for (Brush *br = main->brush.first; br; br = br->id.next) {
|
||||
for (Brush *br = bmain->brush.first; br; br = br->id.next) {
|
||||
br->fill_threshold /= sqrt_3;
|
||||
}
|
||||
|
||||
/* Custom motion paths */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bMotionPath", "int", "line_thickness")) {
|
||||
Object *ob;
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
bMotionPath *mpath;
|
||||
bPoseChannel *pchan;
|
||||
mpath = ob->mpath;
|
||||
|
@ -1577,9 +1577,9 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 278, 5)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 278, 5)) {
|
||||
/* Mask primitive adding code was not initializing correctly id_type of its points' parent. */
|
||||
for (Mask *mask = main->mask.first; mask; mask = mask->id.next) {
|
||||
for (Mask *mask = bmain->mask.first; mask; mask = mask->id.next) {
|
||||
for (MaskLayer *mlayer = mask->masklayers.first; mlayer; mlayer = mlayer->next) {
|
||||
for (MaskSpline *mspline = mlayer->splines.first; mspline; mspline = mspline->next) {
|
||||
int i = 0;
|
||||
|
@ -1594,7 +1594,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
|
||||
/* Fix for T50736, Glare comp node using same var for two different things. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "NodeGlare", "char", "star_45")) {
|
||||
FOREACH_NODETREE(main, ntree, id) {
|
||||
FOREACH_NODETREE(bmain, ntree, id) {
|
||||
if (ntree->type == NTREE_COMPOSIT) {
|
||||
ntreeSetTypes(NULL, ntree);
|
||||
for (bNode *node = ntree->nodes.first; node; node = node->next) {
|
||||
|
@ -1617,7 +1617,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SurfaceDeformModifierData", "float", "mat[4][4]")) {
|
||||
for (Object *ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
|
||||
if (md->type == eModifierType_SurfaceDeform) {
|
||||
SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md;
|
||||
|
@ -1627,32 +1627,32 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
FOREACH_NODETREE(main, ntree, id) {
|
||||
FOREACH_NODETREE(bmain, ntree, id) {
|
||||
if (ntree->type == NTREE_COMPOSIT) {
|
||||
do_versions_compositor_render_passes(ntree);
|
||||
}
|
||||
} FOREACH_NODETREE_END
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 279, 0)) {
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 279, 0)) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
if (scene->r.im_format.exr_codec == R_IMF_EXR_CODEC_DWAB) {
|
||||
scene->r.im_format.exr_codec = R_IMF_EXR_CODEC_DWAA;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fix related to VGroup modifiers creating named defgroup CD layers! See T51520. */
|
||||
for (Mesh *me = main->mesh.first; me; me = me->id.next) {
|
||||
for (Mesh *me = bmain->mesh.first; me; me = me->id.next) {
|
||||
CustomData_set_layer_name(&me->vdata, CD_MDEFORMVERT, 0, "");
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 279, 3)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 279, 3)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SmokeDomainSettings", "float", "clipping")) {
|
||||
Object *ob;
|
||||
ModifierData *md;
|
||||
|
||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
for (md = ob->modifiers.first; md; md = md->next) {
|
||||
if (md->type == eModifierType_Smoke) {
|
||||
SmokeModifierData *smd = (SmokeModifierData *)md;
|
||||
|
@ -1667,7 +1667,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
|
||||
{
|
||||
/* Fix for invalid state of screen due to bug in older versions. */
|
||||
for (bScreen *sc = main->screen.first; sc; sc = sc->id.next) {
|
||||
for (bScreen *sc = bmain->screen.first; sc; sc = sc->id.next) {
|
||||
for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
|
||||
if (sa->full && sc->state == SCREENNORMAL) {
|
||||
sa->full = NULL;
|
||||
|
@ -1676,7 +1676,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Brush", "float", "falloff_angle")) {
|
||||
for (Brush *br = main->brush.first; br; br = br->id.next) {
|
||||
for (Brush *br = bmain->brush.first; br; br = br->id.next) {
|
||||
br->falloff_angle = DEG2RADF(80);
|
||||
br->flag &= ~(
|
||||
BRUSH_FLAG_DEPRECATED_1 | BRUSH_FLAG_DEPRECATED_2 |
|
||||
|
@ -1684,7 +1684,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
BRUSH_FRONTFACE_FALLOFF);
|
||||
}
|
||||
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
VPaint *vp = i ? ts->vpaint : ts->wpaint;
|
||||
|
@ -1699,7 +1699,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
/* Simple deform modifier no longer assumes Z axis (X for bend type).
|
||||
* Must set previous defaults. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SimpleDeformModifierData", "char", "deform_axis")) {
|
||||
for (Object *ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
|
||||
if (md->type == eModifierType_SimpleDeform) {
|
||||
SimpleDeformModifierData *smd = (SimpleDeformModifierData *)md;
|
||||
|
@ -1709,7 +1709,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
int preset = scene->r.ffcodecdata.ffmpeg_preset;
|
||||
if (preset == FFM_PRESET_NONE || preset >= FFM_PRESET_GOOD) {
|
||||
continue;
|
||||
|
@ -1727,7 +1727,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ParticleInstanceModifierData", "float", "particle_amount")) {
|
||||
for (Object *ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
|
||||
if (md->type == eModifierType_ParticleInstance) {
|
||||
ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *)md;
|
||||
|
@ -1740,11 +1740,11 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
void do_versions_after_linking_270(Main *main)
|
||||
void do_versions_after_linking_270(Main *bmain)
|
||||
{
|
||||
/* To be added to next subversion bump! */
|
||||
if (!MAIN_VERSION_ATLEAST(main, 279, 0)) {
|
||||
FOREACH_NODETREE(main, ntree, id) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 279, 0)) {
|
||||
FOREACH_NODETREE(bmain, ntree, id) {
|
||||
if (ntree->type == NTREE_COMPOSIT) {
|
||||
ntreeSetTypes(NULL, ntree);
|
||||
for (bNode *node = ntree->nodes.first; node; node = node->next) {
|
||||
|
@ -1756,9 +1756,9 @@ void do_versions_after_linking_270(Main *main)
|
|||
} FOREACH_NODETREE_END
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 279, 2)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 279, 2)) {
|
||||
/* B-Bones (bbone_in/out -> bbone_easein/out) + Stepped FMod Frame Start/End fix */
|
||||
/* if (!DNA_struct_elem_find(fd->filesdna, "Bone", "float", "bbone_easein")) */
|
||||
BKE_fcurves_main_cb(main, do_version_bbone_easing_fcurve_fix, NULL);
|
||||
BKE_fcurves_main_cb(bmain, do_version_bbone_easing_fcurve_fix, NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -672,15 +672,15 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene)
|
|||
scene->basact = NULL;
|
||||
}
|
||||
|
||||
void do_versions_after_linking_280(Main *main)
|
||||
void do_versions_after_linking_280(Main *bmain)
|
||||
{
|
||||
bool use_collection_compat_28 = true;
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 280, 0)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 0)) {
|
||||
use_collection_compat_28 = false;
|
||||
|
||||
/* Convert group layer visibility flags to hidden nested collection. */
|
||||
for (Collection *collection = main->collection.first; collection; collection = collection->id.next) {
|
||||
for (Collection *collection = bmain->collection.first; collection; collection = collection->id.next) {
|
||||
/* Add fake user for all existing groups. */
|
||||
id_fake_user_set(&collection->id);
|
||||
|
||||
|
@ -695,25 +695,25 @@ void do_versions_after_linking_280(Main *main)
|
|||
|
||||
if (!(ob->lay & collection->layer)) {
|
||||
if (collection_hidden == NULL) {
|
||||
collection_hidden = BKE_collection_add(main, collection, "Hidden");
|
||||
collection_hidden = BKE_collection_add(bmain, collection, "Hidden");
|
||||
collection_hidden->id.lib = collection->id.lib;
|
||||
collection_hidden->flag |= COLLECTION_RESTRICT_VIEW | COLLECTION_RESTRICT_RENDER;
|
||||
}
|
||||
|
||||
BKE_collection_object_add(main, collection_hidden, ob);
|
||||
BKE_collection_object_remove(main, collection, ob, true);
|
||||
BKE_collection_object_add(bmain, collection_hidden, ob);
|
||||
BKE_collection_object_remove(bmain, collection, ob, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert layers to collections. */
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
do_version_layers_to_collections(main, scene);
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
do_version_layers_to_collections(bmain, scene);
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 280, 0)) {
|
||||
for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 0)) {
|
||||
for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
/* same render-layer as do_version_workspaces_after_lib_link will activate,
|
||||
* so same layer as BKE_view_layer_from_workspace_get would return */
|
||||
ViewLayer *layer = screen->scene->view_layers.first;
|
||||
|
@ -747,14 +747,14 @@ void do_versions_after_linking_280(Main *main)
|
|||
}
|
||||
|
||||
/* New workspace design */
|
||||
if (!MAIN_VERSION_ATLEAST(main, 280, 1)) {
|
||||
do_version_workspaces_after_lib_link(main);
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 1)) {
|
||||
do_version_workspaces_after_lib_link(bmain);
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 280, 2)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 2)) {
|
||||
/* Cleanup any remaining SceneRenderLayer data for files that were created
|
||||
* with Blender 2.8 before the SceneRenderLayer > RenderLayer refactor. */
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
for (SceneRenderLayer *srl = scene->r.layers.first; srl; srl = srl->next) {
|
||||
if (srl->prop) {
|
||||
IDP_FreeProperty(srl->prop);
|
||||
|
@ -766,10 +766,10 @@ void do_versions_after_linking_280(Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 280, 3)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 3)) {
|
||||
/* Due to several changes to particle RNA and draw code particles from older files may no longer
|
||||
* be visible. Here we correct this by setting a default draw size for those files. */
|
||||
for (Object *object = main->object.first; object; object = object->id.next) {
|
||||
for (Object *object = bmain->object.first; object; object = object->id.next) {
|
||||
for (ParticleSystem *psys = object->particlesystem.first; psys; psys = psys->next) {
|
||||
if (psys->part->draw_size == 0.0f) {
|
||||
psys->part->draw_size = 0.1f;
|
||||
|
@ -778,8 +778,8 @@ void do_versions_after_linking_280(Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 280, 4)) {
|
||||
for (Object *object = main->object.first; object; object = object->id.next) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 4)) {
|
||||
for (Object *object = bmain->object.first; object; object = object->id.next) {
|
||||
#ifndef VERSION_280_SUBVERSION_4
|
||||
/* If any object already has an initialized value for
|
||||
* duplicator_visibility_flag it means we've already doversioned it.
|
||||
|
@ -811,9 +811,9 @@ void do_versions_after_linking_280(Main *main)
|
|||
}
|
||||
|
||||
/* SpaceTime & SpaceLogic removal/replacing */
|
||||
if (!MAIN_VERSION_ATLEAST(main, 280, 9)) {
|
||||
const wmWindowManager *wm = main->wm.first;
|
||||
const Scene *scene = main->scene.first;
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 9)) {
|
||||
const wmWindowManager *wm = bmain->wm.first;
|
||||
const Scene *scene = bmain->scene.first;
|
||||
|
||||
if (wm != NULL) {
|
||||
/* Action editors need a scene for creation. First, update active
|
||||
|
@ -833,7 +833,7 @@ void do_versions_after_linking_280(Main *main)
|
|||
}
|
||||
}
|
||||
if (scene != NULL) {
|
||||
for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
for (ScrArea *area = screen->areabase.first; area; area = area->next) {
|
||||
if (ELEM(area->butspacetype, SPACE_TIME, SPACE_LOGIC)) {
|
||||
/* Areas that were already handled won't be handled again */
|
||||
|
@ -848,39 +848,39 @@ void do_versions_after_linking_280(Main *main)
|
|||
}
|
||||
|
||||
#ifdef USE_COLLECTION_COMPAT_28
|
||||
if (use_collection_compat_28 && !MAIN_VERSION_ATLEAST(main, 280, 14)) {
|
||||
for (Collection *group = main->collection.first; group; group = group->id.next) {
|
||||
do_version_group_collection_to_collection(main, group);
|
||||
if (use_collection_compat_28 && !MAIN_VERSION_ATLEAST(bmain, 280, 14)) {
|
||||
for (Collection *group = bmain->collection.first; group; group = group->id.next) {
|
||||
do_version_group_collection_to_collection(bmain, group);
|
||||
}
|
||||
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
do_version_scene_collection_to_collection(main, scene);
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
do_version_scene_collection_to_collection(bmain, scene);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
||||
void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
{
|
||||
bool use_collection_compat_28 = true;
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 280, 0)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 0)) {
|
||||
use_collection_compat_28 = false;
|
||||
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
scene->r.gauss = 1.5f;
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 280, 1)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 1)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "bleedexp")) {
|
||||
for (Lamp *la = main->lamp.first; la; la = la->id.next) {
|
||||
for (Lamp *la = bmain->lamp.first; la; la = la->id.next) {
|
||||
la->bleedexp = 2.5f;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "GPUDOFSettings", "float", "ratio")) {
|
||||
for (Camera *ca = main->camera.first; ca; ca = ca->id.next) {
|
||||
for (Camera *ca = bmain->camera.first; ca; ca = ca->id.next) {
|
||||
ca->gpu_dof.ratio = 1.0f;
|
||||
}
|
||||
}
|
||||
|
@ -888,7 +888,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
/* MTexPoly now removed. */
|
||||
if (DNA_struct_find(fd->filesdna, "MTexPoly")) {
|
||||
const int cd_mtexpoly = 15; /* CD_MTEXPOLY, deprecated */
|
||||
for (Mesh *me = main->mesh.first; me; me = me->id.next) {
|
||||
for (Mesh *me = bmain->mesh.first; me; me = me->id.next) {
|
||||
/* If we have UV's, so this file will have MTexPoly layers too! */
|
||||
if (me->mloopuv != NULL) {
|
||||
CustomData_update_typemap(&me->pdata);
|
||||
|
@ -899,9 +899,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 280, 2)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 2)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "cascade_max_dist")) {
|
||||
for (Lamp *la = main->lamp.first; la; la = la->id.next) {
|
||||
for (Lamp *la = bmain->lamp.first; la; la = la->id.next) {
|
||||
la->cascade_max_dist = 1000.0f;
|
||||
la->cascade_count = 4;
|
||||
la->cascade_exponent = 0.8f;
|
||||
|
@ -910,7 +910,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "contact_dist")) {
|
||||
for (Lamp *la = main->lamp.first; la; la = la->id.next) {
|
||||
for (Lamp *la = bmain->lamp.first; la; la = la->id.next) {
|
||||
la->contact_dist = 1.0f;
|
||||
la->contact_bias = 0.03f;
|
||||
la->contact_spread = 0.2f;
|
||||
|
@ -919,7 +919,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "LightProbe", "float", "vis_bias")) {
|
||||
for (LightProbe *probe = main->lightprobe.first; probe; probe = probe->id.next) {
|
||||
for (LightProbe *probe = bmain->lightprobe.first; probe; probe = probe->id.next) {
|
||||
probe->vis_bias = 1.0f;
|
||||
probe->vis_blur = 0.2f;
|
||||
}
|
||||
|
@ -938,7 +938,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
* Also, metallic node is now unified into the principled node. */
|
||||
eNTreeDoVersionErrors error = NTREE_DOVERSION_NO_ERROR;
|
||||
|
||||
FOREACH_NODETREE(main, ntree, id) {
|
||||
FOREACH_NODETREE(bmain, ntree, id) {
|
||||
if (ntree->type == NTREE_SHADER) {
|
||||
for (bNode *node = ntree->nodes.first; node; node = node->next) {
|
||||
if (node->type == 194 /* SH_NODE_EEVEE_METALLIC */ &&
|
||||
|
@ -987,7 +987,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
(DNA_struct_elem_find(fd->filesdna, "ViewLayer", "FreestyleConfig", "freestyle_config") == false) &&
|
||||
DNA_struct_elem_find(fd->filesdna, "Scene", "ListBase", "view_layers"))
|
||||
{
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
ViewLayer *view_layer;
|
||||
for (view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
|
||||
view_layer->flag |= VIEW_LAYER_FREESTYLE;
|
||||
|
@ -1002,15 +1002,15 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
|
||||
#ifdef USE_COLLECTION_COMPAT_28
|
||||
if (use_collection_compat_28 && !MAIN_VERSION_ATLEAST(main, 280, 3)) {
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
if (use_collection_compat_28 && !MAIN_VERSION_ATLEAST(bmain, 280, 3)) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
ViewLayer *view_layer;
|
||||
for (view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
|
||||
do_version_view_layer_visibility(view_layer);
|
||||
}
|
||||
}
|
||||
|
||||
for (Collection *group = main->collection.first; group; group = group->id.next) {
|
||||
for (Collection *group = bmain->collection.first; group; group = group->id.next) {
|
||||
if (group->view_layer != NULL) {
|
||||
do_version_view_layer_visibility(group->view_layer);
|
||||
}
|
||||
|
@ -1018,14 +1018,14 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 280, 6)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 6)) {
|
||||
if (DNA_struct_elem_find(fd->filesdna, "SpaceOops", "int", "filter") == false) {
|
||||
bScreen *sc;
|
||||
ScrArea *sa;
|
||||
SpaceLink *sl;
|
||||
|
||||
/* Update files using invalid (outdated) outlinevis Outliner values. */
|
||||
for (sc = main->screen.first; sc; sc = sc->id.next) {
|
||||
for (sc = bmain->screen.first; sc; sc = sc->id.next) {
|
||||
for (sa = sc->areabase.first; sa; sa = sa->next) {
|
||||
for (sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_OUTLINER) {
|
||||
|
@ -1047,12 +1047,12 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "LightProbe", "float", "intensity")) {
|
||||
for (LightProbe *probe = main->lightprobe.first; probe; probe = probe->id.next) {
|
||||
for (LightProbe *probe = bmain->lightprobe.first; probe; probe = probe->id.next) {
|
||||
probe->intensity = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
for (Object *ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
bConstraint *con, *con_next;
|
||||
con = ob->constraints.first;
|
||||
while (con) {
|
||||
|
@ -1067,12 +1067,12 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Scene", "int", "orientation_index_custom")) {
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
scene->orientation_index_custom = -1;
|
||||
}
|
||||
}
|
||||
|
||||
for (bScreen *sc = main->screen.first; sc; sc = sc->id.next) {
|
||||
for (bScreen *sc = bmain->screen.first; sc; sc = sc->id.next) {
|
||||
for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
|
||||
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_VIEW3D) {
|
||||
|
@ -1082,7 +1082,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
|
||||
/* Assume (demo) files written with 2.8 want to show
|
||||
* Eevee renders in the viewport. */
|
||||
if (MAIN_VERSION_ATLEAST(main, 280, 0)) {
|
||||
if (MAIN_VERSION_ATLEAST(bmain, 280, 0)) {
|
||||
v3d->drawtype = OB_MATERIAL;
|
||||
}
|
||||
}
|
||||
|
@ -1091,20 +1091,20 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 280, 7)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 7)) {
|
||||
/* Render engine storage moved elsewhere and back during 2.8
|
||||
* development, we assume any files saved in 2.8 had Eevee set
|
||||
* as scene render engine. */
|
||||
if (MAIN_VERSION_ATLEAST(main, 280, 0)) {
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
if (MAIN_VERSION_ATLEAST(bmain, 280, 0)) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
BLI_strncpy(scene->r.engine, RE_engine_id_BLENDER_EEVEE, sizeof(scene->r.engine));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 280, 8)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 8)) {
|
||||
/* Blender Internal removal */
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
if (STREQ(scene->r.engine, "BLENDER_RENDER") ||
|
||||
STREQ(scene->r.engine, "BLENDER_GAME"))
|
||||
{
|
||||
|
@ -1114,7 +1114,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
scene->r.bake_mode = 0;
|
||||
}
|
||||
|
||||
for (Tex *tex = main->tex.first; tex; tex = tex->id.next) {
|
||||
for (Tex *tex = bmain->tex.first; tex; tex = tex->id.next) {
|
||||
/* Removed envmap, pointdensity, voxeldata, ocean textures. */
|
||||
if (ELEM(tex->type, 10, 14, 15, 16)) {
|
||||
tex->type = 0;
|
||||
|
@ -1122,10 +1122,10 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 280, 11)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 11)) {
|
||||
|
||||
/* Remove info editor, but only if at the top of the window. */
|
||||
for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
/* Calculate window width/height from screen vertices */
|
||||
int win_width = 0, win_height = 0;
|
||||
for (ScrVert *vert = screen->vertbase.first; vert; vert = vert->next) {
|
||||
|
@ -1155,8 +1155,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 280, 11)) {
|
||||
for (Lamp *lamp = main->lamp.first; lamp; lamp = lamp->id.next) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 11)) {
|
||||
for (Lamp *lamp = bmain->lamp.first; lamp; lamp = lamp->id.next) {
|
||||
if (lamp->mode & (1 << 13)) { /* LA_SHAD_RAY */
|
||||
lamp->mode |= LA_SHADOW;
|
||||
lamp->mode &= ~(1 << 13);
|
||||
|
@ -1164,9 +1164,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 280, 12)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 12)) {
|
||||
/* Remove tool property regions. */
|
||||
for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (ELEM(sl->spacetype, SPACE_VIEW3D, SPACE_CLIP)) {
|
||||
|
@ -1186,16 +1186,16 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 280, 13)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 13)) {
|
||||
/* Initialize specular factor. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "spec_fac")) {
|
||||
for (Lamp *la = main->lamp.first; la; la = la->id.next) {
|
||||
for (Lamp *la = bmain->lamp.first; la; la = la->id.next) {
|
||||
la->spec_fac = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize new view3D options. */
|
||||
for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_VIEW3D) {
|
||||
|
@ -1214,10 +1214,10 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
|
||||
if (!DNA_struct_find(fd->filesdna, "View3DCursor")) {
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
unit_qt(scene->cursor.rotation);
|
||||
}
|
||||
for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_VIEW3D) {
|
||||
|
@ -1230,34 +1230,34 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 280, 14)) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 14)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Scene", "SceneDisplay", "display")) {
|
||||
/* Initialize new scene.SceneDisplay */
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
copy_v3_v3(scene->display.light_direction, (float[3]){-M_SQRT1_3, -M_SQRT1_3, M_SQRT1_3});
|
||||
}
|
||||
}
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SceneDisplay", "float", "shadow_shift")) {
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
scene->display.shadow_shift = 0.1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Object", "ObjectDisplay", "display")) {
|
||||
/* Initialize new object.ObjectDisplay */
|
||||
for (Object *ob = main->object.first; ob; ob = ob->id.next) {
|
||||
for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
ob->display.flag = OB_SHOW_SHADOW;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "char", "transform_pivot_point")) {
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
scene->toolsettings->transform_pivot_point = V3D_AROUND_CENTER_MEAN;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_find(fd->filesdna, "SceneEEVEE")) {
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
/* First set the default for all the properties. */
|
||||
|
||||
scene->eevee.gi_diffuse_bounces = 3;
|
||||
|
@ -1439,8 +1439,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(main, 280, 15)) {
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 280, 15)) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
scene->display.matcap_icon = 1;
|
||||
scene->display.matcap_type = CLAY_MATCAP_NONE;
|
||||
scene->display.matcap_hue = 0.5f;
|
||||
|
@ -1453,7 +1453,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
scene->display.matcap_ssao_samples = 16;
|
||||
}
|
||||
|
||||
for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_OUTLINER) {
|
||||
|
@ -1465,7 +1465,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
}
|
||||
|
||||
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
switch (scene->toolsettings->snap_mode) {
|
||||
case 0: scene->toolsettings->snap_mode = SCE_SNAP_MODE_INCREMENT; break;
|
||||
case 1: scene->toolsettings->snap_mode = SCE_SNAP_MODE_VERTEX ; break;
|
||||
|
@ -1486,7 +1486,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
|
||||
ParticleSettings *part;
|
||||
for (part = main->particle.first; part; part = part->id.next) {
|
||||
for (part = bmain->particle.first; part; part = part->id.next) {
|
||||
part->shape_flag = PART_SHAPE_CLOSE_TIP;
|
||||
part->shape = 0.0f;
|
||||
part->rad_root = 1.0f;
|
||||
|
@ -1498,9 +1498,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
{
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Material", "float", "roughness")) {
|
||||
for (Material *mat = main->mat.first; mat; mat = mat->id.next) {
|
||||
for (Material *mat = bmain->mat.first; mat; mat = mat->id.next) {
|
||||
if (mat->use_nodes) {
|
||||
if (MAIN_VERSION_ATLEAST(main, 280, 0)) {
|
||||
if (MAIN_VERSION_ATLEAST(bmain, 280, 0)) {
|
||||
mat->roughness = mat->gloss_mir;
|
||||
}
|
||||
else {
|
||||
|
@ -1513,7 +1513,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
mat->metallic = mat->ray_mirror;
|
||||
}
|
||||
|
||||
for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_VIEW3D) {
|
||||
|
@ -1526,7 +1526,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "float", "xray_alpha")) {
|
||||
for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_VIEW3D) {
|
||||
|
@ -1541,7 +1541,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
|
|||
StudioLight *default_matcap = BKE_studiolight_find_first(STUDIOLIGHT_ORIENTATION_VIEWNORMAL);
|
||||
/* when loading the internal file is loaded before the matcaps */
|
||||
if (default_matcap) {
|
||||
for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
|
||||
for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_VIEW3D) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4093,7 +4093,7 @@ bool BLO_write_file(
|
|||
* we should not have any relative paths, but if there
|
||||
* is somehow, an invalid or empty G.main->name it will
|
||||
* print an error, don't try make the absolute in this case. */
|
||||
BKE_bpath_absolute_convert(mainvar, G.main->name, NULL);
|
||||
BKE_bpath_absolute_convert(mainvar, BKE_main_blendfile_path_from_global(), NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ void ImagesExporter::export_UV_Image(Image *image, bool use_copies)
|
|||
|
||||
// make absolute source path
|
||||
BLI_strncpy(source_path, image->name, sizeof(source_path));
|
||||
BLI_path_abs(source_path, G.main->name);
|
||||
BLI_path_abs(source_path, BKE_main_blendfile_path_from_global());
|
||||
BLI_cleanup_path(NULL, source_path);
|
||||
|
||||
if (use_copies) {
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "BLI_string.h"
|
||||
#include "BKE_image.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_library.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_scene.h"
|
||||
|
||||
|
@ -100,11 +101,10 @@ void OutputOpenExrSingleLayerMultiViewOperation::deinitExecution()
|
|||
|
||||
if (width != 0 && height != 0) {
|
||||
void *exrhandle;
|
||||
Main *bmain = G.main; /* TODO, have this passed along */
|
||||
char filename[FILE_MAX];
|
||||
|
||||
BKE_image_path_from_imtype(
|
||||
filename, this->m_path, bmain->name, this->m_rd->cfra, R_IMF_IMTYPE_OPENEXR,
|
||||
filename, this->m_path, BKE_main_blendfile_path_from_global(), this->m_rd->cfra, R_IMF_IMTYPE_OPENEXR,
|
||||
(this->m_rd->scemode & R_EXTENSION) != 0, true, NULL);
|
||||
|
||||
exrhandle = this->get_handle(filename);
|
||||
|
@ -190,11 +190,10 @@ void OutputOpenExrMultiLayerMultiViewOperation::deinitExecution()
|
|||
|
||||
if (width != 0 && height != 0) {
|
||||
void *exrhandle;
|
||||
Main *bmain = G.main; /* TODO, have this passed along */
|
||||
char filename[FILE_MAX];
|
||||
|
||||
BKE_image_path_from_imtype(
|
||||
filename, this->m_path, bmain->name, this->m_rd->cfra, R_IMF_IMTYPE_MULTILAYER,
|
||||
filename, this->m_path, BKE_main_blendfile_path_from_global(), this->m_rd->cfra, R_IMF_IMTYPE_MULTILAYER,
|
||||
(this->m_rd->scemode & R_EXTENSION) != 0, true, NULL);
|
||||
|
||||
exrhandle = this->get_handle(filename);
|
||||
|
@ -283,7 +282,6 @@ void OutputStereoOperation::deinitExecution()
|
|||
if (BKE_scene_multiview_is_render_view_last(this->m_rd, this->m_viewName)) {
|
||||
ImBuf *ibuf[3] = {NULL};
|
||||
const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME};
|
||||
Main *bmain = G.main; /* TODO, have this passed along */
|
||||
char filename[FILE_MAX];
|
||||
int i;
|
||||
|
||||
|
@ -307,7 +305,7 @@ void OutputStereoOperation::deinitExecution()
|
|||
ibuf[2] = IMB_stereo3d_ImBuf(this->m_format, ibuf[0], ibuf[1]);
|
||||
|
||||
BKE_image_path_from_imformat(
|
||||
filename, this->m_path, bmain->name, this->m_rd->cfra, this->m_format,
|
||||
filename, this->m_path, BKE_main_blendfile_path_from_global(), this->m_rd->cfra, this->m_format,
|
||||
(this->m_rd->scemode & R_EXTENSION) != 0, true, NULL);
|
||||
|
||||
BKE_imbuf_write(ibuf[2], filename, this->m_format);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "BLI_string.h"
|
||||
#include "BKE_image.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_library.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_scene.h"
|
||||
|
||||
|
@ -185,7 +186,6 @@ void OutputSingleLayerOperation::deinitExecution()
|
|||
|
||||
int size = get_datatype_size(this->m_datatype);
|
||||
ImBuf *ibuf = IMB_allocImBuf(this->getWidth(), this->getHeight(), this->m_format->planes, 0);
|
||||
Main *bmain = G.main; /* TODO, have this passed along */
|
||||
char filename[FILE_MAX];
|
||||
const char *suffix;
|
||||
|
||||
|
@ -200,7 +200,7 @@ void OutputSingleLayerOperation::deinitExecution()
|
|||
suffix = BKE_scene_multiview_view_suffix_get(this->m_rd, this->m_viewName);
|
||||
|
||||
BKE_image_path_from_imformat(
|
||||
filename, this->m_path, bmain->name, this->m_rd->cfra, this->m_format,
|
||||
filename, this->m_path, BKE_main_blendfile_path_from_global(), this->m_rd->cfra, this->m_format,
|
||||
(this->m_rd->scemode & R_EXTENSION) != 0, true, suffix);
|
||||
|
||||
if (0 == BKE_imbuf_write(ibuf, filename, this->m_format))
|
||||
|
@ -271,14 +271,13 @@ void OutputOpenExrMultiLayerOperation::deinitExecution()
|
|||
unsigned int width = this->getWidth();
|
||||
unsigned int height = this->getHeight();
|
||||
if (width != 0 && height != 0) {
|
||||
Main *bmain = G.main; /* TODO, have this passed along */
|
||||
char filename[FILE_MAX];
|
||||
const char *suffix;
|
||||
void *exrhandle = IMB_exr_get_handle();
|
||||
|
||||
suffix = BKE_scene_multiview_view_suffix_get(this->m_rd, this->m_viewName);
|
||||
BKE_image_path_from_imtype(
|
||||
filename, this->m_path, bmain->name, this->m_rd->cfra, R_IMF_IMTYPE_MULTILAYER,
|
||||
filename, this->m_path, BKE_main_blendfile_path_from_global(), this->m_rd->cfra, R_IMF_IMTYPE_MULTILAYER,
|
||||
(this->m_rd->scemode & R_EXTENSION) != 0, true, suffix);
|
||||
BLI_make_existing_file(filename);
|
||||
|
||||
|
|
|
@ -957,7 +957,7 @@ static int editsource_text_edit(
|
|||
}
|
||||
|
||||
if (text == NULL) {
|
||||
text = BKE_text_load(bmain, filepath, bmain->name);
|
||||
text = BKE_text_load(bmain, filepath, BKE_main_blendfile_path(bmain));
|
||||
id_us_ensure_real(&text->id);
|
||||
}
|
||||
|
||||
|
|
|
@ -79,11 +79,11 @@ static int wm_alembic_export_invoke(bContext *C, wmOperator *op, const wmEvent *
|
|||
Main *bmain = CTX_data_main(C);
|
||||
char filepath[FILE_MAX];
|
||||
|
||||
if (bmain->name[0] == '\0') {
|
||||
if (BKE_main_blendfile_path(bmain)[0] == '\0') {
|
||||
BLI_strncpy(filepath, "untitled", sizeof(filepath));
|
||||
}
|
||||
else {
|
||||
BLI_strncpy(filepath, bmain->name, sizeof(filepath));
|
||||
BLI_strncpy(filepath, BKE_main_blendfile_path(bmain), sizeof(filepath));
|
||||
}
|
||||
|
||||
BLI_replace_extension(filepath, sizeof(filepath), ".abc");
|
||||
|
@ -422,12 +422,12 @@ static int get_sequence_len(char *filename, int *ofs)
|
|||
}
|
||||
|
||||
char path[FILE_MAX];
|
||||
BLI_path_abs(filename, G.main->name);
|
||||
BLI_path_abs(filename, BKE_main_blendfile_path_from_global());
|
||||
BLI_split_dir_part(filename, path, FILE_MAX);
|
||||
|
||||
if (path[0] == '\0') {
|
||||
/* The filename had no path, so just use the blend file path. */
|
||||
BLI_split_dir_part(G.main->name, path, FILE_MAX);
|
||||
BLI_split_dir_part(BKE_main_blendfile_path_from_global(), path, FILE_MAX);
|
||||
}
|
||||
|
||||
DIR *dir = opendir(path);
|
||||
|
|
|
@ -60,7 +60,7 @@ static int cachefile_open_invoke(bContext *C, wmOperator *op, const wmEvent *eve
|
|||
char filepath[FILE_MAX];
|
||||
Main *bmain = CTX_data_main(C);
|
||||
|
||||
BLI_strncpy(filepath, bmain->name, sizeof(filepath));
|
||||
BLI_strncpy(filepath, BKE_main_blendfile_path(bmain), sizeof(filepath));
|
||||
BLI_replace_extension(filepath, sizeof(filepath), ".abc");
|
||||
RNA_string_set(op->ptr, "filepath", filepath);
|
||||
}
|
||||
|
|
|
@ -61,13 +61,16 @@
|
|||
|
||||
static int wm_collada_export_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
|
||||
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
|
||||
char filepath[FILE_MAX];
|
||||
const char *blendfile_path = BKE_main_blendfile_path(bmain);
|
||||
|
||||
if (G.main->name[0] == 0)
|
||||
if (blendfile_path[0] == '\0')
|
||||
BLI_strncpy(filepath, "untitled", sizeof(filepath));
|
||||
else
|
||||
BLI_strncpy(filepath, G.main->name, sizeof(filepath));
|
||||
BLI_strncpy(filepath, blendfile_path, sizeof(filepath));
|
||||
|
||||
BLI_replace_extension(filepath, sizeof(filepath), ".dae");
|
||||
RNA_string_set(op->ptr, "filepath", filepath);
|
||||
|
|
|
@ -1021,7 +1021,8 @@ cage_cleanup:
|
|||
BakeData *bake = &scene->r.bake;
|
||||
char name[FILE_MAX];
|
||||
|
||||
BKE_image_path_from_imtype(name, filepath, bmain->name, 0, bake->im_format.imtype, true, false, NULL);
|
||||
BKE_image_path_from_imtype(name, filepath, BKE_main_blendfile_path(bmain),
|
||||
0, bake->im_format.imtype, true, false, NULL);
|
||||
|
||||
if (is_automatic_name) {
|
||||
BLI_path_suffix(name, FILE_MAX, ob_low->id.name + 2, "_");
|
||||
|
|
|
@ -1330,7 +1330,7 @@ static int multires_external_save_exec(bContext *C, wmOperator *op)
|
|||
RNA_string_get(op->ptr, "filepath", path);
|
||||
|
||||
if (relative)
|
||||
BLI_path_rel(path, bmain->name);
|
||||
BLI_path_rel(path, BKE_main_blendfile_path(bmain));
|
||||
|
||||
CustomData_external_add(&me->ldata, &me->id, CD_MDISPS, me->totloop, path);
|
||||
CustomData_external_write(&me->ldata, &me->id, CD_MASK_MESH, me->totloop, 0);
|
||||
|
|
|
@ -404,7 +404,7 @@ static void screen_opengl_render_write(OGLRender *oglrender)
|
|||
rr = RE_AcquireResultRead(oglrender->re);
|
||||
|
||||
BKE_image_path_from_imformat(
|
||||
name, scene->r.pic, oglrender->bmain->name, scene->r.cfra,
|
||||
name, scene->r.pic, BKE_main_blendfile_path(oglrender->bmain), scene->r.cfra,
|
||||
&scene->r.im_format, (scene->r.scemode & R_EXTENSION) != 0, false, NULL);
|
||||
|
||||
/* write images as individual images or stereo */
|
||||
|
@ -943,7 +943,7 @@ static void write_result_func(TaskPool * __restrict pool,
|
|||
char name[FILE_MAX];
|
||||
BKE_image_path_from_imformat(name,
|
||||
scene->r.pic,
|
||||
oglrender->bmain->name,
|
||||
BKE_main_blendfile_path(oglrender->bmain),
|
||||
cfra,
|
||||
&scene->r.im_format,
|
||||
(scene->r.scemode & R_EXTENSION) != 0,
|
||||
|
@ -1030,7 +1030,7 @@ static bool screen_opengl_render_anim_step(bContext *C, wmOperator *op)
|
|||
|
||||
if (!is_movie) {
|
||||
BKE_image_path_from_imformat(
|
||||
name, scene->r.pic, oglrender->bmain->name, scene->r.cfra,
|
||||
name, scene->r.pic, BKE_main_blendfile_path(oglrender->bmain), scene->r.cfra,
|
||||
&scene->r.im_format, (scene->r.scemode & R_EXTENSION) != 0, true, NULL);
|
||||
|
||||
if ((scene->r.mode & R_NO_OVERWRITE) && BLI_exists(name)) {
|
||||
|
|
|
@ -122,7 +122,7 @@ ImBuf *get_brush_icon(Brush *brush)
|
|||
// first use the path directly to try and load the file
|
||||
|
||||
BLI_strncpy(path, brush->icon_filepath, sizeof(brush->icon_filepath));
|
||||
BLI_path_abs(path, G.main->name);
|
||||
BLI_path_abs(path, BKE_main_blendfile_path_from_global());
|
||||
|
||||
/* use default colorspaces for brushes */
|
||||
brush->icon_imbuf = IMB_loadiffname(path, flags, NULL);
|
||||
|
@ -131,7 +131,7 @@ ImBuf *get_brush_icon(Brush *brush)
|
|||
if (!(brush->icon_imbuf)) {
|
||||
folder = BKE_appdir_folder_id(BLENDER_DATAFILES, "brushicons");
|
||||
|
||||
BLI_make_file_string(G.main->name, path, folder, brush->icon_filepath);
|
||||
BLI_make_file_string(BKE_main_blendfile_path_from_global(), path, folder, brush->icon_filepath);
|
||||
|
||||
if (path[0]) {
|
||||
/* use fefault color spaces */
|
||||
|
@ -319,7 +319,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
|
|||
Scene *sce;
|
||||
Main *pr_main = sp->pr_main;
|
||||
|
||||
memcpy(pr_main->name, bmain->name, sizeof(pr_main->name));
|
||||
memcpy(pr_main->name, BKE_main_blendfile_path(bmain), sizeof(pr_main->name));
|
||||
|
||||
sce = preview_get_scene(pr_main);
|
||||
if (sce) {
|
||||
|
|
|
@ -194,7 +194,7 @@ static int screenshot_exec(bContext *C, wmOperator *op)
|
|||
char path[FILE_MAX];
|
||||
|
||||
RNA_string_get(op->ptr, "filepath", path);
|
||||
BLI_path_abs(path, G.main->name);
|
||||
BLI_path_abs(path, BKE_main_blendfile_path_from_global());
|
||||
|
||||
/* operator ensures the extension */
|
||||
ibuf = IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0);
|
||||
|
@ -233,7 +233,7 @@ static int screenshot_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
|
|||
/* extension is added by 'screenshot_check' after */
|
||||
char filepath[FILE_MAX] = "//screen";
|
||||
if (G.relbase_valid) {
|
||||
BLI_strncpy(filepath, G.main->name, sizeof(filepath));
|
||||
BLI_strncpy(filepath, BKE_main_blendfile_path_from_global(), sizeof(filepath));
|
||||
BLI_replace_extension(filepath, sizeof(filepath), ""); /* strip '.blend' */
|
||||
}
|
||||
RNA_string_set(op->ptr, "filepath", filepath);
|
||||
|
@ -409,7 +409,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
|
|||
int ok;
|
||||
|
||||
BKE_image_path_from_imformat(
|
||||
name, rd.pic, sj->bmain->name, rd.cfra,
|
||||
name, rd.pic, BKE_main_blendfile_path(sj->bmain), rd.cfra,
|
||||
&rd.im_format, (rd.scemode & R_EXTENSION) != 0, true, NULL);
|
||||
|
||||
ibuf->rect = sj->dumprect;
|
||||
|
|
|
@ -375,7 +375,7 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op)
|
|||
specs.rate = scene->r.ffcodecdata.audio_mixrate;
|
||||
|
||||
BLI_strncpy(filename, path, sizeof(filename));
|
||||
BLI_path_abs(filename, bmain->name);
|
||||
BLI_path_abs(filename, BKE_main_blendfile_path(bmain));
|
||||
|
||||
if (split)
|
||||
result = AUD_mixdown_per_channel(scene->sound_scene, SFRA * specs.rate / FPS, (EFRA - SFRA + 1) * specs.rate / FPS,
|
||||
|
|
|
@ -102,6 +102,7 @@ typedef struct FileBrowseOp {
|
|||
|
||||
static int file_browse_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
FileBrowseOp *fbo = op->customdata;
|
||||
ID *id;
|
||||
char *str, path[FILE_MAX];
|
||||
|
@ -118,14 +119,14 @@ static int file_browse_exec(bContext *C, wmOperator *op)
|
|||
id = fbo->ptr.id.data;
|
||||
|
||||
BLI_strncpy(path, str, FILE_MAX);
|
||||
BLI_path_abs(path, id ? ID_BLEND_PATH(G.main, id) : G.main->name);
|
||||
BLI_path_abs(path, id ? ID_BLEND_PATH(bmain, id) : BKE_main_blendfile_path(bmain));
|
||||
|
||||
if (BLI_is_dir(path)) {
|
||||
/* do this first so '//' isnt converted to '//\' on windows */
|
||||
BLI_add_slash(path);
|
||||
if (is_relative) {
|
||||
BLI_strncpy(path, str, FILE_MAX);
|
||||
BLI_path_rel(path, G.main->name);
|
||||
BLI_path_rel(path, BKE_main_blendfile_path(bmain));
|
||||
str = MEM_reallocN(str, strlen(path) + 2);
|
||||
BLI_strncpy(str, path, FILE_MAX);
|
||||
}
|
||||
|
|
|
@ -318,7 +318,7 @@ static int reload_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
if (!clip)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
BKE_movieclip_reload(clip);
|
||||
BKE_movieclip_reload(CTX_data_main(C), clip);
|
||||
|
||||
WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip);
|
||||
|
||||
|
@ -1315,7 +1315,7 @@ static void proxy_endjob(void *pjv)
|
|||
|
||||
if (pj->clip->source == MCLIP_SRC_MOVIE) {
|
||||
/* Timecode might have changed, so do a full reload to deal with this. */
|
||||
BKE_movieclip_reload(pj->clip);
|
||||
BKE_movieclip_reload(pj->main, pj->clip);
|
||||
}
|
||||
else {
|
||||
/* For image sequences we'll preserve original cache. */
|
||||
|
|
|
@ -424,6 +424,7 @@ static void file_draw_preview(
|
|||
|
||||
static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
char newname[FILE_MAX + 12];
|
||||
char orgname[FILE_MAX + 12];
|
||||
char filename[FILE_MAX + 12];
|
||||
|
@ -432,10 +433,11 @@ static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
|
|||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
|
||||
BLI_make_file_string(G.main->name, orgname, sfile->params->dir, oldname);
|
||||
const char *blendfile_path = BKE_main_blendfile_path(bmain);
|
||||
BLI_make_file_string(blendfile_path, orgname, sfile->params->dir, oldname);
|
||||
BLI_strncpy(filename, sfile->params->renameedit, sizeof(filename));
|
||||
BLI_filename_make_safe(filename);
|
||||
BLI_make_file_string(G.main->name, newname, sfile->params->dir, filename);
|
||||
BLI_make_file_string(blendfile_path, newname, sfile->params->dir, filename);
|
||||
|
||||
if (!STREQ(orgname, newname)) {
|
||||
if (!BLI_exists(newname)) {
|
||||
|
|
|
@ -109,9 +109,9 @@ void file_filename_enter_handle(bContext *C, void *arg_unused, void *arg_but);
|
|||
int file_highlight_set(struct SpaceFile *sfile, struct ARegion *ar, int mx, int my);
|
||||
|
||||
void file_sfile_filepath_set(struct SpaceFile *sfile, const char *filepath);
|
||||
void file_sfile_to_operator_ex(struct wmOperator *op, struct SpaceFile *sfile, char *filepath);
|
||||
void file_sfile_to_operator(struct wmOperator *op, struct SpaceFile *sfile);
|
||||
void file_operator_to_sfile(struct SpaceFile *sfile, struct wmOperator *op);
|
||||
void file_sfile_to_operator_ex(bContext *C, struct wmOperator *op, struct SpaceFile *sfile, char *filepath);
|
||||
void file_sfile_to_operator(bContext *C, struct wmOperator *op, struct SpaceFile *sfile);
|
||||
void file_operator_to_sfile(bContext *C, struct SpaceFile *sfile, struct wmOperator *op);
|
||||
|
||||
|
||||
/* filesel.c */
|
||||
|
|
|
@ -176,6 +176,7 @@ static FileSelection file_selection_get(bContext *C, const rcti *rect, bool fill
|
|||
|
||||
static FileSelect file_select_do(bContext *C, int selected_idx, bool do_diropen)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
FileSelect retval = FILE_SELECT_NOTHING;
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
FileSelectParams *params = ED_fileselect_get_params(sfile);
|
||||
|
@ -213,7 +214,7 @@ static FileSelect file_select_do(bContext *C, int selected_idx, bool do_diropen)
|
|||
}
|
||||
}
|
||||
else {
|
||||
BLI_cleanup_dir(G.main->name, params->dir);
|
||||
BLI_cleanup_dir(BKE_main_blendfile_path(bmain), params->dir);
|
||||
strcat(params->dir, file->relpath);
|
||||
BLI_add_slash(params->dir);
|
||||
}
|
||||
|
@ -826,6 +827,7 @@ void FILE_OT_select_all_toggle(wmOperatorType *ot)
|
|||
/* Note we could get rid of this one, but it's used by some addon so... Does not hurt keeping it around for now. */
|
||||
static int bookmark_select_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
PropertyRNA *prop;
|
||||
|
||||
|
@ -835,7 +837,7 @@ static int bookmark_select_exec(bContext *C, wmOperator *op)
|
|||
|
||||
RNA_property_string_get(op->ptr, prop, entry);
|
||||
BLI_strncpy(params->dir, entry, sizeof(params->dir));
|
||||
BLI_cleanup_dir(G.main->name, params->dir);
|
||||
BLI_cleanup_dir(BKE_main_blendfile_path(bmain), params->dir);
|
||||
ED_file_change_dir(C);
|
||||
|
||||
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
|
||||
|
@ -1200,15 +1202,16 @@ void FILE_OT_cancel(struct wmOperatorType *ot)
|
|||
}
|
||||
|
||||
|
||||
void file_sfile_to_operator_ex(wmOperator *op, SpaceFile *sfile, char *filepath)
|
||||
void file_sfile_to_operator_ex(bContext *C, wmOperator *op, SpaceFile *sfile, char *filepath)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
PropertyRNA *prop;
|
||||
|
||||
BLI_join_dirfile(filepath, FILE_MAX, sfile->params->dir, sfile->params->file); /* XXX, not real length */
|
||||
|
||||
if ((prop = RNA_struct_find_property(op->ptr, "relative_path"))) {
|
||||
if (RNA_property_boolean_get(op->ptr, prop)) {
|
||||
BLI_path_rel(filepath, G.main->name);
|
||||
BLI_path_rel(filepath, BKE_main_blendfile_path(bmain));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1270,15 +1273,16 @@ void file_sfile_to_operator_ex(wmOperator *op, SpaceFile *sfile, char *filepath)
|
|||
|
||||
}
|
||||
}
|
||||
void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile)
|
||||
void file_sfile_to_operator(bContext *C, wmOperator *op, SpaceFile *sfile)
|
||||
{
|
||||
char filepath[FILE_MAX];
|
||||
|
||||
file_sfile_to_operator_ex(op, sfile, filepath);
|
||||
file_sfile_to_operator_ex(C, op, sfile, filepath);
|
||||
}
|
||||
|
||||
void file_operator_to_sfile(SpaceFile *sfile, wmOperator *op)
|
||||
void file_operator_to_sfile(bContext *C, SpaceFile *sfile, wmOperator *op)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
PropertyRNA *prop;
|
||||
|
||||
/* If neither of the above are set, split the filepath back */
|
||||
|
@ -1298,7 +1302,7 @@ void file_operator_to_sfile(SpaceFile *sfile, wmOperator *op)
|
|||
|
||||
/* we could check for relative_path property which is used when converting
|
||||
* in the other direction but doesnt hurt to do this every time */
|
||||
BLI_path_abs(sfile->params->dir, G.main->name);
|
||||
BLI_path_abs(sfile->params->dir, BKE_main_blendfile_path(bmain));
|
||||
|
||||
/* XXX, files and dirs updates missing, not really so important though */
|
||||
}
|
||||
|
@ -1330,11 +1334,11 @@ void file_draw_check(bContext *C)
|
|||
wmOperator *op = sfile->op;
|
||||
if (op) { /* fail on reload */
|
||||
if (op->type->check) {
|
||||
file_sfile_to_operator(op, sfile);
|
||||
file_sfile_to_operator(C, op, sfile);
|
||||
|
||||
/* redraw */
|
||||
if (op->type->check(C, op)) {
|
||||
file_operator_to_sfile(sfile, op);
|
||||
file_operator_to_sfile(C, sfile, op);
|
||||
|
||||
/* redraw, else the changed settings wont get updated */
|
||||
ED_area_tag_redraw(CTX_wm_area(C));
|
||||
|
@ -1369,6 +1373,7 @@ bool file_draw_check_exists(SpaceFile *sfile)
|
|||
|
||||
int file_exec(bContext *C, wmOperator *exec_op)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
const struct FileDirEntry *file = filelist_file(sfile->files, sfile->params->active_file);
|
||||
|
@ -1384,7 +1389,7 @@ int file_exec(bContext *C, wmOperator *exec_op)
|
|||
BLI_parent_dir(sfile->params->dir);
|
||||
}
|
||||
else {
|
||||
BLI_cleanup_path(G.main->name, sfile->params->dir);
|
||||
BLI_cleanup_path(BKE_main_blendfile_path(bmain), sfile->params->dir);
|
||||
BLI_path_append(sfile->params->dir, sizeof(sfile->params->dir) - 1, file->relpath);
|
||||
BLI_add_slash(sfile->params->dir);
|
||||
}
|
||||
|
@ -1413,14 +1418,14 @@ int file_exec(bContext *C, wmOperator *exec_op)
|
|||
|
||||
sfile->op = NULL;
|
||||
|
||||
file_sfile_to_operator_ex(op, sfile, filepath);
|
||||
file_sfile_to_operator_ex(C, op, sfile, filepath);
|
||||
|
||||
if (BLI_exists(sfile->params->dir)) {
|
||||
fsmenu_insert_entry(ED_fsmenu_get(), FS_CATEGORY_RECENT, sfile->params->dir, NULL,
|
||||
FS_INSERT_SAVE | FS_INSERT_FIRST);
|
||||
}
|
||||
|
||||
BLI_make_file_string(G.main->name, filepath, BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL),
|
||||
BLI_make_file_string(BKE_main_blendfile_path(bmain), filepath, BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL),
|
||||
BLENDER_BOOKMARK_FILE);
|
||||
fsmenu_write_file(ED_fsmenu_get(), filepath);
|
||||
WM_event_fileselect_event(wm, op, EVT_FILESELECT_EXEC);
|
||||
|
@ -1452,11 +1457,12 @@ void FILE_OT_execute(struct wmOperatorType *ot)
|
|||
|
||||
int file_parent_exec(bContext *C, wmOperator *UNUSED(unused))
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
|
||||
if (sfile->params) {
|
||||
if (BLI_parent_dir(sfile->params->dir)) {
|
||||
BLI_cleanup_dir(G.main->name, sfile->params->dir);
|
||||
BLI_cleanup_dir(BKE_main_blendfile_path(bmain), sfile->params->dir);
|
||||
ED_file_change_dir(C);
|
||||
if (sfile->params->recursion_level > 1) {
|
||||
/* Disable 'dirtree' recursion when going up in tree. */
|
||||
|
@ -1694,7 +1700,7 @@ static int filepath_drop_exec(bContext *C, wmOperator *op)
|
|||
file_sfile_filepath_set(sfile, filepath);
|
||||
|
||||
if (sfile->op) {
|
||||
file_sfile_to_operator(sfile->op, sfile);
|
||||
file_sfile_to_operator(C, sfile->op, sfile);
|
||||
file_draw_check(C);
|
||||
}
|
||||
|
||||
|
@ -1840,12 +1846,13 @@ void FILE_OT_directory_new(struct wmOperatorType *ot)
|
|||
/* TODO This should go to BLI_path_utils. */
|
||||
static void file_expand_directory(bContext *C)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
|
||||
if (sfile->params) {
|
||||
if (BLI_path_is_rel(sfile->params->dir)) {
|
||||
/* Use of 'default' folder here is just to avoid an error message on '//' prefix. */
|
||||
BLI_path_abs(sfile->params->dir, G.relbase_valid ? G.main->name : BKE_appdir_folder_default());
|
||||
BLI_path_abs(sfile->params->dir, G.relbase_valid ? BKE_main_blendfile_path(bmain) : BKE_appdir_folder_default());
|
||||
}
|
||||
else if (sfile->params->dir[0] == '~') {
|
||||
char tmpstr[sizeof(sfile->params->dir) - 1];
|
||||
|
@ -1898,6 +1905,7 @@ static bool can_create_dir(const char *dir)
|
|||
|
||||
void file_directory_enter_handle(bContext *C, void *UNUSED(arg_unused), void *UNUSED(arg_but))
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
|
||||
if (sfile->params) {
|
||||
|
@ -1928,7 +1936,7 @@ void file_directory_enter_handle(bContext *C, void *UNUSED(arg_unused), void *UN
|
|||
}
|
||||
}
|
||||
|
||||
BLI_cleanup_dir(G.main->name, sfile->params->dir);
|
||||
BLI_cleanup_dir(BKE_main_blendfile_path(bmain), sfile->params->dir);
|
||||
|
||||
if (filelist_is_dir(sfile->files, sfile->params->dir)) {
|
||||
/* if directory exists, enter it immediately */
|
||||
|
@ -1975,6 +1983,7 @@ void file_directory_enter_handle(bContext *C, void *UNUSED(arg_unused), void *UN
|
|||
|
||||
void file_filename_enter_handle(bContext *C, void *UNUSED(arg_unused), void *arg_but)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
uiBut *but = arg_but;
|
||||
char matched_file[FILE_MAX];
|
||||
|
@ -2004,7 +2013,7 @@ void file_filename_enter_handle(bContext *C, void *UNUSED(arg_unused), void *arg
|
|||
|
||||
/* if directory, open it and empty filename field */
|
||||
if (filelist_is_dir(sfile->files, filepath)) {
|
||||
BLI_cleanup_dir(G.main->name, filepath);
|
||||
BLI_cleanup_dir(BKE_main_blendfile_path(bmain), filepath);
|
||||
BLI_strncpy(sfile->params->dir, filepath, sizeof(sfile->params->dir));
|
||||
sfile->params->file[0] = '\0';
|
||||
ED_file_change_dir(C);
|
||||
|
@ -2269,6 +2278,7 @@ static int file_delete_poll(bContext *C)
|
|||
int file_delete_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
char str[FILE_MAX];
|
||||
Main *bmain = CTX_data_main(C);
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
|
@ -2281,7 +2291,7 @@ int file_delete_exec(bContext *C, wmOperator *op)
|
|||
for (i = 0; i < numfiles; i++) {
|
||||
if (filelist_entry_select_index_get(sfile->files, i, CHECK_FILES)) {
|
||||
file = filelist_file(sfile->files, i);
|
||||
BLI_make_file_string(G.main->name, str, sfile->params->dir, file->relpath);
|
||||
BLI_make_file_string(BKE_main_blendfile_path(bmain), str, sfile->params->dir, file->relpath);
|
||||
if (BLI_delete(str, false, false) != 0 ||
|
||||
BLI_exists(str))
|
||||
{
|
||||
|
|
|
@ -1419,7 +1419,7 @@ void filelist_setdir(struct FileList *filelist, char *r_dir)
|
|||
{
|
||||
BLI_assert(strlen(r_dir) < FILE_MAX_LIBEXTRA);
|
||||
|
||||
BLI_cleanup_dir(G.main->name, r_dir);
|
||||
BLI_cleanup_dir(BKE_main_blendfile_path_from_global(), r_dir);
|
||||
const bool is_valid_path = filelist->checkdirf(filelist, r_dir, true);
|
||||
BLI_assert(is_valid_path);
|
||||
UNUSED_VARS_NDEBUG(is_valid_path);
|
||||
|
@ -2700,13 +2700,14 @@ static void filelist_readjob_free(void *flrjv)
|
|||
|
||||
void filelist_readjob_start(FileList *filelist, const bContext *C)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
wmJob *wm_job;
|
||||
FileListReadJob *flrj;
|
||||
|
||||
/* prepare job data */
|
||||
flrj = MEM_callocN(sizeof(*flrj), __func__);
|
||||
flrj->filelist = filelist;
|
||||
BLI_strncpy(flrj->main_name, G.main->name, sizeof(flrj->main_name));
|
||||
BLI_strncpy(flrj->main_name, BKE_main_blendfile_path(bmain), sizeof(flrj->main_name));
|
||||
|
||||
filelist->flags &= ~(FL_FORCE_RESET | FL_IS_READY);
|
||||
filelist->flags |= FL_IS_PENDING;
|
||||
|
|
|
@ -96,11 +96,13 @@ short ED_fileselect_set_params(SpaceFile *sfile)
|
|||
FileSelectParams *params;
|
||||
wmOperator *op = sfile->op;
|
||||
|
||||
const char *blendfile_path = BKE_main_blendfile_path_from_global();
|
||||
|
||||
/* create new parameters if necessary */
|
||||
if (!sfile->params) {
|
||||
sfile->params = MEM_callocN(sizeof(FileSelectParams), "fileselparams");
|
||||
/* set path to most recently opened .blend */
|
||||
BLI_split_dirfile(G.main->name, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file));
|
||||
BLI_split_dirfile(blendfile_path, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file));
|
||||
sfile->params->filter_glob[0] = '\0';
|
||||
/* set the default thumbnails size */
|
||||
sfile->params->thumbnail_size = 128;
|
||||
|
@ -149,8 +151,8 @@ short ED_fileselect_set_params(SpaceFile *sfile)
|
|||
}
|
||||
|
||||
if (params->dir[0]) {
|
||||
BLI_cleanup_dir(G.main->name, params->dir);
|
||||
BLI_path_abs(params->dir, G.main->name);
|
||||
BLI_cleanup_dir(blendfile_path, params->dir);
|
||||
BLI_path_abs(params->dir, blendfile_path);
|
||||
}
|
||||
|
||||
if (is_directory == true && is_filename == false && is_filepath == false && is_files == false) {
|
||||
|
@ -283,8 +285,8 @@ short ED_fileselect_set_params(SpaceFile *sfile)
|
|||
sfile->folders_prev = folderlist_new();
|
||||
|
||||
if (!sfile->params->dir[0]) {
|
||||
if (G.main->name[0]) {
|
||||
BLI_split_dir_part(G.main->name, sfile->params->dir, sizeof(sfile->params->dir));
|
||||
if (blendfile_path[0] != '\0') {
|
||||
BLI_split_dir_part(blendfile_path, sfile->params->dir, sizeof(sfile->params->dir));
|
||||
}
|
||||
else {
|
||||
const char *doc_path = BKE_appdir_folder_default();
|
||||
|
|
|
@ -227,7 +227,7 @@ static int space_image_file_exists_poll(bContext *C)
|
|||
ibuf = ED_space_image_acquire_buffer(sima, &lock);
|
||||
if (ibuf) {
|
||||
BLI_strncpy(name, ibuf->name, FILE_MAX);
|
||||
BLI_path_abs(name, bmain->name);
|
||||
BLI_path_abs(name, BKE_main_blendfile_path(bmain));
|
||||
|
||||
if (BLI_exists(name) == false) {
|
||||
CTX_wm_operator_poll_msg_set(C, "image file not found");
|
||||
|
@ -1263,11 +1263,11 @@ static int image_open_exec(bContext *C, wmOperator *op)
|
|||
BLI_strncpy(filepath_range, frame_range->filepath, sizeof(filepath_range));
|
||||
|
||||
if (was_relative) {
|
||||
BLI_path_rel(filepath_range, bmain->name);
|
||||
BLI_path_rel(filepath_range, BKE_main_blendfile_path(bmain));
|
||||
}
|
||||
|
||||
Image *ima_range = image_open_single(
|
||||
op, filepath_range, bmain->name,
|
||||
op, filepath_range, BKE_main_blendfile_path(bmain),
|
||||
is_relative_path, use_multiview, frame_range_seq_len);
|
||||
|
||||
/* take the first image */
|
||||
|
@ -1282,7 +1282,7 @@ static int image_open_exec(bContext *C, wmOperator *op)
|
|||
else {
|
||||
/* for drag & drop etc. */
|
||||
ima = image_open_single(
|
||||
op, filepath, bmain->name,
|
||||
op, filepath, BKE_main_blendfile_path(bmain),
|
||||
is_relative_path, use_multiview, 1);
|
||||
}
|
||||
|
||||
|
@ -1692,12 +1692,12 @@ static int save_image_options_init(Main *bmain, SaveImageOptions *simopts, Space
|
|||
}
|
||||
else {
|
||||
BLI_strncpy(simopts->filepath, "//untitled", sizeof(simopts->filepath));
|
||||
BLI_path_abs(simopts->filepath, bmain->name);
|
||||
BLI_path_abs(simopts->filepath, BKE_main_blendfile_path(bmain));
|
||||
}
|
||||
}
|
||||
else {
|
||||
BLI_snprintf(simopts->filepath, sizeof(simopts->filepath), "//%s", ima->id.name + 2);
|
||||
BLI_path_abs(simopts->filepath, is_prev_save ? G.ima : bmain->name);
|
||||
BLI_path_abs(simopts->filepath, is_prev_save ? G.ima : BKE_main_blendfile_path(bmain));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1721,7 +1721,7 @@ static void save_image_options_from_op(Main *bmain, SaveImageOptions *simopts, w
|
|||
|
||||
if (RNA_struct_property_is_set(op->ptr, "filepath")) {
|
||||
RNA_string_get(op->ptr, "filepath", simopts->filepath);
|
||||
BLI_path_abs(simopts->filepath, bmain->name);
|
||||
BLI_path_abs(simopts->filepath, BKE_main_blendfile_path(bmain));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2302,7 +2302,7 @@ static int image_save_sequence_exec(bContext *C, wmOperator *op)
|
|||
char name[FILE_MAX];
|
||||
BLI_strncpy(name, ibuf->name, sizeof(name));
|
||||
|
||||
BLI_path_abs(name, bmain->name);
|
||||
BLI_path_abs(name, BKE_main_blendfile_path(bmain));
|
||||
|
||||
if (0 == IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat)) {
|
||||
BKE_reportf(op->reports, RPT_ERROR, "Could not write image: %s", strerror(errno));
|
||||
|
|
|
@ -364,7 +364,7 @@ static int make_paths_relative_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
BKE_bpath_relative_convert(bmain, bmain->name, op->reports);
|
||||
BKE_bpath_relative_convert(bmain, BKE_main_blendfile_path(bmain), op->reports);
|
||||
|
||||
/* redraw everything so any changed paths register */
|
||||
WM_main_add_notifier(NC_WINDOW, NULL);
|
||||
|
@ -397,7 +397,7 @@ static int make_paths_absolute_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
BKE_bpath_absolute_convert(bmain, bmain->name, op->reports);
|
||||
BKE_bpath_absolute_convert(bmain, BKE_main_blendfile_path(bmain), op->reports);
|
||||
|
||||
/* redraw everything so any changed paths register */
|
||||
WM_main_add_notifier(NC_WINDOW, NULL);
|
||||
|
|
|
@ -310,7 +310,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
|
|||
BKE_library_filepath_set(bmain, lib, lib->name);
|
||||
|
||||
BLI_strncpy(expanded, lib->name, sizeof(expanded));
|
||||
BLI_path_abs(expanded, bmain->name);
|
||||
BLI_path_abs(expanded, BKE_main_blendfile_path(bmain));
|
||||
if (!BLI_exists(expanded)) {
|
||||
BKE_reportf(CTX_wm_reports(C), RPT_ERROR,
|
||||
"Library path '%s' does not exist, correct this before saving", expanded);
|
||||
|
|
|
@ -117,7 +117,7 @@ static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op,
|
|||
Main *bmain = CTX_data_main(C);
|
||||
char path[FILE_MAX];
|
||||
BLI_strncpy(path, last_seq->strip->dir, sizeof(path));
|
||||
BLI_path_abs(path, bmain->name);
|
||||
BLI_path_abs(path, BKE_main_blendfile_path(bmain));
|
||||
RNA_string_set(op->ptr, identifier, path);
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, bContext *C, wmOperato
|
|||
}
|
||||
|
||||
if ((is_file != -1) && relative)
|
||||
BLI_path_rel(seq_load->path, bmain->name);
|
||||
BLI_path_rel(seq_load->path, BKE_main_blendfile_path(bmain));
|
||||
|
||||
|
||||
if ((prop = RNA_struct_find_property(op->ptr, "frame_end"))) {
|
||||
|
|
|
@ -3753,7 +3753,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
|
|||
/* TODO, shouldn't this already be relative from the filesel?
|
||||
* (as the 'filepath' is) for now just make relative here,
|
||||
* but look into changing after 2.60 - campbell */
|
||||
BLI_path_rel(directory, bmain->name);
|
||||
BLI_path_rel(directory, BKE_main_blendfile_path(bmain));
|
||||
}
|
||||
BLI_strncpy(seq->strip->dir, directory, sizeof(seq->strip->dir));
|
||||
|
||||
|
@ -3869,10 +3869,10 @@ static int sequencer_export_subtitles_invoke(bContext *C, wmOperator *op, const
|
|||
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
|
||||
char filepath[FILE_MAX];
|
||||
|
||||
if (bmain->name[0] == '\0')
|
||||
if (BKE_main_blendfile_path(bmain)[0] == '\0')
|
||||
BLI_strncpy(filepath, "untitled", sizeof(filepath));
|
||||
else
|
||||
BLI_strncpy(filepath, bmain->name, sizeof(filepath));
|
||||
BLI_strncpy(filepath, BKE_main_blendfile_path(bmain), sizeof(filepath));
|
||||
|
||||
BLI_replace_extension(filepath, sizeof(filepath), ".srt");
|
||||
RNA_string_set(op->ptr, "filepath", filepath);
|
||||
|
|
|
@ -234,7 +234,7 @@ static int text_open_exec(bContext *C, wmOperator *op)
|
|||
|
||||
RNA_string_get(op->ptr, "filepath", str);
|
||||
|
||||
text = BKE_text_load_ex(bmain, str, bmain->name, internal);
|
||||
text = BKE_text_load_ex(bmain, str, BKE_main_blendfile_path(bmain), internal);
|
||||
|
||||
if (!text) {
|
||||
if (op->customdata) MEM_freeN(op->customdata);
|
||||
|
@ -274,7 +274,7 @@ static int text_open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e
|
|||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Text *text = CTX_data_edit_text(C);
|
||||
const char *path = (text && text->name) ? text->name : bmain->name;
|
||||
const char *path = (text && text->name) ? text->name : BKE_main_blendfile_path(bmain);
|
||||
|
||||
if (RNA_struct_property_is_set(op->ptr, "filepath"))
|
||||
return text_open_exec(C, op);
|
||||
|
@ -465,7 +465,7 @@ static void txt_write_file(Main *bmain, Text *text, ReportList *reports)
|
|||
char filepath[FILE_MAX];
|
||||
|
||||
BLI_strncpy(filepath, text->name, FILE_MAX);
|
||||
BLI_path_abs(filepath, bmain->name);
|
||||
BLI_path_abs(filepath, BKE_main_blendfile_path(bmain));
|
||||
|
||||
fp = BLI_fopen(filepath, "w");
|
||||
if (fp == NULL) {
|
||||
|
@ -562,7 +562,7 @@ static int text_save_as_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
|
|||
else if (text->flags & TXT_ISMEM)
|
||||
str = text->id.name + 2;
|
||||
else
|
||||
str = bmain->name;
|
||||
str = BKE_main_blendfile_path(bmain);
|
||||
|
||||
RNA_string_set(op->ptr, "filepath", str);
|
||||
WM_event_add_fileselect(C, op);
|
||||
|
|
|
@ -263,7 +263,7 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
|
|||
BLI_split_file_part(abs_name, fi, sizeof(fi));
|
||||
BLI_snprintf(local_name, sizeof(local_name), "//%s/%s", folder, fi);
|
||||
if (!STREQ(abs_name, local_name)) {
|
||||
switch (checkPackedFile(bmain->name, local_name, pf)) {
|
||||
switch (checkPackedFile(BKE_main_blendfile_path(bmain), local_name, pf)) {
|
||||
case PF_NOFILE:
|
||||
BLI_snprintf(line, sizeof(line), IFACE_("Create %s"), local_name);
|
||||
uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &props_ptr);
|
||||
|
@ -296,7 +296,7 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
|
|||
}
|
||||
}
|
||||
|
||||
switch (checkPackedFile(bmain->name, abs_name, pf)) {
|
||||
switch (checkPackedFile(BKE_main_blendfile_path(bmain), abs_name, pf)) {
|
||||
case PF_NOFILE:
|
||||
BLI_snprintf(line, sizeof(line), IFACE_("Create %s"), abs_name);
|
||||
//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_ORIGINAL);
|
||||
|
|
|
@ -381,7 +381,7 @@ typedef enum ID_Type {
|
|||
|
||||
#define ID_CHECK_UNDO(id) ((GS((id)->name) != ID_SCR) && (GS((id)->name) != ID_WM) && (GS((id)->name) != ID_WS))
|
||||
|
||||
#define ID_BLEND_PATH(_bmain, _id) ((_id)->lib ? (_id)->lib->filepath : (_bmain)->name)
|
||||
#define ID_BLEND_PATH(_bmain, _id) ((_id)->lib ? (_id)->lib->filepath : BKE_main_blendfile_path((_bmain)))
|
||||
|
||||
#define ID_MISSING(_id) (((_id)->tag & LIB_TAG_MISSING) != 0)
|
||||
|
||||
|
|
|
@ -548,7 +548,7 @@ static const EnumPropertyItem *rna_ColorManagedColorspaceSettings_colorspace_ite
|
|||
return items;
|
||||
}
|
||||
|
||||
static void rna_ColorManagedColorspaceSettings_reload_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
||||
static void rna_ColorManagedColorspaceSettings_reload_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
|
||||
{
|
||||
ID *id = ptr->id.data;
|
||||
|
||||
|
@ -565,7 +565,7 @@ static void rna_ColorManagedColorspaceSettings_reload_update(Main *UNUSED(bmain)
|
|||
else if (GS(id->name) == ID_MC) {
|
||||
MovieClip *clip = (MovieClip *) id;
|
||||
|
||||
BKE_movieclip_reload(clip);
|
||||
BKE_movieclip_reload(bmain, clip);
|
||||
|
||||
/* all sequencers for now, we don't know which scenes are using this clip as a strip */
|
||||
BKE_sequencer_cache_cleanup();
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
static void rna_ImagePackedFile_save(ImagePackedFile *imapf, Main *bmain, ReportList *reports)
|
||||
{
|
||||
if (writePackedFile(reports, bmain->name, imapf->filepath, imapf->packedfile, 0) != RET_OK) {
|
||||
if (writePackedFile(reports, BKE_main_blendfile_path(bmain), imapf->filepath, imapf->packedfile, 0) != RET_OK) {
|
||||
BKE_reportf(reports, RPT_ERROR, "Could not save packed file to disk as '%s'",
|
||||
imapf->filepath);
|
||||
}
|
||||
|
|
|
@ -489,7 +489,7 @@ static Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *f
|
|||
Text *txt;
|
||||
|
||||
errno = 0;
|
||||
txt = BKE_text_load_ex(bmain, filepath, bmain->name, is_internal);
|
||||
txt = BKE_text_load_ex(bmain, filepath, BKE_main_blendfile_path(bmain), is_internal);
|
||||
|
||||
if (!txt)
|
||||
BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath,
|
||||
|
|
|
@ -56,11 +56,11 @@
|
|||
#include "DNA_screen_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
|
||||
static void rna_MovieClip_reload_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
||||
static void rna_MovieClip_reload_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
|
||||
{
|
||||
MovieClip *clip = (MovieClip *)ptr->id.data;
|
||||
|
||||
BKE_movieclip_reload(clip);
|
||||
BKE_movieclip_reload(bmain, clip);
|
||||
DEG_id_tag_update(&clip->id, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2967,7 +2967,7 @@ static void rna_ShaderNodeTexIES_mode_set(PointerRNA *ptr, int value)
|
|||
|
||||
if (value == NODE_IES_EXTERNAL && text->name) {
|
||||
BLI_strncpy(nss->filepath, text->name, sizeof(nss->filepath));
|
||||
BLI_path_rel(nss->filepath, G.main->name);
|
||||
BLI_path_rel(nss->filepath, BKE_main_blendfile_path_from_global());
|
||||
}
|
||||
|
||||
id_us_min(node->id);
|
||||
|
@ -2992,7 +2992,7 @@ static void rna_ShaderNodeScript_mode_set(PointerRNA *ptr, int value)
|
|||
|
||||
if (value == NODE_SCRIPT_EXTERNAL && text->name) {
|
||||
BLI_strncpy(nss->filepath, text->name, sizeof(nss->filepath));
|
||||
BLI_path_rel(nss->filepath, G.main->name);
|
||||
BLI_path_rel(nss->filepath, BKE_main_blendfile_path_from_global());
|
||||
}
|
||||
|
||||
id_us_min(node->id);
|
||||
|
|
|
@ -158,7 +158,7 @@ static void rna_SceneRender_get_frame_path(
|
|||
}
|
||||
else {
|
||||
BKE_image_path_from_imformat(
|
||||
name, rd->pic, bmain->name, (frame == INT_MIN) ? rd->cfra : frame,
|
||||
name, rd->pic, BKE_main_blendfile_path(bmain), (frame == INT_MIN) ? rd->cfra : frame,
|
||||
&rd->im_format, (rd->scemode & R_EXTENSION) != 0, true, suffix);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -730,7 +730,7 @@ void BPY_modules_load_user(bContext *C)
|
|||
G.f |= G_SCRIPT_AUTOEXEC_FAIL;
|
||||
BLI_snprintf(G.autoexec_fail, sizeof(G.autoexec_fail), "Text '%s'", text->id.name + 2);
|
||||
|
||||
printf("scripts disabled for \"%s\", skipping '%s'\n", bmain->name, text->id.name + 2);
|
||||
printf("scripts disabled for \"%s\", skipping '%s'\n", BKE_main_blendfile_path(bmain), text->id.name + 2);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -205,7 +205,7 @@ static PyObject *bpy_lib_load(PyObject *UNUSED(self), PyObject *args, PyObject *
|
|||
|
||||
BLI_strncpy(ret->relpath, filename, sizeof(ret->relpath));
|
||||
BLI_strncpy(ret->abspath, filename, sizeof(ret->abspath));
|
||||
BLI_path_abs(ret->abspath, bmain->name);
|
||||
BLI_path_abs(ret->abspath, BKE_main_blendfile_path(bmain));
|
||||
|
||||
ret->blo_handle = NULL;
|
||||
ret->flag = ((is_link ? FILE_LINK : 0) |
|
||||
|
|
|
@ -107,7 +107,7 @@ static PyObject *bpy_lib_write(PyObject *UNUSED(self), PyObject *args, PyObject
|
|||
}
|
||||
|
||||
BLI_strncpy(filepath_abs, filepath, FILE_MAX);
|
||||
BLI_path_abs(filepath_abs, G.main->name);
|
||||
BLI_path_abs(filepath_abs, BKE_main_blendfile_path_from_global());
|
||||
|
||||
BKE_blendfile_write_partial_begin(bmain_src);
|
||||
|
||||
|
|
|
@ -2208,7 +2208,7 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, ViewLayer *single_la
|
|||
else {
|
||||
char name[FILE_MAX];
|
||||
BKE_image_path_from_imformat(
|
||||
name, scene->r.pic, bmain->name, scene->r.cfra,
|
||||
name, scene->r.pic, BKE_main_blendfile_path(bmain), scene->r.cfra,
|
||||
&scene->r.im_format, (scene->r.scemode & R_EXTENSION) != 0, false, NULL);
|
||||
|
||||
/* reports only used for Movie */
|
||||
|
@ -2467,7 +2467,7 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
|
|||
BLI_strncpy(name, name_override, sizeof(name));
|
||||
else
|
||||
BKE_image_path_from_imformat(
|
||||
name, scene->r.pic, bmain->name, scene->r.cfra,
|
||||
name, scene->r.pic, BKE_main_blendfile_path(bmain), scene->r.cfra,
|
||||
&scene->r.im_format, (scene->r.scemode & R_EXTENSION) != 0, true, NULL);
|
||||
|
||||
/* write images as individual images or stereo */
|
||||
|
@ -2647,7 +2647,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
|
|||
if (is_movie == false) {
|
||||
if (scene->r.mode & (R_NO_OVERWRITE | R_TOUCH))
|
||||
BKE_image_path_from_imformat(
|
||||
name, scene->r.pic, bmain->name, scene->r.cfra,
|
||||
name, scene->r.pic, BKE_main_blendfile_path(bmain), scene->r.cfra,
|
||||
&scene->r.im_format, (scene->r.scemode & R_EXTENSION) != 0, true, NULL);
|
||||
|
||||
if (scene->r.mode & R_NO_OVERWRITE) {
|
||||
|
|
|
@ -1130,7 +1130,7 @@ void render_result_exr_file_merge(RenderResult *rr, RenderResult *rrpart, const
|
|||
void render_result_exr_file_path(Scene *scene, const char *layname, int sample, char *filepath)
|
||||
{
|
||||
char name[FILE_MAXFILE + MAX_ID_NAME + MAX_ID_NAME + 100];
|
||||
const char *fi = BLI_path_basename(G.main->name);
|
||||
const char *fi = BLI_path_basename(BKE_main_blendfile_path_from_global());
|
||||
|
||||
if (sample == 0) {
|
||||
BLI_snprintf(name, sizeof(name), "%s_%s_%s.exr", fi, scene->id.name + 2, layname);
|
||||
|
@ -1224,10 +1224,11 @@ static void render_result_exr_file_cache_path(Scene *sce, const char *root, char
|
|||
char path_hexdigest[33];
|
||||
|
||||
/* If root is relative, use either current .blend file dir, or temp one if not saved. */
|
||||
if (G.main->name[0]) {
|
||||
BLI_split_dirfile(G.main->name, dirname, filename, sizeof(dirname), sizeof(filename));
|
||||
const char *blendfile_path = BKE_main_blendfile_path_from_global();
|
||||
if (blendfile_path[0] != '\0') {
|
||||
BLI_split_dirfile(blendfile_path, dirname, filename, sizeof(dirname), sizeof(filename));
|
||||
BLI_replace_extension(filename, sizeof(filename), ""); /* strip '.blend' */
|
||||
BLI_hash_md5_buffer(G.main->name, strlen(G.main->name), path_digest);
|
||||
BLI_hash_md5_buffer(blendfile_path, strlen(blendfile_path), path_digest);
|
||||
}
|
||||
else {
|
||||
BLI_strncpy(dirname, BKE_tempdir_base(), sizeof(dirname));
|
||||
|
|
|
@ -0,0 +1,571 @@
|
|||
/*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): Raul Fernandez Hernandez (Farsthary), Matt Ebb.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/** \file blender/render/intern/source/voxeldata.c
|
||||
* \ingroup render
|
||||
*/
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include "BLI_winstuff.h"
|
||||
#endif
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_threads.h"
|
||||
#include "BLI_voxel.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "IMB_imbuf.h"
|
||||
#include "IMB_imbuf_types.h"
|
||||
|
||||
#include "BKE_cloth.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_image.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_modifier.h"
|
||||
|
||||
#include "smoke_API.h"
|
||||
#include "BPH_mass_spring.h"
|
||||
|
||||
#include "DNA_texture_types.h"
|
||||
#include "DNA_object_force_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_smoke_types.h"
|
||||
|
||||
|
||||
#include "render_types.h"
|
||||
#include "texture.h"
|
||||
#include "voxeldata.h"
|
||||
|
||||
static bool is_vd_res_ok(VoxelData *vd)
|
||||
{
|
||||
/* arbitrary large value so corrupt headers don't break */
|
||||
const int min = 1, max = 100000;
|
||||
return (vd->resol[0] >= min && vd->resol[0] <= max) &&
|
||||
(vd->resol[1] >= min && vd->resol[1] <= max) &&
|
||||
(vd->resol[2] >= min && vd->resol[2] <= max);
|
||||
}
|
||||
|
||||
/* use size_t because the result may exceed INT_MAX */
|
||||
static size_t vd_resol_size(VoxelData *vd)
|
||||
{
|
||||
return (size_t)vd->resol[0] * (size_t)vd->resol[1] * (size_t)vd->resol[2];
|
||||
}
|
||||
|
||||
static int load_frame_blendervoxel(VoxelData *vd, FILE *fp, int frame)
|
||||
{
|
||||
const size_t size = vd_resol_size(vd);
|
||||
size_t offset = sizeof(VoxelDataHeader);
|
||||
|
||||
if (is_vd_res_ok(vd) == false)
|
||||
return 0;
|
||||
|
||||
vd->dataset = MEM_mapallocN(sizeof(float) * size, "voxel dataset");
|
||||
if (vd->dataset == NULL) return 0;
|
||||
|
||||
if (fseek(fp, frame * size * sizeof(float) + offset, 0) == -1)
|
||||
return 0;
|
||||
if (fread(vd->dataset, sizeof(float), size, fp) != size)
|
||||
return 0;
|
||||
|
||||
vd->cachedframe = frame;
|
||||
vd->ok = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int load_frame_raw8(VoxelData *vd, FILE *fp, int frame)
|
||||
{
|
||||
const size_t size = vd_resol_size(vd);
|
||||
size_t i;
|
||||
char *data_c;
|
||||
|
||||
if (is_vd_res_ok(vd) == false)
|
||||
return 0;
|
||||
|
||||
vd->dataset = MEM_mapallocN(sizeof(float) * size, "voxel dataset");
|
||||
if (vd->dataset == NULL) return 0;
|
||||
data_c = (char *)MEM_mallocN(sizeof(char) * size, "temporary voxel file reading storage");
|
||||
if (data_c == NULL) {
|
||||
MEM_freeN(vd->dataset);
|
||||
vd->dataset = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (fseek(fp, (frame - 1) * size * sizeof(char), 0) == -1) {
|
||||
MEM_freeN(data_c);
|
||||
MEM_freeN(vd->dataset);
|
||||
vd->dataset = NULL;
|
||||
return 0;
|
||||
}
|
||||
if (fread(data_c, sizeof(char), size, fp) != size) {
|
||||
MEM_freeN(data_c);
|
||||
MEM_freeN(vd->dataset);
|
||||
vd->dataset = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
vd->dataset[i] = (float)data_c[i] / 255.f;
|
||||
}
|
||||
MEM_freeN(data_c);
|
||||
|
||||
vd->cachedframe = frame;
|
||||
vd->ok = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void load_frame_image_sequence(VoxelData *vd, Tex *tex)
|
||||
{
|
||||
ImBuf *ibuf;
|
||||
Image *ima = tex->ima;
|
||||
ImageUser *tiuser = &tex->iuser;
|
||||
ImageUser iuser = *(tiuser);
|
||||
int x = 0, y = 0, z = 0;
|
||||
const float *rf;
|
||||
|
||||
if (!ima) return;
|
||||
if (iuser.frames == 0) return;
|
||||
|
||||
ima->source = IMA_SRC_SEQUENCE;
|
||||
iuser.framenr = 1 + iuser.offset;
|
||||
|
||||
/* find the first valid ibuf and use it to initialize the resolution of the data set */
|
||||
/* need to do this in advance so we know how much memory to allocate */
|
||||
ibuf = BKE_image_acquire_ibuf(ima, &iuser, NULL);
|
||||
while (!ibuf && (iuser.framenr < iuser.frames)) {
|
||||
iuser.framenr++;
|
||||
ibuf = BKE_image_acquire_ibuf(ima, &iuser, NULL);
|
||||
}
|
||||
if (!ibuf) return;
|
||||
if (!ibuf->rect_float) IMB_float_from_rect(ibuf);
|
||||
|
||||
vd->flag |= TEX_VD_STILL;
|
||||
vd->resol[0] = ibuf->x;
|
||||
vd->resol[1] = ibuf->y;
|
||||
vd->resol[2] = iuser.frames;
|
||||
vd->dataset = MEM_mapallocN(sizeof(float) * vd_resol_size(vd), "voxel dataset");
|
||||
|
||||
for (z = 0; z < iuser.frames; z++) {
|
||||
/* get a new ibuf for each frame */
|
||||
if (z > 0) {
|
||||
iuser.framenr++;
|
||||
BKE_image_release_ibuf(ima, ibuf, NULL);
|
||||
ibuf = BKE_image_acquire_ibuf(ima, &iuser, NULL);
|
||||
if (!ibuf) break;
|
||||
if (!ibuf->rect_float) IMB_float_from_rect(ibuf);
|
||||
}
|
||||
rf = ibuf->rect_float;
|
||||
|
||||
for (y = 0; y < ibuf->y; y++) {
|
||||
for (x = 0; x < ibuf->x; x++) {
|
||||
/* currently averaged to monchrome */
|
||||
vd->dataset[BLI_VOXEL_INDEX(x, y, z, vd->resol)] = (rf[0] + rf[1] + rf[2]) / 3.0f;
|
||||
rf += 4;
|
||||
}
|
||||
}
|
||||
|
||||
BKE_image_free_anim_ibufs(ima, iuser.framenr);
|
||||
}
|
||||
|
||||
BKE_image_release_ibuf(ima, ibuf, NULL);
|
||||
|
||||
vd->ok = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
static int read_voxeldata_header(FILE *fp, struct VoxelData *vd)
|
||||
{
|
||||
VoxelDataHeader *h = (VoxelDataHeader *)MEM_mallocN(sizeof(VoxelDataHeader), "voxel data header");
|
||||
|
||||
rewind(fp);
|
||||
if (fread(h, sizeof(VoxelDataHeader), 1, fp) != 1) {
|
||||
MEM_freeN(h);
|
||||
return 0;
|
||||
}
|
||||
|
||||
vd->resol[0] = h->resolX;
|
||||
vd->resol[1] = h->resolY;
|
||||
vd->resol[2] = h->resolZ;
|
||||
|
||||
MEM_freeN(h);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void init_frame_smoke(VoxelData *vd, int cfra)
|
||||
{
|
||||
#ifdef WITH_SMOKE
|
||||
Object *ob;
|
||||
ModifierData *md;
|
||||
|
||||
vd->dataset = NULL;
|
||||
if (vd->object == NULL) return;
|
||||
ob = vd->object;
|
||||
|
||||
/* draw code for smoke */
|
||||
if ((md = (ModifierData *)modifiers_findByType(ob, eModifierType_Smoke))) {
|
||||
SmokeModifierData *smd = (SmokeModifierData *)md;
|
||||
SmokeDomainSettings *sds = smd->domain;
|
||||
|
||||
if (sds && sds->fluid) {
|
||||
BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ);
|
||||
|
||||
if (!sds->fluid) {
|
||||
BLI_rw_mutex_unlock(sds->fluid_mutex);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cfra < sds->point_cache[0]->startframe)
|
||||
; /* don't show smoke before simulation starts, this could be made an option in the future */
|
||||
else if (vd->smoked_type == TEX_VD_SMOKEHEAT) {
|
||||
size_t totRes;
|
||||
size_t i;
|
||||
float *heat;
|
||||
|
||||
if (!smoke_has_heat(sds->fluid)) {
|
||||
BLI_rw_mutex_unlock(sds->fluid_mutex);
|
||||
return;
|
||||
}
|
||||
|
||||
copy_v3_v3_int(vd->resol, sds->res);
|
||||
totRes = vd_resol_size(vd);
|
||||
vd->dataset = MEM_mapallocN(sizeof(float) * (totRes), "smoke data");
|
||||
/* get heat data */
|
||||
heat = smoke_get_heat(sds->fluid);
|
||||
|
||||
/* scale heat values from -2.0-2.0 to 0.0-1.0 */
|
||||
for (i = 0; i < totRes; i++) {
|
||||
vd->dataset[i] = (heat[i] + 2.0f) / 4.0f;
|
||||
}
|
||||
}
|
||||
else if (vd->smoked_type == TEX_VD_SMOKEVEL) {
|
||||
size_t totRes;
|
||||
size_t i;
|
||||
float *xvel, *yvel, *zvel;
|
||||
|
||||
copy_v3_v3_int(vd->resol, sds->res);
|
||||
totRes = vd_resol_size(vd);
|
||||
vd->dataset = MEM_mapallocN(sizeof(float) * (totRes), "smoke data");
|
||||
/* get velocity data */
|
||||
xvel = smoke_get_velocity_x(sds->fluid);
|
||||
yvel = smoke_get_velocity_y(sds->fluid);
|
||||
zvel = smoke_get_velocity_z(sds->fluid);
|
||||
|
||||
/* map velocities between 0 and 0.3f */
|
||||
for (i = 0; i < totRes; i++) {
|
||||
vd->dataset[i] = sqrtf(xvel[i] * xvel[i] + yvel[i] * yvel[i] + zvel[i] * zvel[i]) * 3.0f;
|
||||
}
|
||||
|
||||
}
|
||||
else if (vd->smoked_type == TEX_VD_SMOKEFLAME) {
|
||||
size_t totRes;
|
||||
float *flame;
|
||||
|
||||
if (sds->flags & MOD_SMOKE_HIGHRES) {
|
||||
if (!smoke_turbulence_has_fuel(sds->wt)) {
|
||||
BLI_rw_mutex_unlock(sds->fluid_mutex);
|
||||
return;
|
||||
}
|
||||
smoke_turbulence_get_res(sds->wt, vd->resol);
|
||||
flame = smoke_turbulence_get_flame(sds->wt);
|
||||
}
|
||||
else {
|
||||
if (!smoke_has_fuel(sds->fluid)) {
|
||||
BLI_rw_mutex_unlock(sds->fluid_mutex);
|
||||
return;
|
||||
}
|
||||
copy_v3_v3_int(vd->resol, sds->res);
|
||||
flame = smoke_get_flame(sds->fluid);
|
||||
}
|
||||
|
||||
/* always store copy, as smoke internal data can change */
|
||||
totRes = vd_resol_size(vd);
|
||||
vd->dataset = MEM_mapallocN(sizeof(float)*(totRes), "smoke data");
|
||||
memcpy(vd->dataset, flame, sizeof(float)*totRes);
|
||||
}
|
||||
else {
|
||||
size_t totCells;
|
||||
int depth = 4;
|
||||
vd->data_type = TEX_VD_RGBA_PREMUL;
|
||||
|
||||
/* data resolution */
|
||||
if (sds->flags & MOD_SMOKE_HIGHRES) {
|
||||
smoke_turbulence_get_res(sds->wt, vd->resol);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3_int(vd->resol, sds->res);
|
||||
}
|
||||
|
||||
/* TODO: is_vd_res_ok(rvd) doesnt check this resolution */
|
||||
totCells = vd_resol_size(vd) * depth;
|
||||
/* always store copy, as smoke internal data can change */
|
||||
vd->dataset = MEM_mapallocN(sizeof(float) * totCells, "smoke data");
|
||||
|
||||
if (sds->flags & MOD_SMOKE_HIGHRES) {
|
||||
if (smoke_turbulence_has_colors(sds->wt)) {
|
||||
smoke_turbulence_get_rgba(sds->wt, vd->dataset, 1);
|
||||
}
|
||||
else {
|
||||
smoke_turbulence_get_rgba_from_density(sds->wt, sds->active_color, vd->dataset, 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (smoke_has_colors(sds->fluid)) {
|
||||
smoke_get_rgba(sds->fluid, vd->dataset, 1);
|
||||
}
|
||||
else {
|
||||
smoke_get_rgba_from_density(sds->fluid, sds->active_color, vd->dataset, 1);
|
||||
}
|
||||
}
|
||||
} /* end of fluid condition */
|
||||
|
||||
BLI_rw_mutex_unlock(sds->fluid_mutex);
|
||||
}
|
||||
}
|
||||
|
||||
vd->ok = 1;
|
||||
|
||||
#else // WITH_SMOKE
|
||||
(void)vd;
|
||||
(void)cfra;
|
||||
|
||||
vd->dataset = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void init_frame_hair(VoxelData *vd, int UNUSED(cfra))
|
||||
{
|
||||
Object *ob;
|
||||
ModifierData *md;
|
||||
|
||||
vd->dataset = NULL;
|
||||
if (vd->object == NULL) return;
|
||||
ob = vd->object;
|
||||
|
||||
if ((md = (ModifierData *)modifiers_findByType(ob, eModifierType_ParticleSystem))) {
|
||||
ParticleSystemModifierData *pmd = (ParticleSystemModifierData *)md;
|
||||
|
||||
if (pmd->psys && pmd->psys->clmd) {
|
||||
vd->ok |= BPH_cloth_solver_get_texture_data(ob, pmd->psys->clmd, vd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cache_voxeldata(Tex *tex, int scene_frame)
|
||||
{
|
||||
VoxelData *vd = tex->vd;
|
||||
FILE *fp;
|
||||
int curframe;
|
||||
char path[sizeof(vd->source_path)];
|
||||
|
||||
/* only re-cache if dataset needs updating */
|
||||
if ((vd->flag & TEX_VD_STILL) || (vd->cachedframe == scene_frame))
|
||||
if (vd->ok) return;
|
||||
|
||||
/* clear out old cache, ready for new */
|
||||
if (vd->dataset) {
|
||||
MEM_freeN(vd->dataset);
|
||||
vd->dataset = NULL;
|
||||
}
|
||||
/* reset data_type */
|
||||
vd->data_type = TEX_VD_INTENSITY;
|
||||
|
||||
if (vd->flag & TEX_VD_STILL)
|
||||
curframe = vd->still_frame;
|
||||
else
|
||||
curframe = scene_frame;
|
||||
|
||||
BLI_strncpy(path, vd->source_path, sizeof(path));
|
||||
|
||||
/* each type is responsible for setting to true */
|
||||
vd->ok = false;
|
||||
|
||||
switch (vd->file_format) {
|
||||
case TEX_VD_IMAGE_SEQUENCE:
|
||||
load_frame_image_sequence(vd, tex);
|
||||
return;
|
||||
case TEX_VD_SMOKE:
|
||||
init_frame_smoke(vd, scene_frame);
|
||||
return;
|
||||
case TEX_VD_HAIR:
|
||||
init_frame_hair(vd, scene_frame);
|
||||
return;
|
||||
case TEX_VD_BLENDERVOXEL:
|
||||
BLI_path_abs(path, BKE_main_blendfile_path_from_global());
|
||||
fp = BLI_fopen(path, "rb");
|
||||
if (!fp) return;
|
||||
|
||||
if (read_voxeldata_header(fp, vd))
|
||||
load_frame_blendervoxel(vd, fp, curframe - 1);
|
||||
|
||||
fclose(fp);
|
||||
return;
|
||||
case TEX_VD_RAW_8BIT:
|
||||
BLI_path_abs(path, BKE_main_blendfile_path_from_global());
|
||||
fp = BLI_fopen(path, "rb");
|
||||
if (!fp) return;
|
||||
|
||||
load_frame_raw8(vd, fp, curframe);
|
||||
fclose(fp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void make_voxeldata(struct Render *re)
|
||||
{
|
||||
Tex *tex;
|
||||
|
||||
re->i.infostr = IFACE_("Loading voxel datasets");
|
||||
re->stats_draw(re->sdh, &re->i);
|
||||
|
||||
/* XXX: should be doing only textures used in this render */
|
||||
for (tex = re->main->tex.first; tex; tex = tex->id.next) {
|
||||
if (tex->id.us && tex->type == TEX_VOXELDATA) {
|
||||
cache_voxeldata(tex, re->r.cfra);
|
||||
}
|
||||
}
|
||||
|
||||
re->i.infostr = NULL;
|
||||
re->stats_draw(re->sdh, &re->i);
|
||||
|
||||
}
|
||||
|
||||
int voxeldatatex(struct Tex *tex, const float texvec[3], struct TexResult *texres)
|
||||
{
|
||||
VoxelData *vd = tex->vd;
|
||||
float co[3], offset[3] = {0.5, 0.5, 0.5}, a;
|
||||
int retval = (vd->data_type == TEX_VD_RGBA_PREMUL) ? TEX_RGB : TEX_INT;
|
||||
int depth = (vd->data_type == TEX_VD_RGBA_PREMUL) ? 4 : 1;
|
||||
int ch;
|
||||
|
||||
if (vd->dataset == NULL) {
|
||||
texres->tin = 0.0f;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* scale lookup from 0.0-1.0 (original location) to -1.0, 1.0, consistent with image texture tex coords */
|
||||
/* in implementation this works backwards, bringing sample locations from -1.0, 1.0
|
||||
* to the range 0.0, 1.0, before looking up in the voxel structure. */
|
||||
copy_v3_v3(co, texvec);
|
||||
mul_v3_fl(co, 0.5f);
|
||||
add_v3_v3(co, offset);
|
||||
|
||||
/* co is now in the range 0.0, 1.0 */
|
||||
switch (vd->extend) {
|
||||
case TEX_CLIP:
|
||||
{
|
||||
if ((co[0] < 0.f || co[0] > 1.f) || (co[1] < 0.f || co[1] > 1.f) || (co[2] < 0.f || co[2] > 1.f)) {
|
||||
texres->tin = 0.f;
|
||||
return retval;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TEX_REPEAT:
|
||||
{
|
||||
co[0] = co[0] - floorf(co[0]);
|
||||
co[1] = co[1] - floorf(co[1]);
|
||||
co[2] = co[2] - floorf(co[2]);
|
||||
break;
|
||||
}
|
||||
case TEX_EXTEND:
|
||||
{
|
||||
CLAMP(co[0], 0.f, 1.f);
|
||||
CLAMP(co[1], 0.f, 1.f);
|
||||
CLAMP(co[2], 0.f, 1.f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (ch = 0; ch < depth; ch++) {
|
||||
float *dataset = vd->dataset + ch*vd->resol[0]*vd->resol[1]*vd->resol[2];
|
||||
float *result = &texres->tin;
|
||||
|
||||
if (vd->data_type == TEX_VD_RGBA_PREMUL) {
|
||||
switch (ch) {
|
||||
case 0:
|
||||
result = &texres->tr;
|
||||
break;
|
||||
case 1:
|
||||
result = &texres->tg;
|
||||
break;
|
||||
case 2:
|
||||
result = &texres->tb;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (vd->interp_type) {
|
||||
case TEX_VD_NEARESTNEIGHBOR:
|
||||
*result = BLI_voxel_sample_nearest(dataset, vd->resol, co);
|
||||
break;
|
||||
case TEX_VD_LINEAR:
|
||||
*result = BLI_voxel_sample_trilinear(dataset, vd->resol, co);
|
||||
break;
|
||||
case TEX_VD_QUADRATIC:
|
||||
*result = BLI_voxel_sample_triquadratic(dataset, vd->resol, co);
|
||||
break;
|
||||
case TEX_VD_TRICUBIC_CATROM:
|
||||
case TEX_VD_TRICUBIC_BSPLINE:
|
||||
*result = BLI_voxel_sample_tricubic(dataset, vd->resol, co, (vd->interp_type == TEX_VD_TRICUBIC_BSPLINE));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
a = texres->tin;
|
||||
texres->tin *= vd->int_multiplier;
|
||||
BRICONT;
|
||||
|
||||
if (vd->data_type == TEX_VD_RGBA_PREMUL) {
|
||||
/* unmultiply */
|
||||
if (a>0.001f) {
|
||||
texres->tr /= a;
|
||||
texres->tg /= a;
|
||||
texres->tb /= a;
|
||||
}
|
||||
texres->talpha = 1;
|
||||
}
|
||||
else {
|
||||
texres->tr = texres->tin;
|
||||
texres->tg = texres->tin;
|
||||
texres->tb = texres->tin;
|
||||
}
|
||||
|
||||
texres->ta = texres->tin;
|
||||
BRICONTRGB;
|
||||
|
||||
return retval;
|
||||
}
|
|
@ -572,6 +572,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
|
|||
|
||||
/* we didn't succeed, now try to read Blender file */
|
||||
if (retval == BKE_READ_EXOTIC_OK_BLEND) {
|
||||
Main *bmain = CTX_data_main(C);
|
||||
int G_f = G.f;
|
||||
ListBase wmbase;
|
||||
|
||||
|
@ -583,7 +584,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
|
|||
G.relbase_valid = 1;
|
||||
retval = BKE_blendfile_read(C, filepath, reports, 0);
|
||||
/* when loading startup.blend's, we can be left with a blank path */
|
||||
if (G.main->name[0]) {
|
||||
if (BKE_main_blendfile_path(bmain)) {
|
||||
G.save_over = 1;
|
||||
}
|
||||
else {
|
||||
|
@ -672,6 +673,7 @@ int wm_homefile_read(
|
|||
bool use_factory_settings, bool use_empty_data, bool use_userdef,
|
||||
const char *filepath_startup_override, const char *app_template_override)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
ListBase wmbase;
|
||||
bool success = false;
|
||||
|
||||
|
@ -872,7 +874,7 @@ int wm_homefile_read(
|
|||
wm_window_match_do(C, &wmbase, &G.main->wm, &G.main->wm);
|
||||
WM_check(C); /* opens window(s), checks keymaps */
|
||||
|
||||
G.main->name[0] = '\0';
|
||||
bmain->name[0] = '\0';
|
||||
|
||||
/* start with save preference untitled.blend */
|
||||
G.save_over = 0;
|
||||
|
@ -969,16 +971,18 @@ static void wm_history_file_write(void)
|
|||
static void wm_history_file_update(void)
|
||||
{
|
||||
RecentFile *recent;
|
||||
const char *blendfile_name = BKE_main_blendfile_path_from_global();
|
||||
|
||||
/* no write history for recovered startup files */
|
||||
if (G.main->name[0] == 0)
|
||||
if (blendfile_name[0] == '\0') {
|
||||
return;
|
||||
}
|
||||
|
||||
recent = G.recent_files.first;
|
||||
/* refresh recent-files.txt of recent opened files, when current file was changed */
|
||||
if (!(recent) || (BLI_path_cmp(recent->filepath, G.main->name) != 0)) {
|
||||
if (!(recent) || (BLI_path_cmp(recent->filepath, blendfile_name) != 0)) {
|
||||
|
||||
recent = wm_file_history_find(G.main->name);
|
||||
recent = wm_file_history_find(blendfile_name);
|
||||
if (recent) {
|
||||
BLI_remlink(&G.recent_files, recent);
|
||||
}
|
||||
|
@ -988,7 +992,7 @@ static void wm_history_file_update(void)
|
|||
recent_next = recent->next;
|
||||
wm_history_file_free(recent);
|
||||
}
|
||||
recent = wm_history_file_new(G.main->name);
|
||||
recent = wm_history_file_new(blendfile_name);
|
||||
}
|
||||
|
||||
/* add current file to the beginning of list */
|
||||
|
@ -998,7 +1002,7 @@ static void wm_history_file_update(void)
|
|||
wm_history_file_write();
|
||||
|
||||
/* also update most recent files on System */
|
||||
GHOST_addToSystemRecentFiles(G.main->name);
|
||||
GHOST_addToSystemRecentFiles(blendfile_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1087,7 +1091,7 @@ bool write_crash_blend(void)
|
|||
char path[FILE_MAX];
|
||||
int fileflags = G.fileflags & ~(G_FILE_HISTORY); /* don't do file history on crash file */
|
||||
|
||||
BLI_strncpy(path, G.main->name, sizeof(path));
|
||||
BLI_strncpy(path, BKE_main_blendfile_path_from_global(), sizeof(path));
|
||||
BLI_replace_extension(path, sizeof(path), "_crash.blend");
|
||||
if (BLO_write_file(G.main, path, fileflags, NULL, NULL)) {
|
||||
printf("written: %s\n", path);
|
||||
|
@ -1104,6 +1108,7 @@ bool write_crash_blend(void)
|
|||
*/
|
||||
static int wm_file_write(bContext *C, const char *filepath, int fileflags, ReportList *reports)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Library *li;
|
||||
int len;
|
||||
int ret = -1;
|
||||
|
@ -1133,7 +1138,7 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
|
|||
* its handy for scripts to save to a predefined name without blender editing it */
|
||||
|
||||
/* send the OnSave event */
|
||||
for (li = G.main->library.first; li; li = li->id.next) {
|
||||
for (li = bmain->library.first; li; li = li->id.next) {
|
||||
if (BLI_path_cmp(li->filepath, filepath) == 0) {
|
||||
BKE_reportf(reports, RPT_ERROR, "Cannot overwrite used library '%.240s'", filepath);
|
||||
return ret;
|
||||
|
@ -1141,7 +1146,7 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
|
|||
}
|
||||
|
||||
/* Call pre-save callbacks befores writing preview, that way you can generate custom file thumbnail... */
|
||||
BLI_callback_exec(G.main, NULL, BLI_CB_EVT_SAVE_PRE);
|
||||
BLI_callback_exec(bmain, NULL, BLI_CB_EVT_SAVE_PRE);
|
||||
|
||||
/* blend file thumbnail */
|
||||
/* save before exit_editmode, otherwise derivedmeshes for shared data corrupt #27765) */
|
||||
|
@ -1154,7 +1159,7 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
|
|||
/* operator now handles overwrite checks */
|
||||
|
||||
if (G.fileflags & G_AUTOPACK) {
|
||||
packAll(G.main, reports, false);
|
||||
packAll(bmain, reports, false);
|
||||
}
|
||||
|
||||
/* don't forget not to return without! */
|
||||
|
@ -1166,19 +1171,19 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
|
|||
|
||||
/* first time saving */
|
||||
/* XXX temp solution to solve bug, real fix coming (ton) */
|
||||
if ((G.main->name[0] == '\0') && !(fileflags & G_FILE_SAVE_COPY)) {
|
||||
BLI_strncpy(G.main->name, filepath, sizeof(G.main->name));
|
||||
if ((BKE_main_blendfile_path(bmain)[0] == '\0') && !(fileflags & G_FILE_SAVE_COPY)) {
|
||||
BLI_strncpy(bmain->name, filepath, sizeof(bmain->name));
|
||||
}
|
||||
|
||||
/* XXX temp solution to solve bug, real fix coming (ton) */
|
||||
G.main->recovered = 0;
|
||||
bmain->recovered = 0;
|
||||
|
||||
if (BLO_write_file(CTX_data_main(C), filepath, fileflags, reports, thumb)) {
|
||||
const bool do_history = (G.background == false) && (CTX_wm_manager(C)->op_undo_depth == 0);
|
||||
|
||||
if (!(fileflags & G_FILE_SAVE_COPY)) {
|
||||
G.relbase_valid = 1;
|
||||
BLI_strncpy(G.main->name, filepath, sizeof(G.main->name)); /* is guaranteed current file */
|
||||
BLI_strncpy(bmain->name, filepath, sizeof(bmain->name)); /* is guaranteed current file */
|
||||
|
||||
G.save_over = 1; /* disable untitled.blend convention */
|
||||
}
|
||||
|
@ -1190,7 +1195,7 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
|
|||
wm_history_file_update();
|
||||
}
|
||||
|
||||
BLI_callback_exec(G.main, NULL, BLI_CB_EVT_SAVE_POST);
|
||||
BLI_callback_exec(bmain, NULL, BLI_CB_EVT_SAVE_POST);
|
||||
|
||||
/* run this function after because the file cant be written before the blend is */
|
||||
if (ibuf_thumb) {
|
||||
|
@ -1224,7 +1229,7 @@ void wm_autosave_location(char *filepath)
|
|||
#endif
|
||||
|
||||
if (G.main && G.relbase_valid) {
|
||||
const char *basename = BLI_path_basename(G.main->name);
|
||||
const char *basename = BLI_path_basename(BKE_main_blendfile_path_from_global());
|
||||
int len = strlen(basename) - 6;
|
||||
BLI_snprintf(path, sizeof(path), "%.*s.blend", len, basename);
|
||||
}
|
||||
|
@ -1754,7 +1759,8 @@ struct FileRuntime {
|
|||
|
||||
static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
const char *openname = G.main->name;
|
||||
Main *bmain = CTX_data_main(C);
|
||||
const char *openname = BKE_main_blendfile_path(bmain);
|
||||
|
||||
if (CTX_wm_window(C) == NULL) {
|
||||
/* in rare cases this could happen, when trying to invoke in background
|
||||
|
@ -1893,6 +1899,7 @@ void WM_OT_open_mainfile(wmOperatorType *ot)
|
|||
|
||||
static int wm_revert_mainfile_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
bool success;
|
||||
char filepath[FILE_MAX];
|
||||
|
||||
|
@ -1903,7 +1910,7 @@ static int wm_revert_mainfile_exec(bContext *C, wmOperator *op)
|
|||
else
|
||||
G.f &= ~G_SCRIPT_AUTOEXEC;
|
||||
|
||||
BLI_strncpy(filepath, G.main->name, sizeof(filepath));
|
||||
BLI_strncpy(filepath, BKE_main_blendfile_path(bmain), sizeof(filepath));
|
||||
success = wm_file_read_opwrap(C, filepath, op->reports, !(G.f & G_SCRIPT_AUTOEXEC));
|
||||
|
||||
if (success) {
|
||||
|
@ -1941,6 +1948,7 @@ void WM_OT_revert_mainfile(wmOperatorType *ot)
|
|||
|
||||
void WM_recover_last_session(bContext *C, ReportList *reports)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
char filepath[FILE_MAX];
|
||||
|
||||
BLI_make_file_string("/", filepath, BKE_tempdir_base(), BLENDER_QUIT_FILE);
|
||||
|
@ -1953,8 +1961,9 @@ void WM_recover_last_session(bContext *C, ReportList *reports)
|
|||
G.fileflags &= ~G_FILE_RECOVER;
|
||||
|
||||
/* XXX bad global... fixme */
|
||||
if (G.main->name[0])
|
||||
if (BKE_main_blendfile_path(bmain)[0] != '\0') {
|
||||
G.file_loaded = 1; /* prevents splash to show */
|
||||
}
|
||||
else {
|
||||
G.relbase_valid = 0;
|
||||
G.save_over = 0; /* start with save preference untitled.blend */
|
||||
|
@ -2053,20 +2062,21 @@ static void save_set_compress(wmOperator *op)
|
|||
}
|
||||
}
|
||||
|
||||
static void save_set_filepath(wmOperator *op)
|
||||
static void save_set_filepath(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
PropertyRNA *prop;
|
||||
char name[FILE_MAX];
|
||||
|
||||
prop = RNA_struct_find_property(op->ptr, "filepath");
|
||||
if (!RNA_property_is_set(op->ptr, prop)) {
|
||||
/* if not saved before, get the name of the most recently used .blend file */
|
||||
if (G.main->name[0] == 0 && G.recent_files.first) {
|
||||
if (BKE_main_blendfile_path(bmain)[0] == '\0' && G.recent_files.first) {
|
||||
struct RecentFile *recent = G.recent_files.first;
|
||||
BLI_strncpy(name, recent->filepath, FILE_MAX);
|
||||
}
|
||||
else {
|
||||
BLI_strncpy(name, G.main->name, FILE_MAX);
|
||||
BLI_strncpy(name, bmain->name, FILE_MAX);
|
||||
}
|
||||
|
||||
wm_filepath_default(name);
|
||||
|
@ -2078,7 +2088,7 @@ static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent
|
|||
{
|
||||
|
||||
save_set_compress(op);
|
||||
save_set_filepath(op);
|
||||
save_set_filepath(C, op);
|
||||
|
||||
WM_event_add_fileselect(C, op);
|
||||
|
||||
|
@ -2088,6 +2098,7 @@ static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent
|
|||
/* function used for WM_OT_save_mainfile too */
|
||||
static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
char path[FILE_MAX];
|
||||
int fileflags;
|
||||
|
||||
|
@ -2097,7 +2108,7 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
|
|||
RNA_string_get(op->ptr, "filepath", path);
|
||||
}
|
||||
else {
|
||||
BLI_strncpy(path, G.main->name, FILE_MAX);
|
||||
BLI_strncpy(path, BKE_main_blendfile_path(bmain), FILE_MAX);
|
||||
wm_filepath_default(path);
|
||||
}
|
||||
|
||||
|
@ -2193,7 +2204,7 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *U
|
|||
return OPERATOR_CANCELLED;
|
||||
|
||||
save_set_compress(op);
|
||||
save_set_filepath(op);
|
||||
save_set_filepath(C, op);
|
||||
|
||||
/* if we're saving for the first time and prefer relative paths - any existing paths will be absolute,
|
||||
* enable the option to remap paths to avoid confusion [#37240] */
|
||||
|
|
|
@ -115,7 +115,7 @@ static int wm_link_append_invoke(bContext *C, wmOperator *op, const wmEvent *UNU
|
|||
}
|
||||
else if (G.relbase_valid) {
|
||||
char path[FILE_MAX];
|
||||
BLI_strncpy(path, G.main->name, sizeof(G.main->name));
|
||||
BLI_strncpy(path, BKE_main_blendfile_path_from_global(), sizeof(path));
|
||||
BLI_parent_dir(path);
|
||||
RNA_string_set(op->ptr, "filepath", path);
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
|
|||
BKE_reportf(op->reports, RPT_ERROR, "'%s': nothing indicated", path);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
else if (BLI_path_cmp(bmain->name, libname) == 0) {
|
||||
else if (BLI_path_cmp(BKE_main_blendfile_path(bmain), libname) == 0) {
|
||||
BKE_reportf(op->reports, RPT_ERROR, "'%s': cannot use current file as library", path);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
|
|
@ -293,11 +293,11 @@ void WM_init(bContext *C, int argc, const char **argv)
|
|||
|
||||
/* allow a path of "", this is what happens when making a new file */
|
||||
#if 0
|
||||
if (G.main->name[0] == 0)
|
||||
if (BKE_main_blendfile_path_from_global()[0] == '\0')
|
||||
BLI_make_file_string("/", G.main->name, BKE_appdir_folder_default(), "untitled.blend");
|
||||
#endif
|
||||
|
||||
BLI_strncpy(G.lib, G.main->name, FILE_MAX);
|
||||
BLI_strncpy(G.lib, BKE_main_blendfile_path_from_global(), sizeof(G.lib));
|
||||
|
||||
#ifdef WITH_COMPOSITOR
|
||||
if (1) {
|
||||
|
|
|
@ -1437,7 +1437,7 @@ ID *WM_operator_drop_load_path(struct bContext *C, wmOperator *op, const short i
|
|||
if (is_relative_path ) {
|
||||
if (exists == false) {
|
||||
if (idcode == ID_IM) {
|
||||
BLI_path_rel(((Image *)id)->name, bmain->name);
|
||||
BLI_path_rel(((Image *)id)->name, BKE_main_blendfile_path(bmain));
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
|
|
|
@ -374,6 +374,7 @@ static void wm_block_confirm_quit_save(bContext *C, void *arg_block, void *UNUSE
|
|||
/* Build the confirm dialog UI */
|
||||
static uiBlock *block_create_confirm_quit(struct bContext *C, struct ARegion *ar, void *UNUSED(arg1))
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
|
||||
uiStyle *style = UI_style_get();
|
||||
uiBlock *block = UI_block_begin(C, ar, "confirm_quit_popup", UI_EMBOSS);
|
||||
|
@ -387,11 +388,11 @@ static uiBlock *block_create_confirm_quit(struct bContext *C, struct ARegion *ar
|
|||
/* Text and some vertical space */
|
||||
{
|
||||
char *message;
|
||||
if (G.main->name[0] == '\0') {
|
||||
if (BKE_main_blendfile_path(bmain)[0] == '\0') {
|
||||
message = BLI_strdup(IFACE_("This file has not been saved yet. Save before closing?"));
|
||||
}
|
||||
else {
|
||||
const char *basename = BLI_path_basename(G.main->name);
|
||||
const char *basename = BLI_path_basename(BKE_main_blendfile_path(bmain));
|
||||
message = BLI_sprintfN(IFACE_("Save changes to \"%s\" before closing?"), basename);
|
||||
}
|
||||
uiItemL(layout, message, ICON_ERROR);
|
||||
|
@ -546,9 +547,10 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win)
|
|||
}
|
||||
else if (win->ghostwin) {
|
||||
/* this is set to 1 if you don't have startup.blend open */
|
||||
if (G.save_over && G.main->name[0]) {
|
||||
char str[sizeof(G.main->name) + 24];
|
||||
BLI_snprintf(str, sizeof(str), "Blender%s [%s%s]", wm->file_saved ? "" : "*", G.main->name,
|
||||
if (G.save_over && BKE_main_blendfile_path_from_global()[0]) {
|
||||
char str[sizeof(((Main *)NULL)->name) + 24];
|
||||
BLI_snprintf(str, sizeof(str), "Blender%s [%s%s]", wm->file_saved ? "" : "*",
|
||||
BKE_main_blendfile_path_from_global(),
|
||||
G.main->recovered ? " (Recovered)" : "");
|
||||
GHOST_SetTitle(win->ghostwin, str);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue