Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/blenkernel/BKE_global.h4
-rw-r--r--source/blender/blenkernel/intern/blender.c13
-rw-r--r--source/blender/blenkernel/intern/customdata.c3
-rw-r--r--source/blender/blenkernel/intern/image.c16
-rw-r--r--source/blender/blenkernel/intern/library.c2
-rw-r--r--source/blender/blenkernel/intern/packedFile.c6
-rw-r--r--source/blender/blenkernel/intern/particle_system.c3
-rw-r--r--source/blender/blenkernel/intern/pointcache.c2
-rw-r--r--source/blender/blenkernel/intern/scene.c4
-rw-r--r--source/blender/blenkernel/intern/sequencer.c12
-rw-r--r--source/blender/blenkernel/intern/sound.c4
-rw-r--r--source/blender/blenkernel/intern/text.c2
-rw-r--r--source/blender/blenkernel/intern/writeavi.c3
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c2
-rw-r--r--source/blender/blenlib/BLI_bpath.h2
-rw-r--r--source/blender/blenlib/intern/bpath.c2
-rw-r--r--source/blender/blenloader/intern/readfile.c12
-rw-r--r--source/blender/blenloader/intern/writefile.c6
-rw-r--r--source/blender/collada/ImageExporter.cpp5
-rw-r--r--source/blender/editors/interface/interface_draw.c2
-rw-r--r--source/blender/editors/object/object_modifier.c2
-rw-r--r--source/blender/editors/physics/physics_fluid.c6
-rw-r--r--source/blender/editors/render/render_preview.c4
-rw-r--r--source/blender/editors/render/render_shading.c6
-rw-r--r--source/blender/editors/screen/screendump.c3
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c3
-rw-r--r--source/blender/editors/space_file/file_draw.c5
-rw-r--r--source/blender/editors/space_file/file_ops.c15
-rw-r--r--source/blender/editors/space_file/filelist.c8
-rw-r--r--source/blender/editors/space_file/filesel.c7
-rw-r--r--source/blender/editors/space_file/writeimage.c5
-rw-r--r--source/blender/editors/space_image/image_ops.c12
-rw-r--r--source/blender/editors/space_info/info_ops.c8
-rw-r--r--source/blender/editors/space_outliner/outliner.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c2
-rw-r--r--source/blender/editors/space_text/text_ops.c12
-rw-r--r--source/blender/makesrna/intern/rna_image_api.c4
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim_util.c5
-rw-r--r--source/blender/python/generic/bpy_internal_import.c4
-rw-r--r--source/blender/quicktime/apple/quicktime_export.c2
-rw-r--r--source/blender/render/intern/source/pipeline.c4
-rw-r--r--source/blender/windowmanager/intern/wm_files.c23
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c6
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c10
-rw-r--r--source/blender/windowmanager/intern/wm_window.c11
-rw-r--r--source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp10
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderGL.cpp3
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_ghost.cpp4
49 files changed, 147 insertions, 148 deletions
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index 6a602339e11..76fb5605d77 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -52,9 +52,9 @@ typedef struct Global {
struct Main *main;
/* strings: lastsaved */
- char ima[256], sce[256], lib[256];
+ char ima[256], lib[256];
- /* flag: if != 0 G.sce contains valid relative base path */
+ /* flag: if != 0 G.main->name contains valid relative base path */
int relbase_valid;
/* strings of recent opend files */
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 5fcf3c77d3b..72d194e4d79 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -309,8 +309,8 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename)
#endif
/* these are the same at times, should never copy to the same location */
- if(G.sce != filename)
- BLI_strncpy(G.sce, filename, FILE_MAX);
+ if(G.main->name != filename)
+ BLI_strncpy(G.main->name, filename, FILE_MAX);
BLI_strncpy(G.main->name, filename, FILE_MAX); /* is guaranteed current file */
@@ -410,7 +410,7 @@ int BKE_read_file_from_memfile(bContext *C, MemFile *memfile, ReportList *report
{
BlendFileData *bfd;
- bfd= BLO_read_from_memfile(CTX_data_main(C), G.sce, memfile, reports);
+ bfd= BLO_read_from_memfile(CTX_data_main(C), G.main->name, memfile, reports);
if (bfd)
setup_app_data(C, bfd, "<memory1>");
else
@@ -460,14 +460,12 @@ static UndoElem *curundo= NULL;
static int read_undosave(bContext *C, UndoElem *uel)
{
- char scestr[FILE_MAXDIR+FILE_MAXFILE]; /* we should eventually just use G.main->name */
char mainstr[FILE_MAXDIR+FILE_MAXFILE];
int success=0, fileflags;
/* This is needed so undoing/redoing doesnt crash with threaded previews going */
WM_jobs_stop_all(CTX_wm_manager(C));
-
- strcpy(scestr, G.sce); /* temporal store */
+
strcpy(mainstr, G.main->name); /* temporal store */
fileflags= G.fileflags;
@@ -479,7 +477,6 @@ static int read_undosave(bContext *C, UndoElem *uel)
success= BKE_read_file_from_memfile(C, &uel->memfile, NULL);
/* restore */
- strcpy(G.sce, scestr); /* restore */
strcpy(G.main->name, mainstr); /* restore */
G.fileflags= fileflags;
@@ -720,7 +717,7 @@ void BKE_undo_save_quit(void)
Main *BKE_undo_get_main(Scene **scene)
{
Main *mainp= NULL;
- BlendFileData *bfd= BLO_read_from_memfile(G.main, G.sce, &curundo->memfile, NULL);
+ BlendFileData *bfd= BLO_read_from_memfile(G.main, G.main->name, &curundo->memfile, NULL);
if(bfd) {
mainp= bfd->main;
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 7f91df3b281..9c4f0d790ca 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -48,6 +48,7 @@
#include "BKE_customdata.h"
#include "BKE_customdata_file.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BKE_utildefines.h"
/* number of layers to add when growing a CustomData object */
@@ -2343,7 +2344,7 @@ int CustomData_verify_versions(struct CustomData *data, int index)
static void customdata_external_filename(char filename[FILE_MAX], ID *id, CustomDataExternal *external)
{
- char *path = (id->lib)? id->lib->filepath: G.sce;
+ char *path = (id->lib)? id->lib->filepath: G.main->name;
BLI_strncpy(filename, external->filename, FILE_MAX);
BLI_path_abs(filename, path);
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 8ba7cde519d..09622b2acfe 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -338,7 +338,7 @@ Image *BKE_add_image_file(const char *name)
char str[FILE_MAX], strtest[FILE_MAX];
BLI_strncpy(str, name, sizeof(str));
- BLI_path_abs(str, G.sce);
+ BLI_path_abs(str, G.main->name);
/* exists? */
file= open(str, O_BINARY|O_RDONLY);
@@ -349,7 +349,7 @@ Image *BKE_add_image_file(const char *name)
for(ima= G.main->image.first; ima; ima= ima->id.next) {
if(ima->source!=IMA_SRC_VIEWER && ima->source!=IMA_SRC_GENERATED) {
BLI_strncpy(strtest, ima->name, sizeof(ima->name));
- BLI_path_abs(strtest, G.sce);
+ BLI_path_abs(strtest, G.main->name);
if( strcmp(strtest, str)==0 ) {
if(ima->anim==NULL || ima->id.us==0) {
@@ -861,8 +861,8 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix)
if (scene->r.stamp & R_STAMP_FILENAME) {
if (G.relbase_valid) {
- if (do_prefix) sprintf(stamp_data->file, "File %s", G.sce);
- else sprintf(stamp_data->file, "%s", G.sce);
+ if (do_prefix) sprintf(stamp_data->file, "File %s", G.main->name);
+ else sprintf(stamp_data->file, "%s", G.main->name);
} else {
if (do_prefix) strcpy(stamp_data->file, "File <untitled>");
else strcpy(stamp_data->file, "<untitled>");
@@ -1311,7 +1311,7 @@ void BKE_makepicstring(char *string, char *base, int frame, int imtype, int use_
{
if (string==NULL) return;
BLI_strncpy(string, base, FILE_MAX - 10); /* weak assumption */
- BLI_path_abs(string, G.sce);
+ BLI_path_abs(string, G.main->name);
BLI_path_frame(string, frame, 4);
if(use_ext)
@@ -1609,7 +1609,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
if(ima->id.lib)
BLI_path_abs(name, ima->id.lib->filepath);
else
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
flag= IB_rect|IB_multilayer;
if(ima->flag & IMA_DO_PREMUL)
@@ -1717,7 +1717,7 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
if(ima->id.lib)
BLI_path_abs(str, ima->id.lib->filepath);
else
- BLI_path_abs(str, G.sce);
+ BLI_path_abs(str, G.main->name);
ima->anim = openanim(str, IB_rect);
@@ -1778,7 +1778,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
if(ima->id.lib)
BLI_path_abs(str, ima->id.lib->filepath);
else
- BLI_path_abs(str, G.sce);
+ BLI_path_abs(str, G.main->name);
/* read ibuf */
ibuf = IMB_loadiffname(str, flag);
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 1e08432c271..dfc82152e8c 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1234,7 +1234,7 @@ static void image_fix_relative_path(Image *ima)
if(ima->id.lib==NULL) return;
if(strncmp(ima->name, "//", 2)==0) {
BLI_path_abs(ima->name, ima->id.lib->filepath);
- BLI_path_rel(ima->name, G.sce);
+ BLI_path_rel(ima->name, G.main->name);
}
}
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index 5bbb3506a78..33f1949c5ac 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -179,7 +179,7 @@ PackedFile *newPackedFile(ReportList *reports, char *filename)
// convert relative filenames to absolute filenames
strcpy(name, filename);
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
// open the file
// and create a PackedFile structure
@@ -274,7 +274,7 @@ int writePackedFile(ReportList *reports, char *filename, PackedFile *pf, int gui
if (guimode) {} //XXX waitcursor(1);
strcpy(name, filename);
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
if (BLI_exists(name)) {
for (number = 1; number <= 999; number++) {
@@ -339,7 +339,7 @@ int checkPackedFile(char *filename, PackedFile *pf)
char name[FILE_MAXDIR + FILE_MAXFILE];
strcpy(name, filename);
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
if (stat(name, &st)) {
ret_val = PF_NOFILE;
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 8ab4117c8a1..71ec1114848 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -63,6 +63,7 @@
#include "BLI_listbase.h"
#include "BLI_threads.h"
+#include "BKE_main.h"
#include "BKE_animsys.h"
#include "BKE_boids.h"
#include "BKE_cdderivedmesh.h"
@@ -3607,7 +3608,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
// ok, start loading
strcpy(filename, fss->surfdataPath);
strcat(filename, suffix);
- BLI_path_abs(filename, G.sce);
+ BLI_path_abs(filename, G.main->name);
BLI_path_frame(filename, curFrame, 0); // fixed #frame-no
strcat(filename, suffix2);
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 3896d523b11..37d2b103ef0 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -1085,7 +1085,7 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
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.sce;
+ const char *blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: G.main->name;
size_t i;
if(pid->cache->flag & PTCACHE_EXTERNAL) {
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index fde180cadc6..e399e0bb83d 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -566,11 +566,11 @@ Scene *set_scene_name(Main *bmain, char *name)
Scene *sce= (Scene *)find_id("SC", name);
if(sce) {
set_scene_bg(bmain, sce);
- printf("Scene switch: '%s' in file: '%s'\n", name, G.sce);
+ printf("Scene switch: '%s' in file: '%s'\n", name, G.main->name);
return sce;
}
- printf("Can't find scene: '%s' in file: '%s'\n", name, G.sce);
+ printf("Can't find scene: '%s' in file: '%s'\n", name, G.main->name);
return NULL;
}
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 6d087837302..21b7cfd010c 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -579,7 +579,7 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range)
if (seq->type != SEQ_SCENE && seq->type != SEQ_META &&
seq->type != SEQ_IMAGE) {
BLI_join_dirfile(str, seq->strip->dir, seq->strip->stripdata->name);
- BLI_path_abs(str, G.sce);
+ BLI_path_abs(str, G.main->name);
}
if (seq->type == SEQ_IMAGE) {
@@ -1044,7 +1044,7 @@ static int seq_proxy_get_fname(Scene *UNUSED(scene), Sequence * seq, int cfra, c
if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
BLI_join_dirfile(name, dir, seq->strip->proxy->file);
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
return TRUE;
}
@@ -1071,7 +1071,7 @@ static int seq_proxy_get_fname(Scene *UNUSED(scene), Sequence * seq, int cfra, c
render_size);
}
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
BLI_path_frame(name, frameno, 0);
@@ -2002,7 +2002,7 @@ static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float
if(ibuf == 0 && s_elem) {
BLI_join_dirfile(name, seq->strip->dir, s_elem->name);
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
ibuf = seq_proxy_fetch(scene, seq, cfra, render_size);
}
@@ -2038,7 +2038,7 @@ static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float
BLI_join_dirfile(name,
seq->strip->dir,
seq->strip->stripdata->name);
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
seq->anim = openanim(
name, IB_rect |
@@ -3492,7 +3492,7 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
struct anim *an;
BLI_strncpy(path, seq_load->path, sizeof(path));
- BLI_path_abs(path, G.sce);
+ BLI_path_abs(path, G.main->name);
an = openanim(path, IB_rect);
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 5c3047942f7..cc941c81131 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -131,7 +131,7 @@ struct bSound* sound_new_file(struct Main *bmain, char* filename)
strcpy(str, filename);
- path = /*bmain ? bmain->name :*/ G.sce;
+ path = /*bmain ? bmain->name :*/ G.main->name;
BLI_path_abs(str, path);
@@ -267,7 +267,7 @@ void sound_load(struct Main *UNUSED(bmain), struct bSound* sound)
path = sound->id.lib->filepath;
else
// XXX this should be fixed!
- path = /*bmain ? bmain->name :*/ G.sce;
+ path = /*bmain ? bmain->name :*/ G.main->name;
BLI_path_abs(fullpath, path);
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 19bc853276a..bb1a1a88a09 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -241,7 +241,7 @@ int reopen_text(Text *text)
if (!text || !text->name) return 0;
BLI_strncpy(str, text->name, FILE_MAXDIR+FILE_MAXFILE);
- BLI_path_abs(str, G.sce);
+ BLI_path_abs(str, G.main->name);
fp= fopen(str, "r");
if(fp==NULL) return 0;
diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c
index 8363ff13ef9..de708f216fd 100644
--- a/source/blender/blenkernel/intern/writeavi.c
+++ b/source/blender/blenkernel/intern/writeavi.c
@@ -40,6 +40,7 @@
#include "BLI_blenlib.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_utildefines.h"
#include "BKE_writeavi.h"
@@ -119,7 +120,7 @@ static void filepath_avi (char *string, RenderData *rd)
if (string==NULL) return;
strcpy(string, rd->pic);
- BLI_path_abs(string, G.sce);
+ BLI_path_abs(string, G.main->name);
BLI_make_existing_file(string);
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 473c10d6ced..ec998e68e00 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -857,7 +857,7 @@ void filepath_ffmpeg(char* string, RenderData* rd) {
if (!string || !exts) return;
strcpy(string, rd->pic);
- BLI_path_abs(string, G.sce);
+ BLI_path_abs(string, G.main->name);
BLI_make_existing_file(string);
diff --git a/source/blender/blenlib/BLI_bpath.h b/source/blender/blenlib/BLI_bpath.h
index 72489a171b9..34b9e282061 100644
--- a/source/blender/blenlib/BLI_bpath.h
+++ b/source/blender/blenlib/BLI_bpath.h
@@ -50,7 +50,7 @@ struct BPathIterator {
void (*setpath_callback)(struct BPathIterator *, char *);
void (*getpath_callback)(struct BPathIterator *, char *);
- char* base_path; /* base path, the directry the blend file is in - normally G.sce */
+ char* base_path; /* base path, the directry the blend file is in - normally G.main->name */
/* only for seq data */
struct BPathIteratorSeqData seqdata;
diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c
index cf7eb873409..862df4103a7 100644
--- a/source/blender/blenlib/intern/bpath.c
+++ b/source/blender/blenlib/intern/bpath.c
@@ -92,7 +92,7 @@ void BLI_bpathIterator_init( struct BPathIterator *bpi, char *base_path ) {
bpi->seqdata.seqar = NULL;
bpi->seqdata.scene = NULL;
- bpi->base_path= base_path ? base_path : G.sce;
+ bpi->base_path= base_path ? base_path : G.main->name;
BLI_bpathIterator_step(bpi);
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index ebd407e7e21..b6515863c2b 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -9707,7 +9707,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
{
char str[FILE_MAX];
BLI_join_dirfile(str, seq->strip->dir, seq->strip->stripdata->name);
- BLI_path_abs(str, G.sce);
+ BLI_path_abs(str, G.main->name);
seq->sound = sound_new_file(main, str);
}
/* don't know, if anybody used that
@@ -12369,7 +12369,7 @@ static Main* library_append_begin(const bContext *C, FileData **fd, char *dir)
blo_split_main(&(*fd)->mainlist, mainvar);
/* which one do we need? */
- mainl = blo_find_main(*fd, &(*fd)->mainlist, dir, G.sce);
+ mainl = blo_find_main(*fd, &(*fd)->mainlist, dir, G.main->name);
/* needed for do_version */
mainl->versionfile= (*fd)->fileversion;
@@ -12453,7 +12453,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
BLI_strncpy(curlib->name, curlib->filepath, sizeof(curlib->name));
/* uses current .blend file as reference */
- BLI_path_rel(curlib->name, G.sce);
+ BLI_path_rel(curlib->name, G.main->name);
}
blo_join_main(&(*fd)->mainlist);
@@ -12462,7 +12462,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
lib_link_all(*fd, mainvar);
lib_verify_nodetree(mainvar, FALSE);
- fix_relpaths_library(G.sce, mainvar); /* make all relative paths, relative to the open blend file */
+ fix_relpaths_library(G.main->name, mainvar); /* make all relative paths, relative to the open blend file */
/* give a base to loose objects. If group append, do it for objects too */
if(scene) {
@@ -12578,7 +12578,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
while(fd==NULL) {
char newlib_path[240] = { 0 };
printf("Missing library...'\n");
- printf(" current file: %s\n", G.sce);
+ printf(" current file: %s\n", G.main->name);
printf(" absolute lib: %s\n", mainptr->curlib->filepath);
printf(" relative lib: %s\n", mainptr->curlib->name);
printf(" enter a new path:\n");
@@ -12586,7 +12586,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
if(scanf("%s", newlib_path) > 0) {
strcpy(mainptr->curlib->name, newlib_path);
strcpy(mainptr->curlib->filepath, newlib_path);
- cleanup_path(G.sce, mainptr->curlib->filepath);
+ cleanup_path(G.main->name, mainptr->curlib->filepath);
fd= blo_openblenderfile(mainptr->curlib->filepath, basefd->reports);
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 440f1cc98a8..b5715353c6c 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2471,14 +2471,14 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report
if(strcmp(dir1, dir2)==0)
write_flags &= ~G_FILE_RELATIVE_REMAP;
else
- makeFilesAbsolute(G.sce, NULL);
+ makeFilesAbsolute(G.main->name, NULL);
}
- BLI_make_file_string(G.sce, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE);
+ BLI_make_file_string(G.main->name, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE);
write_user_block= BLI_streq(dir, userfilename);
if(write_flags & G_FILE_RELATIVE_REMAP)
- makeFilesRelative(dir, NULL); /* note, making relative to something OTHER then G.sce */
+ makeFilesRelative(dir, NULL); /* note, making relative to something OTHER then G.main->name */
/* actual file writing */
err= write_file_handle(mainvar, file, NULL,NULL, write_user_block, write_flags, thumb);
diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp
index ce40846ba59..3194b2269ea 100644
--- a/source/blender/collada/ImageExporter.cpp
+++ b/source/blender/collada/ImageExporter.cpp
@@ -32,6 +32,7 @@
#include "DNA_texture_types.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BKE_utildefines.h"
#include "BLI_fileops.h"
#include "BLI_path_util.h"
@@ -66,13 +67,13 @@ void ImagesExporter::operator()(Material *ma, Object *ob)
BLI_split_dirfile(mfilename, dir, NULL);
- BKE_rebase_path(abs, sizeof(abs), rel, sizeof(rel), G.sce, image->name, dir);
+ BKE_rebase_path(abs, sizeof(abs), rel, sizeof(rel), G.main->name, image->name, dir);
if (abs[0] != '\0') {
// make absolute source path
BLI_strncpy(src, image->name, sizeof(src));
- BLI_path_abs(src, G.sce);
+ BLI_path_abs(src, G.main->name);
// make dest directory if it doesn't exist
BLI_make_existing_file(abs);
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 855ca45f61a..81b04fea062 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -564,7 +564,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
int err;
strcpy(tmpStr, G.selfont->name);
- BLI_path_abs(tmpStr, G.sce);
+ BLI_path_abs(tmpStr, G.main->name);
err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0);
}
}
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 3bdf202aca9..c273b375a06 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -1058,7 +1058,7 @@ static int multires_external_save_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", path);
if(relative)
- BLI_path_rel(path, G.sce);
+ BLI_path_rel(path, G.main->name);
CustomData_external_add(&me->fdata, &me->id, CD_MDISPS, me->totface, path);
CustomData_external_write(&me->fdata, &me->id, CD_MASK_MESH, me->totface, 0);
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 6dc4684d815..b1c373e7a91 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -639,7 +639,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
// prepare names...
strncpy(targetDir, domainSettings->surfdataPath, FILE_MAXDIR);
strncpy(newSurfdataPath, domainSettings->surfdataPath, FILE_MAXDIR);
- BLI_path_abs(targetDir, G.sce); // fixed #frame-no
+ BLI_path_abs(targetDir, G.main->name); // fixed #frame-no
strcpy(targetFile, targetDir);
strcat(targetFile, suffixConfig);
@@ -663,7 +663,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
char blendFile[FILE_MAXDIR+FILE_MAXFILE];
// invalid dir, reset to current/previous
- strcpy(blendDir, G.sce);
+ strcpy(blendDir, G.main->name);
BLI_splitdirstring(blendDir, blendFile);
if(strlen(blendFile)>6){
int len = strlen(blendFile);
@@ -694,7 +694,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
if(selection<1) return 0; // 0 from menu, or -1 aborted
strcpy(targetDir, newSurfdataPath);
strncpy(domainSettings->surfdataPath, newSurfdataPath, FILE_MAXDIR);
- BLI_path_abs(targetDir, G.sce); // fixed #frame-no
+ BLI_path_abs(targetDir, G.main->name); // fixed #frame-no
}
#endif
return outStringsChanged;
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 21f10d936bf..0e8587e4642 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -111,7 +111,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.sce);
+ BLI_path_abs(path, G.main->name);
brush->icon_imbuf= IMB_loadiffname(path, flags);
@@ -121,7 +121,7 @@ ImBuf* get_brush_icon(Brush *brush)
path[0]= 0;
- BLI_make_file_string(G.sce, path, folder, brush->icon_filepath);
+ BLI_make_file_string(G.main->name, path, folder, brush->icon_filepath);
if (path[0])
brush->icon_imbuf= IMB_loadiffname(path, flags);
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index bca8100a809..9db15ee43e5 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -852,7 +852,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int
ibuf->profile = IB_PROFILE_LINEAR_RGB;
/* to save, we first get absolute path */
- BLI_path_abs(str, G.sce);
+ BLI_path_abs(str, G.main->name);
if (BKE_write_ibuf(scene, ibuf, str, imtype, scene->r.subimtype, scene->r.quality)) {
retval = OPERATOR_FINISHED;
@@ -863,7 +863,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int
}
/* in case we were saving with relative paths, change back again */
if(relative)
- BLI_path_rel(str, G.sce);
+ BLI_path_rel(str, G.main->name);
IMB_freeImBuf(ibuf);
ibuf = NULL;
@@ -908,7 +908,7 @@ static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event
//RNA_enum_set(op->ptr, "file_type", scene->r.imtype);
- RNA_string_set(op->ptr, "filepath", G.sce);
+ RNA_string_set(op->ptr, "filepath", G.main->name);
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 937441a6e43..082c9f2f721 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -42,6 +42,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BKE_image.h"
#include "BKE_report.h"
#include "BKE_writeavi.h"
@@ -77,7 +78,7 @@ static int screenshot_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", path);
strcpy(G.ima, path);
- BLI_path_abs(path, G.sce);
+ BLI_path_abs(path, G.main->name);
/* BKE_add_image_extension() checks for if extension was already set */
if(scene->r.scemode & R_EXTENSION)
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 2573470e8df..e72446366fe 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -39,6 +39,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -104,7 +105,7 @@ static int file_browse_exec(bContext *C, wmOperator *op)
/* add slash for directories, important for some properties */
if(RNA_property_subtype(fbo->prop) == PROP_DIRPATH) {
id = fbo->ptr.id.data;
- base = (id && id->lib)? id->lib->filepath: G.sce;
+ base = (id && id->lib)? id->lib->filepath: G.main->name;
BLI_strncpy(path, str, FILE_MAX);
BLI_path_abs(path, base);
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 421b14e5bbe..65415d382ec 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -40,6 +40,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BLF_api.h"
@@ -445,9 +446,9 @@ static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
struct direntry *file = (struct direntry *)arg1;
#endif
- BLI_make_file_string(G.sce, orgname, sfile->params->dir, oldname);
+ BLI_make_file_string(G.main->name, orgname, sfile->params->dir, oldname);
BLI_strncpy(filename, sfile->params->renameedit, sizeof(filename));
- BLI_make_file_string(G.sce, newname, sfile->params->dir, filename);
+ BLI_make_file_string(G.main->name, newname, sfile->params->dir, filename);
if( strcmp(orgname, newname) != 0 ) {
if (!BLI_exists(newname)) {
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 6dfdcfd430a..1af8e9d14be 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -30,6 +30,7 @@
#include "BKE_screen.h"
#include "BKE_global.h"
#include "BKE_report.h"
+#include "BKE_main.h"
#include "BLI_blenlib.h"
#include "BLI_storage_types.h"
@@ -190,7 +191,7 @@ static FileSelect file_select(bContext* C, const rcti* rect, short selecting, sh
/* avoids /../../ */
BLI_parent_dir(params->dir);
} else {
- BLI_cleanup_dir(G.sce, params->dir);
+ BLI_cleanup_dir(G.main->name, params->dir);
strcat(params->dir, file->relname);
BLI_add_slash(params->dir);
}
@@ -361,7 +362,7 @@ static int bookmark_select_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "dir", entry);
BLI_strncpy(params->dir, entry, sizeof(params->dir));
- BLI_cleanup_dir(G.sce, params->dir);
+ BLI_cleanup_dir(G.main->name, params->dir);
file_change_dir(C, 1);
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
@@ -544,7 +545,7 @@ void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath)
BLI_join_dirfile(filepath, sfile->params->dir, sfile->params->file);
if(RNA_struct_find_property(op->ptr, "relative_path")) {
if(RNA_boolean_get(op->ptr, "relative_path")) {
- BLI_path_rel(filepath, G.sce);
+ BLI_path_rel(filepath, G.main->name);
}
}
@@ -680,7 +681,7 @@ int file_exec(bContext *C, wmOperator *exec_op)
file_sfile_to_operator(op, sfile, filepath);
fsmenu_insert_entry(fsmenu_get(), FS_CATEGORY_RECENT, sfile->params->dir,0, 1);
- BLI_make_file_string(G.sce, filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE);
+ BLI_make_file_string(G.main->name, filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE);
fsmenu_write_file(fsmenu_get(), filepath);
WM_event_fileselect_event(C, op, EVT_FILESELECT_EXEC);
@@ -711,7 +712,7 @@ int file_parent_exec(bContext *C, wmOperator *UNUSED(unused))
if(sfile->params) {
if (BLI_has_parent(sfile->params->dir)) {
BLI_parent_dir(sfile->params->dir);
- BLI_cleanup_dir(G.sce, sfile->params->dir);
+ BLI_cleanup_dir(G.main->name, sfile->params->dir);
file_change_dir(C, 0);
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
}
@@ -1010,7 +1011,7 @@ int file_directory_exec(bContext *C, wmOperator *UNUSED(unused))
if (sfile->params->dir[0] == '\0')
get_default_root(sfile->params->dir);
#endif
- BLI_cleanup_dir(G.sce, sfile->params->dir);
+ BLI_cleanup_dir(G.main->name, sfile->params->dir);
BLI_add_slash(sfile->params->dir);
file_change_dir(C, 1);
@@ -1240,7 +1241,7 @@ int file_delete_exec(bContext *C, wmOperator *UNUSED(op))
file = filelist_file(sfile->files, sfile->params->active_file);
- BLI_make_file_string(G.sce, str, sfile->params->dir, file->relname);
+ BLI_make_file_string(G.main->name, str, sfile->params->dir, file->relname);
BLI_delete(str, 0, 0);
ED_fileselect_clear(C, sfile);
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 68a93d39062..43d5d54805d 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -730,7 +730,7 @@ static void filelist_read_dir(struct FileList* filelist)
BLI_getwdN(wdir);
- BLI_cleanup_dir(G.sce, filelist->dir);
+ BLI_cleanup_dir(G.main->name, filelist->dir);
filelist->numfiles = BLI_getdir(filelist->dir, &(filelist->filelist));
if(!chdir(wdir)) {} /* fix warning about not checking return value */
@@ -747,7 +747,7 @@ static void filelist_read_main(struct FileList* filelist)
static void filelist_read_library(struct FileList* filelist)
{
if (!filelist) return;
- BLI_cleanup_dir(G.sce, filelist->dir);
+ BLI_cleanup_dir(G.main->name, filelist->dir);
filelist_from_library(filelist);
if(!filelist->libfiledata) {
int num;
@@ -912,7 +912,7 @@ void filelist_from_library(struct FileList* filelist)
return;
}
- BLI_strncpy(filename, G.sce, sizeof(filename)); // G.sce = last file loaded, for UI
+ BLI_strncpy(filename, G.main->name, sizeof(filename));
/* there we go */
/* for the time being only read filedata when libfiledata==0 */
@@ -979,7 +979,7 @@ void filelist_from_library(struct FileList* filelist)
filelist_sort(filelist, FILE_SORT_ALPHA);
- BLI_strncpy(G.sce, filename, sizeof(filename)); // prevent G.sce to change
+ BLI_strncpy(G.main->name, filename, sizeof(filename)); // prevent G.main->name to change
filelist->filter = 0;
filelist_filter(filelist);
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index b36cfe66a36..8ad3ef08e85 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -64,6 +64,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BLF_api.h"
@@ -104,7 +105,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
if (!sfile->params) {
sfile->params= MEM_callocN(sizeof(FileSelectParams), "fileselparams");
/* set path to most recently opened .blend */
- BLI_split_dirfile(G.sce, sfile->params->dir, sfile->params->file);
+ BLI_split_dirfile(G.main->name, sfile->params->dir, sfile->params->file);
sfile->params->filter_glob[0] = '\0';
}
@@ -142,8 +143,8 @@ short ED_fileselect_set_params(SpaceFile *sfile)
}
if(params->dir[0]) {
- BLI_cleanup_dir(G.sce, params->dir);
- BLI_path_abs(params->dir, G.sce);
+ BLI_cleanup_dir(G.main->name, params->dir);
+ BLI_path_abs(params->dir, G.main->name);
}
params->filter = 0;
diff --git a/source/blender/editors/space_file/writeimage.c b/source/blender/editors/space_file/writeimage.c
index f5ce5a818d7..750cf98727a 100644
--- a/source/blender/editors/space_file/writeimage.c
+++ b/source/blender/editors/space_file/writeimage.c
@@ -41,6 +41,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BKE_image.h"
#include "RE_pipeline.h"
@@ -75,7 +76,7 @@ static void save_rendered_image_cb_real(char *name, int confirm)
BKE_add_image_extension(name, scene->r.imtype);
strcpy(str, name);
- BLI_path_abs(str, G.sce);
+ BLI_path_abs(str, G.main->name);
if (confirm)
overwrite = saveover(str);
@@ -218,7 +219,7 @@ void BIF_save_rendered_image_fs(Scene *scene)
char dir[FILE_MAXDIR * 2], str[FILE_MAXFILE * 2];
if(G.ima[0]==0) {
- strcpy(dir, G.sce);
+ strcpy(dir, G.main->name);
BLI_splitdirstring(dir, str);
strcpy(G.ima, dir);
}
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index a44258351ce..429ba64ed0f 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -133,7 +133,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, G.sce);
+ BLI_path_abs(name, G.main->name);
poll= (BLI_exists(name) && BLI_is_writable(name));
}
ED_space_image_release_buffer(sima, lock);
@@ -856,7 +856,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
int relative= (RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path"));
int save_copy= (RNA_struct_find_property(op->ptr, "copy") && RNA_boolean_get(op->ptr, "copy"));
- BLI_path_abs(path, G.sce);
+ BLI_path_abs(path, G.main->name);
if(scene->r.scemode & R_EXTENSION) {
BKE_add_image_extension(path, sima->imtypenr);
@@ -876,7 +876,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
RE_WriteRenderResult(rr, path, scene->r.quality);
if(relative)
- BLI_path_rel(path, G.sce); /* only after saving */
+ BLI_path_rel(path, G.main->name); /* only after saving */
if(!save_copy) {
if(do_newpath) {
@@ -896,7 +896,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
else if (BKE_write_ibuf(scene, ibuf, path, sima->imtypenr, scene->r.subimtype, scene->r.quality)) {
if(relative)
- BLI_path_rel(path, G.sce); /* only after saving */
+ BLI_path_rel(path, G.main->name); /* only after saving */
if(!save_copy) {
if(do_newpath) {
@@ -1071,7 +1071,7 @@ static int save_exec(bContext *C, wmOperator *op)
if(name[0]==0)
BLI_strncpy(name, G.ima, FILE_MAX);
else
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
if(BLI_exists(name) && BLI_is_writable(name)) {
rr= BKE_image_acquire_renderresult(scene, ima);
@@ -1157,7 +1157,7 @@ static int save_sequence_exec(bContext *C, wmOperator *op)
char name[FILE_MAX];
BLI_strncpy(name, ibuf->name, sizeof(name));
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
if(0 == IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat)) {
BKE_reportf(op->reports, RPT_ERROR, "Could not write image %s.", name);
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index c87b25877b4..aeb32cda6bd 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -191,7 +191,7 @@ static int make_paths_relative_exec(bContext *UNUSED(C), wmOperator *op)
return OPERATOR_CANCELLED;
}
- makeFilesRelative(G.sce, op->reports);
+ makeFilesRelative(G.main->name, op->reports);
return OPERATOR_FINISHED;
}
@@ -218,7 +218,7 @@ static int make_paths_absolute_exec(bContext *UNUSED(C), wmOperator *op)
return OPERATOR_CANCELLED;
}
- makeFilesAbsolute(G.sce, op->reports);
+ makeFilesAbsolute(G.main->name, op->reports);
return OPERATOR_FINISHED;
}
@@ -244,7 +244,7 @@ static int report_missing_files_exec(bContext *UNUSED(C), wmOperator *op)
txtname[0] = '\0';
/* run the missing file check */
- checkMissingFiles(G.sce, op->reports);
+ checkMissingFiles(G.main->name, op->reports);
return OPERATOR_FINISHED;
}
@@ -269,7 +269,7 @@ static int find_missing_files_exec(bContext *UNUSED(C), wmOperator *op)
char *path;
path= RNA_string_get_alloc(op->ptr, "filepath", NULL, 0);
- findMissingFiles(path, G.sce);
+ findMissingFiles(path, G.main->name);
MEM_freeN(path);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index 6040b755e30..1f0725c5458 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -5035,7 +5035,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
if (te->idcode == ID_LI) {
char expanded[FILE_MAXDIR + FILE_MAXFILE];
BLI_strncpy(expanded, ((Library *)tselem->id)->name, FILE_MAXDIR + FILE_MAXFILE);
- BLI_path_abs(expanded, G.sce);
+ BLI_path_abs(expanded, G.main->name);
if (!BLI_exists(expanded)) {
error("This path does not exist, correct this before saving");
}
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index b9db18f7850..5f0693dc43c 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -101,7 +101,7 @@ static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op,
if(last_seq && last_seq->strip && SEQ_HAS_PATH(last_seq)) {
char path[sizeof(last_seq->strip->dir)];
BLI_strncpy(path, last_seq->strip->dir, sizeof(path));
- BLI_path_abs(path, G.sce);
+ BLI_path_abs(path, G.main->name);
RNA_string_set(op->ptr, identifier, path);
}
}
@@ -152,7 +152,7 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
}
if((is_file != -1) && relative)
- BLI_path_rel(seq_load->path, G.sce);
+ BLI_path_rel(seq_load->path, G.main->name);
if (RNA_struct_find_property(op->ptr, "frame_end")) {
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index bd53615feda..35f27953633 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -992,7 +992,7 @@ void touch_seq_files(Scene *scene)
if(seq->flag & SELECT) {
if(seq->type==SEQ_MOVIE) {
if(seq->strip && seq->strip->stripdata) {
- BLI_make_file_string(G.sce, str, seq->strip->dir, seq->strip->stripdata->name);
+ BLI_make_file_string(G.main->name, str, seq->strip->dir, seq->strip->stripdata->name);
BLI_touch(seq->name);
}
}
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 90fab7b2902..8d4f3f87f66 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -221,7 +221,7 @@ static int open_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", str);
- text= add_text(str, G.sce);
+ text= add_text(str, G.main->name);
if(!text) {
if(op->customdata) MEM_freeN(op->customdata);
@@ -266,7 +266,7 @@ static int open_exec(bContext *C, wmOperator *op)
static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Text *text= CTX_data_edit_text(C);
- char *path= (text && text->name)? text->name: G.sce;
+ char *path= (text && text->name)? text->name: G.main->name;
if(RNA_property_is_set(op->ptr, "filepath"))
return open_exec(C, op);
@@ -438,7 +438,7 @@ static void txt_write_file(Text *text, ReportList *reports)
char file[FILE_MAXDIR+FILE_MAXFILE];
BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE);
- BLI_path_abs(file, G.sce);
+ BLI_path_abs(file, G.main->name);
fp= fopen(file, "w");
if(fp==NULL) {
@@ -524,7 +524,7 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
else if(text->flags & TXT_ISMEM)
str= text->id.name+2;
else
- str= G.sce;
+ str= G.main->name;
RNA_string_set(op->ptr, "filepath", str);
WM_event_add_fileselect(C, op);
@@ -2860,7 +2860,7 @@ int text_file_modified(Text *text)
return 0;
BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE);
- BLI_path_abs(file, G.sce);
+ BLI_path_abs(file, G.main->name);
if(!BLI_exists(file))
return 2;
@@ -2888,7 +2888,7 @@ static void text_ignore_modified(Text *text)
if(!text || !text->name) return;
BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE);
- BLI_path_abs(file, G.sce);
+ BLI_path_abs(file, G.main->name);
if(!BLI_exists(file)) return;
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c
index 70438ae3d8c..74d61101273 100644
--- a/source/blender/makesrna/intern/rna_image_api.c
+++ b/source/blender/makesrna/intern/rna_image_api.c
@@ -41,7 +41,7 @@
#include "BKE_packedFile.h"
#include "BKE_main.h"
#include "BKE_utildefines.h"
-#include "BKE_global.h" /* grr: G.sce */
+#include "BKE_global.h" /* grr: G.main->name */
#include "IMB_imbuf.h"
@@ -90,7 +90,7 @@ static void rna_Image_save(Image *image, ReportList *reports)
if(ibuf) {
char filename[FILE_MAXDIR + FILE_MAXFILE];
BLI_strncpy(filename, image->name, sizeof(filename));
- BLI_path_abs(filename, G.sce);
+ BLI_path_abs(filename, G.main->name);
if(image->packedfile) {
if (writePackedFile(reports, image->name, image->packedfile, 0) != RET_OK) {
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c
index 176a52251e7..fb3eb74a919 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c
@@ -43,10 +43,11 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BKE_main.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_mesh.h"
#include "BKE_utildefines.h"
-#include "BKE_global.h" /* G.sce only */
+#include "BKE_global.h" /* G.main->name only */
#include "MOD_modifiertypes.h"
@@ -482,7 +483,7 @@ DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData *fluid
strcat(targetDir,"fluidsurface_final_####");
}
- BLI_path_abs(targetDir, G.sce);
+ BLI_path_abs(targetDir, G.main->name);
BLI_path_frame(targetDir, curFrame, 0); // fixed #frame-no
strcpy(targetFile,targetDir);
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 568cef0f676..6d42c794583 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -33,7 +33,7 @@
#include "BKE_utildefines.h" /* UNUSED */
#include "BKE_text.h" /* txt_to_buf */
#include "BKE_main.h"
-#include "BKE_global.h" /* grr, only for G.sce */
+#include "BKE_global.h" /* grr, only for G.main->name */
#include "BLI_listbase.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
@@ -62,7 +62,7 @@ void bpy_import_main_set(struct Main *maggie)
/* returns a dummy filename for a textblock so we can tell what file a text block comes from */
void bpy_text_filename_get(char *fn, Text *text)
{
- sprintf(fn, "%s/%s", text->id.lib ? text->id.lib->filepath : G.sce, text->id.name+2);
+ sprintf(fn, "%s/%s", text->id.lib ? text->id.lib->filepath : G.main->name, text->id.name+2);
/* XXX, this is a bug in python's Py_CompileString()!
the string encoding should not be required to be utf-8
diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c
index 9664a5b16f8..de16fba9a30 100644
--- a/source/blender/quicktime/apple/quicktime_export.c
+++ b/source/blender/quicktime/apple/quicktime_export.c
@@ -494,7 +494,7 @@ void filepath_qt(char *string, RenderData *rd) {
if (string==0) return;
strcpy(string, rd->pic);
- BLI_path_abs(string, G.sce);
+ BLI_path_abs(string, G.main->name);
BLI_make_existing_file(string);
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index a2f08d96251..7230e0b3909 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -452,7 +452,7 @@ static void render_unique_exr_name(Render *re, char *str, int sample)
{
char di[FILE_MAX], name[FILE_MAXFILE+MAX_ID_NAME+100], fi[FILE_MAXFILE];
- BLI_strncpy(di, G.sce, FILE_MAX);
+ BLI_strncpy(di, G.main->name, FILE_MAX);
BLI_splitdirstring(di, fi);
if(sample==0)
@@ -2032,7 +2032,7 @@ static void load_backbuffer(Render *re)
char name[256];
strcpy(name, re->r.backbuf);
- BLI_path_abs(name, G.sce);
+ BLI_path_abs(name, G.main->name);
BLI_path_frame(name, re->r.cfra, 0);
if(re->backbuf) {
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 66d2a1efdea..00a686c0d74 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -335,13 +335,10 @@ void WM_read_file(bContext *C, char *name, ReportList *reports)
/* called on startup, (context entirely filled with NULLs) */
/* or called for 'New File' */
/* op can be NULL */
-/* note: G.sce is used to store the last saved path so backup and restore after loading
- * G.main->name is similar to G.sce but when loading from memory set the name to startup.blend
- * ...this could be changed but seems better then setting to "" */
int WM_read_homefile(bContext *C, wmOperator *op)
{
ListBase wmbase;
- char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR];
+ char tstr[FILE_MAXDIR+FILE_MAXFILE];
int from_memory= op && strcmp(op->type->idname, "WM_OT_read_factory_settings")==0;
int success;
@@ -351,7 +348,7 @@ int WM_read_homefile(bContext *C, wmOperator *op)
if (!from_memory) {
char *cfgdir = BLI_get_folder(BLENDER_USER_CONFIG, NULL);
if (cfgdir) {
- BLI_make_file_string(G.sce, tstr, cfgdir, BLENDER_STARTUP_FILE);
+ BLI_make_file_string(G.main->name, tstr, cfgdir, BLENDER_STARTUP_FILE);
} else {
tstr[0] = '\0';
from_memory = 1;
@@ -360,7 +357,6 @@ int WM_read_homefile(bContext *C, wmOperator *op)
}
}
}
- strcpy(scestr, G.sce); /* temporary store */
/* prevent loading no UI */
G.fileflags &= ~G_FILE_NO_UI;
@@ -383,7 +379,6 @@ int WM_read_homefile(bContext *C, wmOperator *op)
wm_window_match_do(C, &wmbase);
WM_check(C); /* opens window(s), checks keymaps */
- strcpy(G.sce, scestr); /* restore */
G.main->name[0]= '\0';
wm_init_userdef(C);
@@ -440,9 +435,6 @@ void read_history(void)
for (l= lines, num= 0; l && (num<U.recent_files); l= l->next) {
line = l->link;
if (line[0] && BLI_exists(line)) {
- if (num==0)
- strcpy(G.sce, line); /* note: this seems highly dodgy since the file isnt actually read. please explain. - campbell */
-
recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile");
BLI_addtail(&(G.recent_files), recent);
recent->filepath = (char*)MEM_mallocN(sizeof(char)*(strlen(line)+1), "name of file");
@@ -468,14 +460,14 @@ static void write_history(void)
recent = G.recent_files.first;
/* refresh recent-files.txt of recent opened files, when current file was changed */
- if(!(recent) || (strcmp(recent->filepath, G.sce)!=0)) {
+ if(!(recent) || (strcmp(recent->filepath, G.main->name)!=0)) {
fp= fopen(name, "w");
if (fp) {
/* add current file to the beginning of list */
recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile");
- recent->filepath = (char*)MEM_mallocN(sizeof(char)*(strlen(G.sce)+1), "name of file");
+ recent->filepath = (char*)MEM_mallocN(sizeof(char)*(strlen(G.main->name)+1), "name of file");
recent->filepath[0] = '\0';
- strcpy(recent->filepath, G.sce);
+ strcpy(recent->filepath, G.main->name);
BLI_addhead(&(G.recent_files), recent);
/* write current file to recent-files.txt */
fprintf(fp, "%s\n", recent->filepath);
@@ -484,7 +476,7 @@ static void write_history(void)
/* write rest of recent opened files to recent-files.txt */
while((i<U.recent_files) && (recent)){
/* this prevents to have duplicities in list */
- if (strcmp(recent->filepath, G.sce)!=0) {
+ if (strcmp(recent->filepath, G.main->name)!=0) {
fprintf(fp, "%s\n", recent->filepath);
recent = recent->next;
}
@@ -572,7 +564,7 @@ static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt)
int write_crash_blend(void)
{
char path[FILE_MAX];
- BLI_strncpy(path, G.sce, sizeof(path));
+ BLI_strncpy(path, G.main->name, sizeof(path));
BLI_replace_extension(path, sizeof(path), "_crash.blend");
if(BLO_write_file(G.main, path, G.fileflags, NULL, NULL)) {
printf("written: %s\n", path);
@@ -634,7 +626,6 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
if (BLO_write_file(CTX_data_main(C), di, fileflags, reports, thumb)) {
if(!copy) {
- strcpy(G.sce, di);
G.relbase_valid = 1;
strcpy(G.main->name, di); /* is guaranteed current file */
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 983361f01ff..b319058ce5c 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -167,10 +167,10 @@ void WM_init(bContext *C, int argc, char **argv)
read_history();
- if(G.sce[0] == 0)
- BLI_make_file_string("/", G.sce, BLI_getDefaultDocumentFolder(), "untitled.blend");
+ if(G.main->name[0] == 0)
+ BLI_make_file_string("/", G.main->name, BLI_getDefaultDocumentFolder(), "untitled.blend");
- BLI_strncpy(G.lib, G.sce, FILE_MAX);
+ BLI_strncpy(G.lib, G.main->name, FILE_MAX);
}
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index ef3c8fb789e..de08c209d06 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1440,7 +1440,7 @@ static void open_set_use_scripts(wmOperator *op)
static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- RNA_string_set(op->ptr, "filepath", G.sce);
+ RNA_string_set(op->ptr, "filepath", G.main->name);
open_set_load_ui(op);
open_set_use_scripts(op);
@@ -1773,7 +1773,7 @@ static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
save_set_compress(op);
- BLI_strncpy(name, G.sce, FILE_MAX);
+ BLI_strncpy(name, G.main->name, FILE_MAX);
untitled(name);
RNA_string_set(op->ptr, "filepath", name);
@@ -1794,7 +1794,7 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
if(RNA_property_is_set(op->ptr, "filepath"))
RNA_string_get(op->ptr, "filepath", path);
else {
- BLI_strncpy(path, G.sce, FILE_MAX);
+ BLI_strncpy(path, G.main->name, FILE_MAX);
untitled(path);
}
@@ -1859,7 +1859,7 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(
save_set_compress(op);
- BLI_strncpy(name, G.sce, FILE_MAX);
+ BLI_strncpy(name, G.main->name, FILE_MAX);
untitled(name);
RNA_string_set(op->ptr, "filepath", name);
@@ -1905,7 +1905,7 @@ static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
if(!RNA_property_is_set(op->ptr, "filepath")) {
char filepath[FILE_MAX];
- BLI_strncpy(filepath, G.sce, sizeof(filepath));
+ BLI_strncpy(filepath, G.main->name, sizeof(filepath));
BLI_replace_extension(filepath, sizeof(filepath), ".dae");
RNA_string_set(op->ptr, "filepath", filepath);
}
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index fbc77d0d06d..69a29092058 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -45,6 +45,7 @@
#include "BKE_blender.h"
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BKE_utildefines.h"
#include "BIF_gl.h"
@@ -260,17 +261,15 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win)
else {
/* this is set to 1 if you don't have startup.blend open */
- if(G.save_over) {
- char *str= MEM_mallocN(strlen(G.sce) + 16, "title");
+ if(G.save_over && G.main->name[0]) {
+ char str[sizeof(G.main->name) + 12];
if(wm->file_saved)
- sprintf(str, "Blender [%s]", G.sce);
+ sprintf(str, "Blender [%s]", G.main->name);
else
- sprintf(str, "Blender* [%s]", G.sce);
+ sprintf(str, "Blender* [%s]", G.main->name);
GHOST_SetTitle(win->ghostwin, str);
-
- MEM_freeN(str);
}
else
GHOST_SetTitle(win->ghostwin, "Blender");
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index d65993581b5..858a5964a52 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -141,10 +141,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
BlendFileData *bfd= NULL;
BLI_strncpy(pathname, blenderdata->name, sizeof(pathname));
- BLI_strncpy(oldsce, G.sce, sizeof(oldsce));
+ BLI_strncpy(oldsce, G.main->name, sizeof(oldsce));
#ifndef DISABLE_PYTHON
resetGamePythonPath(); // need this so running a second time wont use an old blendfiles path
- setGamePythonPath(G.sce);
+ setGamePythonPath(G.main->name);
// Acquire Python's GIL (global interpreter lock)
// so we can safely run Python code and API calls
@@ -309,10 +309,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
startscenename = bfd->curscene->id.name + 2;
if(blenderdata) {
- BLI_strncpy(G.sce, blenderdata->name, sizeof(G.sce));
+ BLI_strncpy(G.main->name, blenderdata->name, sizeof(G.main->name));
BLI_strncpy(pathname, blenderdata->name, sizeof(pathname));
#ifndef DISABLE_PYTHON
- setGamePythonPath(G.sce);
+ setGamePythonPath(G.main->name);
#endif
}
}
@@ -573,7 +573,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
if (bfd) BLO_blendfiledata_free(bfd);
- BLI_strncpy(G.sce, oldsce, sizeof(G.sce));
+ BLI_strncpy(G.main->name, oldsce, sizeof(G.main->name));
#ifndef DISABLE_PYTHON
Py_DECREF(pyGlobalDict);
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
index e1cd1c6d488..5e1e213c570 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
@@ -67,6 +67,7 @@ extern "C" {
#include "DNA_windowmanager_types.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BKE_bmfont.h"
#include "BKE_image.h"
@@ -247,7 +248,7 @@ void BL_MakeScreenShot(ScrArea *curarea, const char* filename)
dumprect= screenshot(curarea, &dumpsx, &dumpsy);
if(dumprect) {
ImBuf *ibuf;
- BLI_path_abs(path, G.sce);
+ BLI_path_abs(path, G.main->name);
/* BKE_add_image_extension() checks for if extension was already set */
BKE_add_image_extension(path, R_PNG); /* scene->r.imtype */
ibuf= IMB_allocImBuf(dumpsx, dumpsy, 24, 0);
diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
index 9c0b5a24aeb..e9dfd2a6e26 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
@@ -821,8 +821,8 @@ int main(int argc, char** argv)
app.SetGameEngineData(maggie, scene, argc, argv); /* this argc cant be argc_py_clamped, since python uses it */
BLI_strncpy(pathname, maggie->name, sizeof(pathname));
- BLI_strncpy(G.sce, maggie->name, sizeof(G.sce));
- setGamePythonPath(G.sce);
+ BLI_strncpy(G.main->name, maggie->name, sizeof(G.main->name));
+ setGamePythonPath(G.main->name);
if (firstTimeRunning)
{