2007-12-20 10:27:13 +00:00
|
|
|
/**
|
|
|
|
*
|
2008-01-07 19:13:47 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2007-12-20 10:27:13 +00:00
|
|
|
*
|
|
|
|
* 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
|
2008-01-07 19:13:47 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2007-12-20 10:27:13 +00:00
|
|
|
*
|
|
|
|
* 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,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2007-12-20 10:27:13 +00:00
|
|
|
*
|
|
|
|
* 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): Campbell barton
|
|
|
|
*
|
2008-01-07 19:13:47 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2007-12-20 10:27:13 +00:00
|
|
|
*/
|
|
|
|
|
2009-09-06 13:20:05 +00:00
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
/* path/file handeling stuff */
|
|
|
|
#ifndef WIN32
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#else
|
|
|
|
#include <io.h>
|
|
|
|
#include "BLI_winstuff.h"
|
|
|
|
#endif
|
|
|
|
|
2008-12-15 05:21:44 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
2010-01-28 18:20:28 +00:00
|
|
|
#include "DNA_mesh_types.h"
|
2007-12-20 10:27:13 +00:00
|
|
|
#include "DNA_scene_types.h" /* to get the current frame */
|
2010-08-04 04:01:27 +00:00
|
|
|
#include "DNA_image_types.h"
|
|
|
|
#include "DNA_sound_types.h"
|
2008-04-25 16:09:16 +00:00
|
|
|
#include "DNA_sequence_types.h"
|
2010-01-28 18:20:28 +00:00
|
|
|
#include "DNA_vfont_types.h"
|
2010-01-08 17:50:55 +00:00
|
|
|
#include "DNA_windowmanager_types.h"
|
2007-12-20 10:27:13 +00:00
|
|
|
|
2008-12-15 05:21:44 +00:00
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
#include "BLI_bpath.h"
|
2007-12-20 10:27:13 +00:00
|
|
|
|
2008-12-15 05:21:44 +00:00
|
|
|
#include "BKE_global.h"
|
|
|
|
#include "BKE_image.h" /* so we can check the image's type */
|
|
|
|
#include "BKE_main.h" /* so we can access G.main->*.first */
|
2009-12-13 14:56:45 +00:00
|
|
|
#include "BKE_sequencer.h"
|
2007-12-20 10:27:13 +00:00
|
|
|
#include "BKE_utildefines.h"
|
2010-01-11 10:48:41 +00:00
|
|
|
#include "BKE_report.h"
|
2008-04-25 16:09:16 +00:00
|
|
|
|
2008-12-15 05:21:44 +00:00
|
|
|
//XXX #include "BIF_screen.h" /* only for wait cursor */
|
|
|
|
//
|
2008-04-25 16:09:16 +00:00
|
|
|
/* for sequence */
|
Merge of trunk into blender 2.5:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r12987:17416
Issues:
* GHOST/X11 had conflicting changes. Some code was added in 2.5, which was
later added in trunk also, but reverted partially, specifically revision
16683. I have left out this reversion in the 2.5 branch since I think it is
needed there.
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16683
* Scons had various conflicting changes, I decided to go with trunk version
for everything except priorities and some library renaming.
* In creator.c, there were various fixes and fixes for fixes related to the -w
-W and -p options. In 2.5 -w and -W is not coded yet, and -p is done
differently. Since this is changed so much, and I don't think those fixes
would be needed in 2.5, I've left them out.
* Also in creator.c: there was code for a python bugfix where the screen was not
initialized when running with -P. The code that initializes the screen there
I had to disable, that can't work in 2.5 anymore but left it commented as a
reminder.
Further I had to disable some new function calls. using src/ and python/, as
was done already in this branch, disabled function calls:
* bpath.c: error reporting
* BME_conversions.c: editmesh conversion functions.
* SHD_dynamic: disabled almost completely, there is no python/.
* KX_PythonInit.cpp and Ketsji/ build files: Mathutils is not there, disabled.
* text.c: clipboard copy call.
* object.c: OB_SUPPORT_MATERIAL.
* DerivedMesh.c and subsurf_ccg, stipple_quarttone.
Still to be done:
* Go over files and functions that were moved to a different location but could
still use changes that were done in trunk.
2008-11-12 21:16:53 +00:00
|
|
|
//XXX #include "BSE_sequence.h"
|
2008-12-04 20:34:37 +00:00
|
|
|
//XXX define below from BSE_sequence.h - otherwise potentially odd behaviour
|
2007-12-20 10:27:13 +00:00
|
|
|
|
|
|
|
#define FILE_MAX 240
|
|
|
|
|
|
|
|
/* TODO - BPATH_PLUGIN, BPATH_SEQ */
|
|
|
|
enum BPathTypes {
|
|
|
|
BPATH_IMAGE = 0,
|
|
|
|
BPATH_SOUND,
|
|
|
|
BPATH_FONT,
|
|
|
|
BPATH_LIB,
|
2008-04-25 16:09:16 +00:00
|
|
|
BPATH_SEQ,
|
2010-01-28 18:20:28 +00:00
|
|
|
BPATH_CDATA,
|
2007-12-20 10:27:13 +00:00
|
|
|
|
2010-03-22 09:30:00 +00:00
|
|
|
BPATH_DONE
|
2007-12-20 10:27:13 +00:00
|
|
|
};
|
|
|
|
|
2010-11-11 07:51:12 +00:00
|
|
|
void BLI_bpathIterator_init( struct BPathIterator *bpi, const char *base_path ) {
|
2007-12-20 10:27:13 +00:00
|
|
|
bpi->type = BPATH_IMAGE;
|
|
|
|
bpi->data = NULL;
|
2008-04-25 16:09:16 +00:00
|
|
|
|
|
|
|
bpi->getpath_callback = NULL;
|
|
|
|
bpi->setpath_callback = NULL;
|
|
|
|
|
2010-01-08 17:50:55 +00:00
|
|
|
/* Sequencer specific */
|
2008-04-25 16:09:16 +00:00
|
|
|
bpi->seqdata.totseq = 0;
|
|
|
|
bpi->seqdata.seq = 0;
|
|
|
|
bpi->seqdata.seqar = NULL;
|
2008-04-27 20:43:25 +00:00
|
|
|
bpi->seqdata.scene = NULL;
|
2008-04-25 16:09:16 +00:00
|
|
|
|
2010-10-18 06:41:16 +00:00
|
|
|
bpi->base_path= base_path ? base_path : G.main->name;
|
2010-01-08 17:50:55 +00:00
|
|
|
|
2007-12-20 10:27:13 +00:00
|
|
|
BLI_bpathIterator_step(bpi);
|
|
|
|
}
|
|
|
|
|
2008-04-25 16:09:16 +00:00
|
|
|
void BLI_bpathIterator_free( struct BPathIterator *bpi ) {
|
|
|
|
if (bpi->seqdata.seqar)
|
|
|
|
MEM_freeN((void *)bpi->seqdata.seqar);
|
|
|
|
bpi->seqdata.seqar = NULL;
|
2008-04-27 20:43:25 +00:00
|
|
|
bpi->seqdata.scene = NULL;
|
2007-12-20 10:27:13 +00:00
|
|
|
}
|
2008-04-25 16:09:16 +00:00
|
|
|
|
|
|
|
void BLI_bpathIterator_getPath( struct BPathIterator *bpi, char *path) {
|
|
|
|
if (bpi->getpath_callback) {
|
|
|
|
bpi->getpath_callback( bpi, path );
|
|
|
|
} else {
|
|
|
|
strcpy(path, bpi->path); /* warning, we assume 'path' are long enough */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-11 07:51:12 +00:00
|
|
|
void BLI_bpathIterator_setPath( struct BPathIterator *bpi, const char *path) {
|
2008-04-25 16:09:16 +00:00
|
|
|
if (bpi->setpath_callback) {
|
|
|
|
bpi->setpath_callback( bpi, path );
|
|
|
|
} else {
|
|
|
|
strcpy(bpi->path, path); /* warning, we assume 'path' are long enough */
|
|
|
|
}
|
2007-12-20 10:27:13 +00:00
|
|
|
}
|
2008-04-25 16:09:16 +00:00
|
|
|
|
|
|
|
void BLI_bpathIterator_getPathExpanded( struct BPathIterator *bpi, char *path_expanded) {
|
2010-11-11 07:51:12 +00:00
|
|
|
const char *libpath;
|
2007-12-20 10:27:13 +00:00
|
|
|
|
2008-04-25 16:09:16 +00:00
|
|
|
BLI_bpathIterator_getPath(bpi, path_expanded);
|
2007-12-20 10:27:13 +00:00
|
|
|
libpath = BLI_bpathIterator_getLib(bpi);
|
|
|
|
|
|
|
|
if (libpath) { /* check the files location relative to its library path */
|
2010-03-09 17:36:23 +00:00
|
|
|
BLI_path_abs(path_expanded, libpath);
|
2007-12-20 10:27:13 +00:00
|
|
|
} else { /* local data, use the blend files path */
|
2010-03-09 17:36:23 +00:00
|
|
|
BLI_path_abs(path_expanded, bpi->base_path);
|
2007-12-20 10:27:13 +00:00
|
|
|
}
|
2010-05-10 12:58:21 +00:00
|
|
|
BLI_cleanup_file(NULL, path_expanded);
|
2007-12-20 10:27:13 +00:00
|
|
|
}
|
2010-11-11 07:51:12 +00:00
|
|
|
const char* BLI_bpathIterator_getLib( struct BPathIterator *bpi) {
|
2007-12-20 10:27:13 +00:00
|
|
|
return bpi->lib;
|
|
|
|
}
|
2010-11-11 07:51:12 +00:00
|
|
|
const char* BLI_bpathIterator_getName( struct BPathIterator *bpi) {
|
2007-12-20 10:27:13 +00:00
|
|
|
return bpi->name;
|
|
|
|
}
|
|
|
|
int BLI_bpathIterator_getType( struct BPathIterator *bpi) {
|
|
|
|
return bpi->type;
|
|
|
|
}
|
|
|
|
int BLI_bpathIterator_getPathMaxLen( struct BPathIterator *bpi) {
|
|
|
|
return bpi->len;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* gets the first or the next image that has a path - not a viewer node or generated image */
|
2008-04-25 16:09:16 +00:00
|
|
|
static struct Image *ima_stepdata__internal(struct Image *ima, int step_next) {
|
2007-12-20 10:27:13 +00:00
|
|
|
if (ima==NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (step_next)
|
|
|
|
ima = ima->id.next;
|
|
|
|
|
|
|
|
while (ima) {
|
|
|
|
if (ima->packedfile==NULL && ELEM3(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE))
|
|
|
|
break;
|
|
|
|
/* image is not a image with a path, skip it */
|
|
|
|
ima = ima->id.next;
|
|
|
|
}
|
|
|
|
return ima;
|
|
|
|
}
|
|
|
|
|
2008-04-25 16:09:16 +00:00
|
|
|
static struct VFont *vf_stepdata__internal(struct VFont *vf, int step_next) {
|
2007-12-20 10:27:13 +00:00
|
|
|
if (vf==NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (step_next)
|
|
|
|
vf = vf->id.next;
|
|
|
|
|
|
|
|
while (vf) {
|
2010-10-24 07:02:19 +00:00
|
|
|
if (vf->packedfile==NULL && strcmp(vf->name, FO_BUILTIN_NAME)!=0) {
|
2007-12-20 10:27:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* font with no path, skip it */
|
|
|
|
vf = vf->id.next;
|
|
|
|
}
|
|
|
|
return vf;
|
|
|
|
}
|
|
|
|
|
2008-04-25 16:09:16 +00:00
|
|
|
static struct bSound *snd_stepdata__internal(struct bSound *snd, int step_next) {
|
2007-12-20 10:27:13 +00:00
|
|
|
if (snd==NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (step_next)
|
|
|
|
snd = snd->id.next;
|
|
|
|
|
|
|
|
while (snd) {
|
|
|
|
if (snd->packedfile==NULL) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* font with no path, skip it */
|
|
|
|
snd = snd->id.next;
|
|
|
|
}
|
|
|
|
return snd;
|
|
|
|
}
|
|
|
|
|
2009-01-28 22:36:34 +00:00
|
|
|
static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int step_next)
|
|
|
|
{
|
|
|
|
Editing *ed;
|
2008-04-25 16:09:16 +00:00
|
|
|
Sequence *seq;
|
|
|
|
|
2008-04-27 20:43:25 +00:00
|
|
|
/* Initializing */
|
|
|
|
if (bpi->seqdata.scene==NULL) {
|
|
|
|
bpi->seqdata.scene= G.main->scene.first;
|
2008-04-25 16:09:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (step_next) {
|
|
|
|
bpi->seqdata.seq++;
|
|
|
|
}
|
|
|
|
|
2008-04-27 20:43:25 +00:00
|
|
|
while (bpi->seqdata.scene) {
|
2009-01-28 22:36:34 +00:00
|
|
|
ed= seq_give_editing(bpi->seqdata.scene, 0);
|
|
|
|
if (ed) {
|
2008-04-27 20:43:25 +00:00
|
|
|
if (bpi->seqdata.seqar == NULL) {
|
|
|
|
/* allocate the sequencer array */
|
2009-01-28 22:36:34 +00:00
|
|
|
seq_array(ed, &bpi->seqdata.seqar, &bpi->seqdata.totseq, 0);
|
2008-04-27 20:43:25 +00:00
|
|
|
bpi->seqdata.seq = 0;
|
|
|
|
}
|
|
|
|
|
2008-04-25 16:09:16 +00:00
|
|
|
if (bpi->seqdata.seq >= bpi->seqdata.totseq) {
|
|
|
|
seq = NULL;
|
2008-04-27 20:43:25 +00:00
|
|
|
} else {
|
|
|
|
seq = bpi->seqdata.seqar[bpi->seqdata.seq];
|
|
|
|
while (!SEQ_HAS_PATH(seq)) {
|
|
|
|
bpi->seqdata.seq++;
|
|
|
|
if (bpi->seqdata.seq >= bpi->seqdata.totseq) {
|
|
|
|
seq = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
seq = bpi->seqdata.seqar[bpi->seqdata.seq];
|
|
|
|
}
|
2008-04-25 16:09:16 +00:00
|
|
|
}
|
2008-04-27 20:43:25 +00:00
|
|
|
if (seq) {
|
|
|
|
return seq;
|
|
|
|
} else {
|
|
|
|
/* keep looking through the next scene, reallocate seq array */
|
2008-04-28 16:09:17 +00:00
|
|
|
if (bpi->seqdata.seqar) {
|
|
|
|
MEM_freeN((void *)bpi->seqdata.seqar);
|
|
|
|
bpi->seqdata.seqar = NULL;
|
|
|
|
}
|
2008-04-27 20:43:25 +00:00
|
|
|
bpi->seqdata.scene = bpi->seqdata.scene->id.next;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* no seq data in this scene, next */
|
|
|
|
bpi->seqdata.scene = bpi->seqdata.scene->id.next;
|
2008-04-25 16:09:16 +00:00
|
|
|
}
|
|
|
|
}
|
2008-04-27 20:43:25 +00:00
|
|
|
|
|
|
|
return NULL;
|
2008-04-25 16:09:16 +00:00
|
|
|
}
|
|
|
|
|
2008-09-29 17:08:11 +00:00
|
|
|
static void seq_getpath(struct BPathIterator *bpi, char *path) {
|
2008-04-25 16:09:16 +00:00
|
|
|
Sequence *seq = (Sequence *)bpi->data;
|
|
|
|
|
|
|
|
|
|
|
|
path[0] = '\0'; /* incase we cant get the path */
|
|
|
|
if (seq==NULL) return;
|
|
|
|
if (SEQ_HAS_PATH(seq)) {
|
2010-05-24 14:41:35 +00:00
|
|
|
if (ELEM3(seq->type, SEQ_IMAGE, SEQ_MOVIE, SEQ_SOUND)) {
|
2008-04-25 16:09:16 +00:00
|
|
|
BLI_strncpy(path, seq->strip->dir, FILE_MAX);
|
|
|
|
BLI_add_slash(path); /* incase its missing */
|
|
|
|
if (seq->strip->stripdata) { /* should always be true! */
|
|
|
|
/* Using the first image is weak for image sequences */
|
|
|
|
strcat(path, seq->strip->stripdata->name);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* simple case */
|
|
|
|
BLI_strncpy(seq->strip->dir, path, sizeof(seq->strip->dir));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-11 07:51:12 +00:00
|
|
|
static void seq_setpath(struct BPathIterator *bpi, const char *path) {
|
2008-04-25 16:09:16 +00:00
|
|
|
Sequence *seq = (Sequence *)bpi->data;
|
|
|
|
if (seq==NULL) return;
|
|
|
|
|
|
|
|
if (SEQ_HAS_PATH(seq)) {
|
2010-05-24 14:41:35 +00:00
|
|
|
if (ELEM3(seq->type, SEQ_IMAGE, SEQ_MOVIE, SEQ_SOUND)) {
|
2010-03-08 20:08:04 +00:00
|
|
|
BLI_split_dirfile(path, seq->strip->dir, seq->strip->stripdata->name);
|
2008-04-25 16:09:16 +00:00
|
|
|
} else {
|
|
|
|
/* simple case */
|
|
|
|
BLI_strncpy(seq->strip->dir, path, sizeof(seq->strip->dir));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-28 18:20:28 +00:00
|
|
|
static struct Mesh *cdata_stepdata__internal(struct Mesh *me, int step_next) {
|
|
|
|
if (me==NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (step_next)
|
|
|
|
me = me->id.next;
|
|
|
|
|
|
|
|
while (me) {
|
|
|
|
if (me->fdata.external) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
me = me->id.next;
|
|
|
|
}
|
|
|
|
return me;
|
|
|
|
}
|
|
|
|
|
2008-04-25 16:09:16 +00:00
|
|
|
static void bpi_type_step__internal( struct BPathIterator *bpi) {
|
|
|
|
bpi->type++; /* advance to the next type */
|
|
|
|
bpi->data = NULL;
|
|
|
|
|
|
|
|
switch (bpi->type) {
|
|
|
|
case BPATH_SEQ:
|
|
|
|
bpi->getpath_callback = seq_getpath;
|
|
|
|
bpi->setpath_callback = seq_setpath;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
bpi->getpath_callback = NULL;
|
|
|
|
bpi->setpath_callback = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-20 10:27:13 +00:00
|
|
|
void BLI_bpathIterator_step( struct BPathIterator *bpi) {
|
|
|
|
while (bpi->type != BPATH_DONE) {
|
|
|
|
|
|
|
|
if ((bpi->type) == BPATH_IMAGE) {
|
|
|
|
/*if (bpi->data) bpi->data = ((ID *)bpi->data)->next;*/
|
2008-04-25 16:09:16 +00:00
|
|
|
if (bpi->data) bpi->data = ima_stepdata__internal( (Image *)bpi->data, 1 ); /* must skip images that have no path */
|
|
|
|
else bpi->data = ima_stepdata__internal(G.main->image.first, 0);
|
2007-12-20 10:27:13 +00:00
|
|
|
|
|
|
|
if (bpi->data) {
|
|
|
|
/* get the path info from this datatype */
|
|
|
|
Image *ima = (Image *)bpi->data;
|
|
|
|
|
2010-06-02 17:58:28 +00:00
|
|
|
bpi->lib = ima->id.lib ? ima->id.lib->filepath : NULL;
|
2007-12-20 10:27:13 +00:00
|
|
|
bpi->path = ima->name;
|
|
|
|
bpi->name = ima->id.name+2;
|
|
|
|
bpi->len = sizeof(ima->name);
|
|
|
|
|
|
|
|
/* we are done, advancing to the next item, this type worked fine */
|
|
|
|
break;
|
|
|
|
|
|
|
|
} else {
|
2008-04-25 16:09:16 +00:00
|
|
|
bpi_type_step__internal(bpi);
|
2007-12-20 10:27:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else if ((bpi->type) == BPATH_SOUND) {
|
2008-04-25 16:09:16 +00:00
|
|
|
if (bpi->data) bpi->data = snd_stepdata__internal( (bSound *)bpi->data, 1 ); /* must skip images that have no path */
|
|
|
|
else bpi->data = snd_stepdata__internal(G.main->sound.first, 0);
|
2007-12-20 10:27:13 +00:00
|
|
|
|
|
|
|
if (bpi->data) {
|
|
|
|
/* get the path info from this datatype */
|
|
|
|
bSound *snd = (bSound *)bpi->data;
|
|
|
|
|
2010-06-02 17:58:28 +00:00
|
|
|
bpi->lib = snd->id.lib ? snd->id.lib->filepath : NULL;
|
2009-02-21 03:02:39 +00:00
|
|
|
bpi->path = snd->name;
|
2007-12-20 10:27:13 +00:00
|
|
|
bpi->name = snd->id.name+2;
|
2009-02-21 03:02:39 +00:00
|
|
|
bpi->len = sizeof(snd->name);
|
2007-12-20 10:27:13 +00:00
|
|
|
|
|
|
|
/* we are done, advancing to the next item, this type worked fine */
|
|
|
|
break;
|
|
|
|
} else {
|
2008-04-25 16:09:16 +00:00
|
|
|
bpi_type_step__internal(bpi);
|
2007-12-20 10:27:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else if ((bpi->type) == BPATH_FONT) {
|
|
|
|
|
2008-04-25 16:09:16 +00:00
|
|
|
if (bpi->data) bpi->data = vf_stepdata__internal( (VFont *)bpi->data, 1 );
|
|
|
|
else bpi->data = vf_stepdata__internal( G.main->vfont.first, 0 );
|
2007-12-20 10:27:13 +00:00
|
|
|
|
|
|
|
if (bpi->data) {
|
|
|
|
/* get the path info from this datatype */
|
|
|
|
VFont *vf = (VFont *)bpi->data;
|
|
|
|
|
2010-06-02 17:58:28 +00:00
|
|
|
bpi->lib = vf->id.lib ? vf->id.lib->filepath : NULL;
|
2007-12-20 10:27:13 +00:00
|
|
|
bpi->path = vf->name;
|
|
|
|
bpi->name = vf->id.name+2;
|
|
|
|
bpi->len = sizeof(vf->name);
|
|
|
|
|
|
|
|
/* we are done, advancing to the next item, this type worked fine */
|
|
|
|
break;
|
|
|
|
} else {
|
2008-04-25 16:09:16 +00:00
|
|
|
bpi_type_step__internal(bpi);
|
2007-12-20 10:27:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} else if ((bpi->type) == BPATH_LIB) {
|
|
|
|
if (bpi->data) bpi->data = ((ID *)bpi->data)->next;
|
|
|
|
else bpi->data = G.main->library.first;
|
|
|
|
|
|
|
|
if (bpi->data) {
|
|
|
|
/* get the path info from this datatype */
|
|
|
|
Library *lib = (Library *)bpi->data;
|
|
|
|
|
|
|
|
bpi->lib = NULL;
|
|
|
|
bpi->path = lib->name;
|
|
|
|
bpi->name = NULL;
|
|
|
|
bpi->len = sizeof(lib->name);
|
|
|
|
|
|
|
|
/* we are done, advancing to the next item, this type worked fine */
|
|
|
|
break;
|
|
|
|
} else {
|
2008-04-25 16:09:16 +00:00
|
|
|
bpi_type_step__internal(bpi);
|
|
|
|
}
|
|
|
|
} else if ((bpi->type) == BPATH_SEQ) {
|
|
|
|
if (bpi->data) bpi->data = seq_stepdata__internal( bpi, 1 );
|
|
|
|
else bpi->data = seq_stepdata__internal( bpi, 0 );
|
|
|
|
if (bpi->data) {
|
|
|
|
Sequence *seq = (Sequence *)bpi->data;
|
|
|
|
bpi->lib = NULL;
|
|
|
|
bpi->name = seq->name+2;
|
|
|
|
bpi->len = sizeof(seq->strip->stripdata->name);
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
bpi_type_step__internal(bpi);
|
2007-12-20 10:27:13 +00:00
|
|
|
}
|
2010-01-28 18:20:28 +00:00
|
|
|
} else if ((bpi->type) == BPATH_CDATA) {
|
|
|
|
if (bpi->data) bpi->data = cdata_stepdata__internal( bpi->data, 1 );
|
|
|
|
else bpi->data = cdata_stepdata__internal( G.main->mesh.first, 0 );
|
|
|
|
|
|
|
|
if (bpi->data) {
|
|
|
|
Mesh *me = (Mesh *)bpi->data;
|
2010-06-02 17:58:28 +00:00
|
|
|
bpi->lib = me->id.lib ? me->id.lib->filepath : NULL;
|
2010-01-28 18:20:28 +00:00
|
|
|
bpi->path = me->fdata.external->filename;
|
|
|
|
bpi->name = me->id.name+2;
|
|
|
|
bpi->len = sizeof(me->fdata.external->filename);
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
bpi_type_step__internal(bpi);
|
|
|
|
}
|
2007-12-20 10:27:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int BLI_bpathIterator_isDone( struct BPathIterator *bpi) {
|
|
|
|
return bpi->type==BPATH_DONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* include the path argument */
|
2010-01-08 17:50:55 +00:00
|
|
|
static void bpath_as_report(struct BPathIterator *bpi, const char *message, ReportList *reports)
|
2007-12-20 10:27:13 +00:00
|
|
|
{
|
2010-12-03 17:05:21 +00:00
|
|
|
const char *prefix;
|
2010-11-11 07:51:12 +00:00
|
|
|
const char *name;
|
2007-12-20 10:27:13 +00:00
|
|
|
char path_expanded[FILE_MAXDIR*2];
|
|
|
|
|
2010-01-08 17:50:55 +00:00
|
|
|
if(reports==NULL)
|
|
|
|
return;
|
|
|
|
|
2007-12-20 10:27:13 +00:00
|
|
|
switch(BLI_bpathIterator_getType(bpi)) {
|
|
|
|
case BPATH_IMAGE:
|
2010-01-08 17:50:55 +00:00
|
|
|
prefix= "Image";
|
2007-12-20 10:27:13 +00:00
|
|
|
break;
|
|
|
|
case BPATH_SOUND:
|
2010-01-08 17:50:55 +00:00
|
|
|
prefix= "Sound";
|
2007-12-20 10:27:13 +00:00
|
|
|
break;
|
|
|
|
case BPATH_FONT:
|
2010-01-08 17:50:55 +00:00
|
|
|
prefix= "Font";
|
2007-12-20 10:27:13 +00:00
|
|
|
break;
|
|
|
|
case BPATH_LIB:
|
2010-01-08 17:50:55 +00:00
|
|
|
prefix= "Library";
|
2007-12-20 10:27:13 +00:00
|
|
|
break;
|
2008-04-25 16:09:16 +00:00
|
|
|
case BPATH_SEQ:
|
2010-01-08 17:50:55 +00:00
|
|
|
prefix= "Sequence";
|
2008-04-25 16:09:16 +00:00
|
|
|
break;
|
2010-01-28 18:20:28 +00:00
|
|
|
case BPATH_CDATA:
|
|
|
|
prefix= "Mesh Data";
|
|
|
|
break;
|
2007-12-20 10:27:13 +00:00
|
|
|
default:
|
2010-01-08 17:50:55 +00:00
|
|
|
prefix= "Unknown";
|
2007-12-20 10:27:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
name = BLI_bpathIterator_getName(bpi);
|
2008-04-25 16:09:16 +00:00
|
|
|
BLI_bpathIterator_getPathExpanded(bpi, path_expanded);
|
2010-01-08 17:50:55 +00:00
|
|
|
|
|
|
|
if(reports) {
|
2010-02-07 18:14:38 +00:00
|
|
|
if (name) BKE_reportf(reports, RPT_WARNING, "%s \"%s\", \"%s\": %s", prefix, name, path_expanded, message);
|
|
|
|
else BKE_reportf(reports, RPT_WARNING, "%s \"%s\": %s", prefix, path_expanded, message);
|
2010-01-08 17:50:55 +00:00
|
|
|
}
|
|
|
|
|
2007-12-20 10:27:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* high level function */
|
2010-11-11 07:51:12 +00:00
|
|
|
void checkMissingFiles(const char *basepath, ReportList *reports) {
|
2007-12-20 10:27:13 +00:00
|
|
|
struct BPathIterator bpi;
|
|
|
|
|
|
|
|
/* be sure there is low chance of the path being too short */
|
|
|
|
char filepath_expanded[FILE_MAXDIR*2];
|
|
|
|
|
2010-01-08 17:50:55 +00:00
|
|
|
BLI_bpathIterator_init(&bpi, basepath);
|
2007-12-20 10:27:13 +00:00
|
|
|
while (!BLI_bpathIterator_isDone(&bpi)) {
|
2008-04-25 16:09:16 +00:00
|
|
|
BLI_bpathIterator_getPathExpanded( &bpi, filepath_expanded );
|
2007-12-20 10:27:13 +00:00
|
|
|
|
2010-01-08 17:50:55 +00:00
|
|
|
if (!BLI_exists(filepath_expanded))
|
|
|
|
bpath_as_report(&bpi, "file not found", reports);
|
|
|
|
|
2007-12-20 10:27:13 +00:00
|
|
|
BLI_bpathIterator_step(&bpi);
|
|
|
|
}
|
2008-04-25 16:09:16 +00:00
|
|
|
BLI_bpathIterator_free(&bpi);
|
2007-12-20 10:27:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* dont log any errors at the moment, should probably do this */
|
2010-11-11 07:51:12 +00:00
|
|
|
void makeFilesRelative(const char *basepath, ReportList *reports) {
|
2010-01-08 17:50:55 +00:00
|
|
|
int tot= 0, changed= 0, failed= 0, linked= 0;
|
2007-12-20 10:27:13 +00:00
|
|
|
struct BPathIterator bpi;
|
2010-11-11 07:51:12 +00:00
|
|
|
char filepath[FILE_MAX];
|
|
|
|
const char *libpath;
|
2007-12-20 10:27:13 +00:00
|
|
|
|
|
|
|
/* be sure there is low chance of the path being too short */
|
|
|
|
char filepath_relative[(FILE_MAXDIR * 2) + FILE_MAXFILE];
|
|
|
|
|
2010-01-08 17:50:55 +00:00
|
|
|
BLI_bpathIterator_init(&bpi, basepath);
|
2007-12-20 10:27:13 +00:00
|
|
|
while (!BLI_bpathIterator_isDone(&bpi)) {
|
2008-04-25 16:09:16 +00:00
|
|
|
BLI_bpathIterator_getPath(&bpi, filepath);
|
2007-12-20 10:27:13 +00:00
|
|
|
libpath = BLI_bpathIterator_getLib(&bpi);
|
|
|
|
|
2007-12-20 10:52:56 +00:00
|
|
|
if(strncmp(filepath, "//", 2)) {
|
2007-12-24 17:07:52 +00:00
|
|
|
if (libpath) { /* cant make relative if we are library - TODO, LOG THIS */
|
2010-01-08 17:50:55 +00:00
|
|
|
linked++;
|
2007-12-20 10:27:13 +00:00
|
|
|
} else { /* local data, use the blend files path */
|
|
|
|
BLI_strncpy(filepath_relative, filepath, sizeof(filepath_relative));
|
2007-12-31 12:03:26 +00:00
|
|
|
/* Important BLI_cleanup_dir runs before the path is made relative
|
|
|
|
* because it wont work for paths that start with "//../" */
|
2010-01-08 17:50:55 +00:00
|
|
|
BLI_cleanup_file(bpi.base_path, filepath_relative); /* fix any /foo/../foo/ */
|
2010-03-09 17:36:23 +00:00
|
|
|
BLI_path_rel(filepath_relative, bpi.base_path);
|
2007-12-24 17:07:52 +00:00
|
|
|
/* be safe and check the length */
|
|
|
|
if (BLI_bpathIterator_getPathMaxLen(&bpi) <= strlen(filepath_relative)) {
|
2010-01-08 17:50:55 +00:00
|
|
|
bpath_as_report(&bpi, "couldn't make path relative (too long)", reports);
|
|
|
|
failed++;
|
2007-12-20 10:27:13 +00:00
|
|
|
} else {
|
|
|
|
if(strncmp(filepath_relative, "//", 2)==0) {
|
2008-04-25 16:09:16 +00:00
|
|
|
BLI_bpathIterator_setPath(&bpi, filepath_relative);
|
2010-01-08 17:50:55 +00:00
|
|
|
changed++;
|
2007-12-20 10:52:56 +00:00
|
|
|
} else {
|
2010-01-08 17:50:55 +00:00
|
|
|
bpath_as_report(&bpi, "couldn't make path relative", reports);
|
|
|
|
failed++;
|
2007-12-20 10:27:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-12-24 17:07:52 +00:00
|
|
|
BLI_bpathIterator_step(&bpi);
|
2010-01-08 17:50:55 +00:00
|
|
|
tot++;
|
2007-12-24 17:07:52 +00:00
|
|
|
}
|
2008-04-25 16:09:16 +00:00
|
|
|
BLI_bpathIterator_free(&bpi);
|
2010-01-08 17:50:55 +00:00
|
|
|
|
|
|
|
if(reports)
|
|
|
|
BKE_reportf(reports, failed ? RPT_ERROR : RPT_INFO, "Total files %i|Changed %i|Failed %i|Linked %i", tot, changed, failed, linked);
|
2007-12-24 17:07:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* dont log any errors at the moment, should probably do this -
|
|
|
|
* Verry similar to makeFilesRelative - keep in sync! */
|
2010-11-11 07:51:12 +00:00
|
|
|
void makeFilesAbsolute(const char *basepath, ReportList *reports)
|
2010-01-08 17:50:55 +00:00
|
|
|
{
|
|
|
|
int tot= 0, changed= 0, failed= 0, linked= 0;
|
|
|
|
|
2007-12-24 17:07:52 +00:00
|
|
|
struct BPathIterator bpi;
|
2010-11-11 07:51:12 +00:00
|
|
|
char filepath[FILE_MAX];
|
|
|
|
const char *libpath;
|
2007-12-24 17:07:52 +00:00
|
|
|
|
|
|
|
/* be sure there is low chance of the path being too short */
|
|
|
|
char filepath_absolute[(FILE_MAXDIR * 2) + FILE_MAXFILE];
|
|
|
|
|
2010-01-08 17:50:55 +00:00
|
|
|
BLI_bpathIterator_init(&bpi, basepath);
|
2007-12-24 17:07:52 +00:00
|
|
|
while (!BLI_bpathIterator_isDone(&bpi)) {
|
2008-04-25 16:09:16 +00:00
|
|
|
BLI_bpathIterator_getPath(&bpi, filepath);
|
2007-12-24 17:07:52 +00:00
|
|
|
libpath = BLI_bpathIterator_getLib(&bpi);
|
2007-12-20 10:27:13 +00:00
|
|
|
|
2007-12-24 17:07:52 +00:00
|
|
|
if(strncmp(filepath, "//", 2)==0) {
|
|
|
|
if (libpath) { /* cant make absolute if we are library - TODO, LOG THIS */
|
2010-01-08 17:50:55 +00:00
|
|
|
linked++;
|
2007-12-24 17:07:52 +00:00
|
|
|
} else { /* get the expanded path and check it is relative or too long */
|
2008-04-25 16:09:16 +00:00
|
|
|
BLI_bpathIterator_getPathExpanded( &bpi, filepath_absolute );
|
2010-01-08 17:50:55 +00:00
|
|
|
BLI_cleanup_file(bpi.base_path, filepath_absolute); /* fix any /foo/../foo/ */
|
2007-12-31 12:03:26 +00:00
|
|
|
/* to be safe, check the length */
|
2007-12-24 17:07:52 +00:00
|
|
|
if (BLI_bpathIterator_getPathMaxLen(&bpi) <= strlen(filepath_absolute)) {
|
2010-01-08 17:50:55 +00:00
|
|
|
bpath_as_report(&bpi, "couldn't make absolute (too long)", reports);
|
|
|
|
failed++;
|
2007-12-24 17:07:52 +00:00
|
|
|
} else {
|
|
|
|
if(strncmp(filepath_absolute, "//", 2)) {
|
2008-04-25 16:09:16 +00:00
|
|
|
BLI_bpathIterator_setPath(&bpi, filepath_absolute);
|
2010-01-08 17:50:55 +00:00
|
|
|
changed++;
|
2007-12-24 17:07:52 +00:00
|
|
|
} else {
|
2010-01-08 17:50:55 +00:00
|
|
|
bpath_as_report(&bpi, "couldn't make absolute", reports);
|
|
|
|
failed++;
|
2007-12-24 17:07:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-12-20 10:27:13 +00:00
|
|
|
BLI_bpathIterator_step(&bpi);
|
2010-01-08 17:50:55 +00:00
|
|
|
tot++;
|
2007-12-20 10:27:13 +00:00
|
|
|
}
|
2008-04-25 16:09:16 +00:00
|
|
|
BLI_bpathIterator_free(&bpi);
|
2010-01-08 17:50:55 +00:00
|
|
|
|
|
|
|
if(reports)
|
|
|
|
BKE_reportf(reports, failed ? RPT_ERROR : RPT_INFO, "Total files %i|Changed %i|Failed %i|Linked %i", tot, changed, failed, linked);
|
2007-12-20 10:27:13 +00:00
|
|
|
}
|
|
|
|
|
2007-12-24 17:07:52 +00:00
|
|
|
|
2007-12-20 10:27:13 +00:00
|
|
|
/* find this file recursively, use the biggest file so thumbnails dont get used by mistake
|
|
|
|
- dir: subdir to search
|
|
|
|
- filename: set this filename
|
|
|
|
- filesize: filesize for the file
|
|
|
|
*/
|
|
|
|
#define MAX_RECUR 16
|
|
|
|
static int findFileRecursive(char *filename_new, const char *dirname, const char *filename, int *filesize, int *recur_depth)
|
|
|
|
{
|
|
|
|
/* file searching stuff */
|
|
|
|
DIR *dir;
|
|
|
|
struct dirent *de;
|
|
|
|
struct stat status;
|
|
|
|
char path[FILE_MAX];
|
|
|
|
int size;
|
|
|
|
|
|
|
|
dir = opendir(dirname);
|
|
|
|
|
|
|
|
if (dir==0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (*filesize == -1)
|
|
|
|
*filesize = 0; /* dir opened fine */
|
|
|
|
|
|
|
|
while ((de = readdir(dir)) != NULL) {
|
|
|
|
|
2010-05-07 23:34:03 +00:00
|
|
|
if (strcmp(".", de->d_name)==0 || strcmp("..", de->d_name)==0)
|
2007-12-20 10:27:13 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
BLI_join_dirfile(path, dirname, de->d_name);
|
|
|
|
|
|
|
|
if (stat(path, &status) != 0)
|
|
|
|
continue; /* cant stat, dont bother with this file, could print debug info here */
|
|
|
|
|
|
|
|
if (S_ISREG(status.st_mode)) { /* is file */
|
|
|
|
if (strncmp(filename, de->d_name, FILE_MAX)==0) { /* name matches */
|
|
|
|
/* open the file to read its size */
|
2010-09-15 06:43:36 +00:00
|
|
|
size = status.st_size;
|
2008-01-21 22:10:20 +00:00
|
|
|
if ((size > 0) && (size > *filesize)) { /* find the biggest file */
|
|
|
|
*filesize = size;
|
|
|
|
BLI_strncpy(filename_new, path, FILE_MAX);
|
2007-12-20 10:27:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (S_ISDIR(status.st_mode)) { /* is subdir */
|
|
|
|
if (*recur_depth <= MAX_RECUR) {
|
|
|
|
(*recur_depth)++;
|
|
|
|
findFileRecursive(filename_new, path, filename, filesize, recur_depth);
|
|
|
|
(*recur_depth)--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
closedir(dir);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* high level function - call from fileselector */
|
2010-11-11 07:51:12 +00:00
|
|
|
void findMissingFiles(const char *basepath, const char *str) {
|
2007-12-20 10:27:13 +00:00
|
|
|
struct BPathIterator bpi;
|
|
|
|
|
|
|
|
/* be sure there is low chance of the path being too short */
|
|
|
|
char filepath_expanded[FILE_MAXDIR*2];
|
2010-11-11 07:51:12 +00:00
|
|
|
char filepath[FILE_MAX];
|
|
|
|
const char *libpath;
|
2007-12-20 10:27:13 +00:00
|
|
|
int filesize, recur_depth;
|
|
|
|
|
2010-06-05 21:19:59 +00:00
|
|
|
char dirname[FILE_MAX], filename_new[FILE_MAX];
|
2007-12-20 10:27:13 +00:00
|
|
|
|
Merge of trunk into blender 2.5:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r12987:17416
Issues:
* GHOST/X11 had conflicting changes. Some code was added in 2.5, which was
later added in trunk also, but reverted partially, specifically revision
16683. I have left out this reversion in the 2.5 branch since I think it is
needed there.
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16683
* Scons had various conflicting changes, I decided to go with trunk version
for everything except priorities and some library renaming.
* In creator.c, there were various fixes and fixes for fixes related to the -w
-W and -p options. In 2.5 -w and -W is not coded yet, and -p is done
differently. Since this is changed so much, and I don't think those fixes
would be needed in 2.5, I've left them out.
* Also in creator.c: there was code for a python bugfix where the screen was not
initialized when running with -P. The code that initializes the screen there
I had to disable, that can't work in 2.5 anymore but left it commented as a
reminder.
Further I had to disable some new function calls. using src/ and python/, as
was done already in this branch, disabled function calls:
* bpath.c: error reporting
* BME_conversions.c: editmesh conversion functions.
* SHD_dynamic: disabled almost completely, there is no python/.
* KX_PythonInit.cpp and Ketsji/ build files: Mathutils is not there, disabled.
* text.c: clipboard copy call.
* object.c: OB_SUPPORT_MATERIAL.
* DerivedMesh.c and subsurf_ccg, stipple_quarttone.
Still to be done:
* Go over files and functions that were moved to a different location but could
still use changes that were done in trunk.
2008-11-12 21:16:53 +00:00
|
|
|
//XXX waitcursor( 1 );
|
2007-12-20 10:27:13 +00:00
|
|
|
|
2010-03-08 20:08:04 +00:00
|
|
|
BLI_split_dirfile(str, dirname, NULL);
|
2007-12-20 10:27:13 +00:00
|
|
|
|
2010-01-08 17:50:55 +00:00
|
|
|
BLI_bpathIterator_init(&bpi, basepath);
|
2007-12-20 10:27:13 +00:00
|
|
|
|
|
|
|
while (!BLI_bpathIterator_isDone(&bpi)) {
|
2008-04-25 16:09:16 +00:00
|
|
|
BLI_bpathIterator_getPath(&bpi, filepath);
|
2007-12-20 10:27:13 +00:00
|
|
|
libpath = BLI_bpathIterator_getLib(&bpi);
|
|
|
|
|
2008-04-25 16:09:16 +00:00
|
|
|
/* Check if esc was pressed because searching files can be slow */
|
Merge of trunk into blender 2.5:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r12987:17416
Issues:
* GHOST/X11 had conflicting changes. Some code was added in 2.5, which was
later added in trunk also, but reverted partially, specifically revision
16683. I have left out this reversion in the 2.5 branch since I think it is
needed there.
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16683
* Scons had various conflicting changes, I decided to go with trunk version
for everything except priorities and some library renaming.
* In creator.c, there were various fixes and fixes for fixes related to the -w
-W and -p options. In 2.5 -w and -W is not coded yet, and -p is done
differently. Since this is changed so much, and I don't think those fixes
would be needed in 2.5, I've left them out.
* Also in creator.c: there was code for a python bugfix where the screen was not
initialized when running with -P. The code that initializes the screen there
I had to disable, that can't work in 2.5 anymore but left it commented as a
reminder.
Further I had to disable some new function calls. using src/ and python/, as
was done already in this branch, disabled function calls:
* bpath.c: error reporting
* BME_conversions.c: editmesh conversion functions.
* SHD_dynamic: disabled almost completely, there is no python/.
* KX_PythonInit.cpp and Ketsji/ build files: Mathutils is not there, disabled.
* text.c: clipboard copy call.
* object.c: OB_SUPPORT_MATERIAL.
* DerivedMesh.c and subsurf_ccg, stipple_quarttone.
Still to be done:
* Go over files and functions that were moved to a different location but could
still use changes that were done in trunk.
2008-11-12 21:16:53 +00:00
|
|
|
/*XXX if (blender_test_break()) {
|
2008-04-25 16:09:16 +00:00
|
|
|
break;
|
Merge of trunk into blender 2.5:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r12987:17416
Issues:
* GHOST/X11 had conflicting changes. Some code was added in 2.5, which was
later added in trunk also, but reverted partially, specifically revision
16683. I have left out this reversion in the 2.5 branch since I think it is
needed there.
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16683
* Scons had various conflicting changes, I decided to go with trunk version
for everything except priorities and some library renaming.
* In creator.c, there were various fixes and fixes for fixes related to the -w
-W and -p options. In 2.5 -w and -W is not coded yet, and -p is done
differently. Since this is changed so much, and I don't think those fixes
would be needed in 2.5, I've left them out.
* Also in creator.c: there was code for a python bugfix where the screen was not
initialized when running with -P. The code that initializes the screen there
I had to disable, that can't work in 2.5 anymore but left it commented as a
reminder.
Further I had to disable some new function calls. using src/ and python/, as
was done already in this branch, disabled function calls:
* bpath.c: error reporting
* BME_conversions.c: editmesh conversion functions.
* SHD_dynamic: disabled almost completely, there is no python/.
* KX_PythonInit.cpp and Ketsji/ build files: Mathutils is not there, disabled.
* text.c: clipboard copy call.
* object.c: OB_SUPPORT_MATERIAL.
* DerivedMesh.c and subsurf_ccg, stipple_quarttone.
Still to be done:
* Go over files and functions that were moved to a different location but could
still use changes that were done in trunk.
2008-11-12 21:16:53 +00:00
|
|
|
}*/
|
2008-04-25 16:09:16 +00:00
|
|
|
|
2007-12-20 10:27:13 +00:00
|
|
|
if (libpath==NULL) {
|
|
|
|
|
2008-04-25 16:09:16 +00:00
|
|
|
BLI_bpathIterator_getPathExpanded( &bpi, filepath_expanded );
|
2007-12-20 10:27:13 +00:00
|
|
|
|
|
|
|
if (!BLI_exists(filepath_expanded)) {
|
|
|
|
/* can the dir be opened? */
|
|
|
|
filesize = -1;
|
|
|
|
recur_depth = 0;
|
|
|
|
|
2010-06-05 21:19:59 +00:00
|
|
|
findFileRecursive(filename_new, dirname, BLI_path_basename(filepath), &filesize, &recur_depth);
|
2007-12-20 10:27:13 +00:00
|
|
|
if (filesize == -1) { /* could not open dir */
|
|
|
|
printf("Could not open dir \"%s\"\n", dirname);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (filesize > 0) {
|
|
|
|
|
|
|
|
if (BLI_bpathIterator_getPathMaxLen( &bpi ) < strlen(filename_new)) {
|
|
|
|
printf("cannot set path \"%s\" too long!", filename_new);
|
|
|
|
} else {
|
|
|
|
/* copy the found path into the old one */
|
|
|
|
if (G.relbase_valid)
|
2010-03-09 17:36:23 +00:00
|
|
|
BLI_path_rel(filename_new, bpi.base_path);
|
2007-12-20 10:27:13 +00:00
|
|
|
|
2008-04-25 16:09:16 +00:00
|
|
|
BLI_bpathIterator_setPath( &bpi, filename_new );
|
2007-12-20 10:27:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
BLI_bpathIterator_step(&bpi);
|
|
|
|
}
|
2008-04-25 16:09:16 +00:00
|
|
|
BLI_bpathIterator_free(&bpi);
|
|
|
|
|
Merge of trunk into blender 2.5:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r12987:17416
Issues:
* GHOST/X11 had conflicting changes. Some code was added in 2.5, which was
later added in trunk also, but reverted partially, specifically revision
16683. I have left out this reversion in the 2.5 branch since I think it is
needed there.
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16683
* Scons had various conflicting changes, I decided to go with trunk version
for everything except priorities and some library renaming.
* In creator.c, there were various fixes and fixes for fixes related to the -w
-W and -p options. In 2.5 -w and -W is not coded yet, and -p is done
differently. Since this is changed so much, and I don't think those fixes
would be needed in 2.5, I've left them out.
* Also in creator.c: there was code for a python bugfix where the screen was not
initialized when running with -P. The code that initializes the screen there
I had to disable, that can't work in 2.5 anymore but left it commented as a
reminder.
Further I had to disable some new function calls. using src/ and python/, as
was done already in this branch, disabled function calls:
* bpath.c: error reporting
* BME_conversions.c: editmesh conversion functions.
* SHD_dynamic: disabled almost completely, there is no python/.
* KX_PythonInit.cpp and Ketsji/ build files: Mathutils is not there, disabled.
* text.c: clipboard copy call.
* object.c: OB_SUPPORT_MATERIAL.
* DerivedMesh.c and subsurf_ccg, stipple_quarttone.
Still to be done:
* Go over files and functions that were moved to a different location but could
still use changes that were done in trunk.
2008-11-12 21:16:53 +00:00
|
|
|
//XXX waitcursor( 0 );
|
2007-12-20 10:27:13 +00:00
|
|
|
}
|