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:
authorCampbell Barton <ideasman42@gmail.com>2010-10-18 10:41:16 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-10-18 10:41:16 +0400
commit4d37cf90b9d9d8ed2f0339c8ccd72481e29a4514 (patch)
tree8442faaffb762a79497a45d90f503ccedc4cd0b4 /source/blender/blenkernel
parentb3afc3618db09942f83d4a3ac62834e7b925d5d7 (diff)
remove G.sce, use G.main->name instead.
Both stored the filename of the blend file, but G.sce stored the last opened file. This will make blender act differently in some cases since a relative path to the last opened file will no longer resolve (which is correct IMHO since that file isnt open and the path might not even be valid anymore). Tested linking with durian files and rendering to relative paths when no files is loaded however we may need to have some operators give an error if they are used on the default startup.blend.
Diffstat (limited to 'source/blender/blenkernel')
-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
14 files changed, 38 insertions, 38 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);