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-12-06 03:52:30 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-12-06 03:52:30 +0300
commit60063d538389d4ad2e4a268da2ba058baf768807 (patch)
tree78c1ec1098f701a8e61cf55bc4f145a680b72a3a /source/blender/blenkernel/intern/blender.c
parent2f366d1544ecc5618d7190b779ccc75f2f144d0a (diff)
- converted path cleaning on file load to use bPath Iterator functions - image & font and sequence paths were being cleaned but not multires, voxel & sound paths.
- skip fixing file paths on undo. - simplify bpath alloc and free functions, also pass Main structure so as not to rely on G.main, (needed for file load).
Diffstat (limited to 'source/blender/blenkernel/intern/blender.c')
-rw-r--r--source/blender/blenkernel/intern/blender.c61
1 files changed, 24 insertions, 37 deletions
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 6911e7fd581..6ceb75f2f83 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -55,6 +55,7 @@
#include "DNA_sound_types.h"
#include "BLI_blenlib.h"
+#include "BLI_bpath.h"
#include "BLI_dynstr.h"
#include "BLI_path_util.h"
@@ -154,49 +155,32 @@ static void clear_global(void)
/* make sure path names are correct for OS */
static void clean_paths(Main *main)
{
- Image *image= main->image.first;
- bSound *sound= main->sound.first;
- Scene *scene= main->scene.first;
- Editing *ed;
- Sequence *seq;
- Strip *strip;
-
- while(image) {
- BLI_clean(image->name);
- image= image->id.next;
- }
-
- while(sound) {
- BLI_clean(sound->name);
- sound= sound->id.next;
+ struct BPathIterator *bpi;
+ char filepath_expanded[1024];
+ Scene *scene;
+
+ for(BLI_bpathIterator_init(&bpi, main, main->name); !BLI_bpathIterator_isDone(bpi); BLI_bpathIterator_step(bpi)) {
+ BLI_bpathIterator_getPath(bpi, filepath_expanded);
+
+ BLI_clean(filepath_expanded);
+
+ BLI_bpathIterator_setPath(bpi, filepath_expanded);
}
-
- while(scene) {
- ed= seq_give_editing(scene, 0);
- if(ed) {
- seq= ed->seqbasep->first;
- while(seq) {
- if(seq->plugin) {
- BLI_clean(seq->plugin->name);
- }
- strip= seq->strip;
- while(strip) {
- BLI_clean(strip->dir);
- strip= strip->next;
- }
- seq= seq->next;
- }
- }
+
+ BLI_bpathIterator_free(bpi);
+
+ for(scene= main->scene.first; scene; scene= scene->id.next) {
BLI_clean(scene->r.backbuf);
BLI_clean(scene->r.pic);
-
- scene= scene->id.next;
}
}
/* context matching */
/* handle no-ui case */
+/* note, this is called on Undo so any slow conversion functions here
+ * should be avoided or check (mode!='u') */
+
static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filename)
{
bScreen *curscreen= NULL;
@@ -210,9 +194,12 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filename
else mode= 0;
recover= (G.fileflags & G_FILE_RECOVER);
-
- clean_paths(bfd->main);
-
+
+ /* Only make filepaths compatible when loading for real (not undo) */
+ if(mode != 'u') {
+ clean_paths(bfd->main);
+ }
+
/* XXX here the complex windowmanager matching */
/* no load screens? */