| 
									
										
										
										
											2011-02-23 10:52:22 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											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
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-27 20:37:56 +00:00
										 |  |  | /** \file blender/blenlib/intern/bpath.c
 | 
					
						
							|  |  |  |  *  \ingroup bli | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-06 13:20:05 +00:00
										 |  |  | #include <sys/stat.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <string.h>
 | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | #include <assert.h>
 | 
					
						
							| 
									
										
										
										
											2009-09-06 13:20:05 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* 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"
 | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | #include "DNA_texture_types.h"
 | 
					
						
							|  |  |  | #include "DNA_text_types.h"
 | 
					
						
							| 
									
										
										
										
											2010-08-04 04:01:27 +00:00
										 |  |  | #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"
 | 
					
						
							| 
									
										
										
										
											2010-11-14 23:07:06 +00:00
										 |  |  | #include "DNA_freestyle_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"
 | 
					
						
							| 
									
										
										
										
											2011-01-07 18:36:47 +00:00
										 |  |  | #include "BLI_utildefines.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 */
 | 
					
						
							| 
									
										
										
										
											2009-12-13 14:56:45 +00:00
										 |  |  | #include "BKE_sequencer.h"
 | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | #include "BKE_main.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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | typedef struct BPathIteratorSeqData { | 
					
						
							|  |  |  | 	int totseq; | 
					
						
							|  |  |  | 	int seq; | 
					
						
							|  |  |  | 	struct Sequence **seqar; /* Sequence */ | 
					
						
							|  |  |  | 	struct Scene *scene;			/* Current scene */ | 
					
						
							|  |  |  | } BPathIteratorSeqData; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-06 01:23:18 +00:00
										 |  |  | typedef struct BPathIteratorFrsModuleData { | 
					
						
							|  |  |  | 	struct Scene *scene;			/* Current scene */ | 
					
						
							|  |  |  | 	struct SceneRenderLayer *layer;	/* Scene render layer */ | 
					
						
							|  |  |  | 	struct FreestyleModuleConfig *module; | 
					
						
							|  |  |  | } BPathIteratorFrsModuleData; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | typedef struct BPathIterator { | 
					
						
							|  |  |  | 	char*	_path; /* never access directly, use BLI_bpathIterator_getPath */ | 
					
						
							|  |  |  | 	const char*	_lib; | 
					
						
							|  |  |  | 	const char*	_name; | 
					
						
							|  |  |  | 	void*	data; | 
					
						
							|  |  |  | 	int		len; | 
					
						
							|  |  |  | 	int		type; | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | 	int		flag; /* iterator options */ | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void (*setpath_callback)(struct BPathIterator *, const char *); | 
					
						
							|  |  |  | 	void (*getpath_callback)(struct BPathIterator *, char *); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 	const char*	base_path; /* base path, the directry the blend file is in - normally bmain->name */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	Main *bmain; | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* only for seq data */ | 
					
						
							|  |  |  | 	struct BPathIteratorSeqData seqdata; | 
					
						
							| 
									
										
										
										
											2010-12-06 01:23:18 +00:00
										 |  |  | 	/* only for Freestyle module data */ | 
					
						
							|  |  |  | 	struct BPathIteratorFrsModuleData frsmoduledata; | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | } BPathIterator; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | #define FILE_MAX			240
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | /* TODO - BPATH_PLUGIN, BPATH_SEQ */ | 
					
						
							|  |  |  | enum BPathTypes { | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	BPATH_IMAGE= 0, | 
					
						
							|  |  |  | 	BPATH_TEXTURE, | 
					
						
							|  |  |  | 	BPATH_TEXT, | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	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, | 
					
						
							| 
									
										
										
										
											2010-11-14 23:07:06 +00:00
										 |  |  | 	BPATH_FRS_MODULE, | 
					
						
							| 
									
										
										
										
											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
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | void BLI_bpathIterator_init(struct BPathIterator **bpi_pt, Main *bmain, const char *basedir, const int flag) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 	BPathIterator *bpi; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	bpi= MEM_mallocN(sizeof(BPathIterator), "BLI_bpathIterator_init"); | 
					
						
							|  |  |  | 	*bpi_pt= bpi; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	bpi->type= BPATH_IMAGE; | 
					
						
							|  |  |  | 	bpi->data= NULL; | 
					
						
							| 
									
										
										
										
											2008-04-25 16:09:16 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	bpi->getpath_callback= NULL; | 
					
						
							|  |  |  | 	bpi->setpath_callback= NULL; | 
					
						
							| 
									
										
										
										
											2008-04-25 16:09:16 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2010-01-08 17:50:55 +00:00
										 |  |  | 	/* Sequencer specific */ | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	bpi->seqdata.totseq= 0; | 
					
						
							|  |  |  | 	bpi->seqdata.seq= 0; | 
					
						
							|  |  |  | 	bpi->seqdata.seqar= NULL; | 
					
						
							|  |  |  | 	bpi->seqdata.scene= NULL; | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	bpi->flag= flag; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-14 23:07:06 +00:00
										 |  |  | 	/* Freestyle module specific */ | 
					
						
							| 
									
										
										
										
											2010-12-06 01:23:18 +00:00
										 |  |  | 	bpi->frsmoduledata.scene= NULL; | 
					
						
							|  |  |  | 	bpi->frsmoduledata.layer= NULL; | 
					
						
							|  |  |  | 	bpi->frsmoduledata.module= NULL; | 
					
						
							| 
									
										
										
										
											2010-11-14 23:07:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 	bpi->base_path= basedir; /* normally bmain->name */ | 
					
						
							|  |  |  | 	bpi->bmain= bmain; | 
					
						
							| 
									
										
										
										
											2010-01-08 17:50:55 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	BLI_bpathIterator_step(bpi); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-17 12:05:09 +00:00
										 |  |  | #if 0
 | 
					
						
							| 
									
										
										
										
											2011-02-13 10:52:18 +00:00
										 |  |  | static void BLI_bpathIterator_alloc(struct BPathIterator **bpi) { | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	*bpi= MEM_mallocN(sizeof(BPathIterator), "BLI_bpathIterator_alloc"); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2011-02-17 12:05:09 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											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); | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	bpi->seqdata.seqar= NULL; | 
					
						
							|  |  |  | 	bpi->seqdata.scene= NULL; | 
					
						
							| 
									
										
										
										
											2010-12-06 01:23:18 +00:00
										 |  |  | 	bpi->frsmoduledata.scene= NULL; | 
					
						
							|  |  |  | 	bpi->frsmoduledata.layer= NULL; | 
					
						
							|  |  |  | 	bpi->frsmoduledata.module= NULL; | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	MEM_freeN(bpi); | 
					
						
							| 
									
										
										
										
											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 { | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 		strcpy(path, bpi->_path); /* warning, we assume 'path' are long enough */ | 
					
						
							| 
									
										
										
										
											2008-04-25 16:09:16 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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 { | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 		strcpy(bpi->_path, path); /* warning, we assume 'path' are long enough */ | 
					
						
							| 
									
										
										
										
											2008-04-25 16:09:16 +00:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											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); | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	libpath= BLI_bpathIterator_getLib(bpi); | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	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) { | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	return bpi->_lib; | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2010-11-11 07:51:12 +00:00
										 |  |  | const char* BLI_bpathIterator_getName( struct BPathIterator *bpi) { | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	return bpi->_name; | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | } | 
					
						
							|  |  |  | int	BLI_bpathIterator_getType( struct BPathIterator *bpi) { | 
					
						
							|  |  |  | 	return bpi->type; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2011-02-27 08:31:10 +00:00
										 |  |  | unsigned int	BLI_bpathIterator_getPathMaxLen(struct BPathIterator *bpi) { | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	return bpi->len; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | const char* BLI_bpathIterator_getBasePath( struct BPathIterator *bpi) { | 
					
						
							|  |  |  | 	return bpi->base_path; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* gets the first or the next image that has a path - not a viewer node or generated image */ | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | static struct Image *ima_stepdata__internal(struct Image *ima, const int step_next, const int flag) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	if (ima==NULL) | 
					
						
							|  |  |  | 		return NULL; | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	if (step_next) | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 		ima= ima->id.next; | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	while (ima) { | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | 		if (ELEM3(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) { | 
					
						
							|  |  |  | 			if(ima->packedfile==NULL || (flag & BPATH_USE_PACKED)) { | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 		/* image is not a image with a path, skip it */ | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 		ima= ima->id.next; | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	}	 | 
					
						
							|  |  |  | 	return ima; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | static struct Tex *tex_stepdata__internal(struct Tex *tex, const int step_next, const int UNUSED(flag)) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	if (tex==NULL) | 
					
						
							|  |  |  | 		return NULL; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (step_next) | 
					
						
							|  |  |  | 		tex= tex->id.next; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	while (tex) { | 
					
						
							|  |  |  | 		if (tex->type == TEX_VOXELDATA && TEX_VD_IS_SOURCE_PATH(tex->vd->file_format)) | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 		/* image is not a image with a path, skip it */ | 
					
						
							|  |  |  | 		tex= tex->id.next; | 
					
						
							|  |  |  | 	}	 | 
					
						
							|  |  |  | 	return tex; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | static struct Text *text_stepdata__internal(struct Text *text, const int step_next, const int UNUSED(flag)) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	if (text==NULL) | 
					
						
							|  |  |  | 		return NULL; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (step_next) | 
					
						
							|  |  |  | 		text= text->id.next; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	while (text) { | 
					
						
							|  |  |  | 		if (text->name) | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 		/* image is not a image with a path, skip it */ | 
					
						
							|  |  |  | 		text= text->id.next; | 
					
						
							|  |  |  | 	}	 | 
					
						
							|  |  |  | 	return text; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | static struct VFont *vf_stepdata__internal(struct VFont *vf, const int step_next, const int flag) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	if (vf==NULL) | 
					
						
							|  |  |  | 		return NULL; | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	if (step_next) | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 		vf= vf->id.next; | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	while (vf) { | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | 		if (strcmp(vf->name, FO_BUILTIN_NAME)!=0) { | 
					
						
							|  |  |  | 			if(vf->packedfile==NULL || (flag & BPATH_USE_PACKED)) { | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		/* font with no path, skip it */ | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 		vf= vf->id.next; | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	}	 | 
					
						
							|  |  |  | 	return vf; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | static struct bSound *snd_stepdata__internal(struct bSound *snd, int step_next, const int flag) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	if (snd==NULL) | 
					
						
							|  |  |  | 		return NULL; | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	if (step_next) | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 		snd= snd->id.next; | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	while (snd) { | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | 		if(snd->packedfile==NULL || (flag & BPATH_USE_PACKED)) { | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 			break; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 		/* font with no path, skip it */ | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 		snd= snd->id.next; | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	}	 | 
					
						
							|  |  |  | 	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) { | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 		bpi->seqdata.scene= bpi->bmain->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); | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 				bpi->seqdata.seq= 0; | 
					
						
							| 
									
										
										
										
											2008-04-27 20:43:25 +00:00
										 |  |  | 			} | 
					
						
							|  |  |  | 			 | 
					
						
							| 
									
										
										
										
											2008-04-25 16:09:16 +00:00
										 |  |  | 			if (bpi->seqdata.seq >= bpi->seqdata.totseq) { | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 				seq= NULL; | 
					
						
							| 
									
										
										
										
											2008-04-27 20:43:25 +00:00
										 |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 				seq= bpi->seqdata.seqar[bpi->seqdata.seq]; | 
					
						
							|  |  |  | 				while (!SEQ_HAS_PATH(seq) && seq->plugin==NULL) { | 
					
						
							| 
									
										
										
										
											2008-04-27 20:43:25 +00:00
										 |  |  | 					bpi->seqdata.seq++; | 
					
						
							|  |  |  | 					if (bpi->seqdata.seq >= bpi->seqdata.totseq) { | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 						seq= NULL; | 
					
						
							| 
									
										
										
										
											2008-04-27 20:43:25 +00:00
										 |  |  | 						break; | 
					
						
							|  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 					seq= bpi->seqdata.seqar[bpi->seqdata.seq]; | 
					
						
							| 
									
										
										
										
											2008-04-27 20:43:25 +00:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											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); | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 					bpi->seqdata.seqar= NULL; | 
					
						
							| 
									
										
										
										
											2008-04-28 16:09:17 +00:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 				bpi->seqdata.scene= bpi->seqdata.scene->id.next; | 
					
						
							| 
									
										
										
										
											2008-04-27 20:43:25 +00:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			/* no seq data in this scene, next */ | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 			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
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-14 23:07:06 +00:00
										 |  |  | static struct FreestyleModuleConfig *frs_module_stepdata__internal(struct BPathIterator *bpi, int step_next) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct FreestyleModuleConfig *module; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* Initializing */ | 
					
						
							|  |  |  | 	if (bpi->frsmoduledata.scene==NULL) { | 
					
						
							|  |  |  | 		bpi->frsmoduledata.scene= G.main->scene.first; | 
					
						
							| 
									
										
										
										
											2010-12-06 01:23:18 +00:00
										 |  |  | 		bpi->frsmoduledata.layer= (bpi->frsmoduledata.scene) ? bpi->frsmoduledata.scene->r.layers.first : NULL; | 
					
						
							|  |  |  | 		bpi->frsmoduledata.module= (bpi->frsmoduledata.layer) ? bpi->frsmoduledata.layer->freestyleConfig.modules.first : NULL; | 
					
						
							| 
									
										
										
										
											2010-11-14 23:07:06 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	while (bpi->frsmoduledata.scene) { | 
					
						
							|  |  |  | 		while (bpi->frsmoduledata.layer) { | 
					
						
							|  |  |  | 			while (bpi->frsmoduledata.module) { | 
					
						
							|  |  |  | 				module= bpi->frsmoduledata.module; | 
					
						
							|  |  |  | 				bpi->frsmoduledata.module= module->next; | 
					
						
							|  |  |  | 				return module; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			bpi->frsmoduledata.layer= bpi->frsmoduledata.layer->next; | 
					
						
							| 
									
										
										
										
											2010-12-06 01:23:18 +00:00
										 |  |  | 			bpi->frsmoduledata.module= (bpi->frsmoduledata.layer) ? bpi->frsmoduledata.layer->freestyleConfig.modules.first : NULL; | 
					
						
							| 
									
										
										
										
											2010-11-14 23:07:06 +00:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		bpi->frsmoduledata.scene= bpi->frsmoduledata.scene->id.next; | 
					
						
							| 
									
										
										
										
											2010-12-06 01:23:18 +00:00
										 |  |  | 		bpi->frsmoduledata.layer= (bpi->frsmoduledata.scene) ? bpi->frsmoduledata.scene->r.layers.first : NULL; | 
					
						
							|  |  |  | 		bpi->frsmoduledata.module= (bpi->frsmoduledata.layer) ? bpi->frsmoduledata.layer->freestyleConfig.modules.first : NULL; | 
					
						
							| 
									
										
										
										
											2010-11-14 23:07:06 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return NULL; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-29 17:08:11 +00:00
										 |  |  | static void seq_getpath(struct BPathIterator *bpi, char *path) { | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	Sequence *seq= (Sequence *)bpi->data; | 
					
						
							| 
									
										
										
										
											2008-04-25 16:09:16 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	path[0]= '\0'; /* incase we cant get the path */ | 
					
						
							| 
									
										
										
										
											2008-04-25 16:09:16 +00:00
										 |  |  | 	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); | 
					
						
							|  |  |  | 			}  | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		else { | 
					
						
							| 
									
										
										
										
											2008-04-25 16:09:16 +00:00
										 |  |  | 			/* simple case */ | 
					
						
							|  |  |  | 			BLI_strncpy(seq->strip->dir, path, sizeof(seq->strip->dir)); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	else if (seq->plugin) { | 
					
						
							|  |  |  | 		BLI_strncpy(seq->plugin->name, path, sizeof(seq->plugin->name)); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2008-04-25 16:09:16 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-11 07:51:12 +00:00
										 |  |  | static void seq_setpath(struct BPathIterator *bpi, const char *path) { | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	Sequence *seq= (Sequence *)bpi->data; | 
					
						
							| 
									
										
										
										
											2008-04-25 16:09:16 +00:00
										 |  |  | 	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); | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		else { | 
					
						
							| 
									
										
										
										
											2008-04-25 16:09:16 +00:00
										 |  |  | 			/* simple case */ | 
					
						
							|  |  |  | 			BLI_strncpy(seq->strip->dir, path, sizeof(seq->strip->dir)); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	else if (seq->plugin) { | 
					
						
							|  |  |  | 		BLI_strncpy(seq->plugin->name, path, sizeof(seq->plugin->name)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void text_getpath(struct BPathIterator *bpi, char *path) { | 
					
						
							|  |  |  | 	Text *text= (Text *)bpi->data; | 
					
						
							|  |  |  | 	path[0]= '\0'; /* incase we cant get the path */ | 
					
						
							|  |  |  | 	if(text->name) { | 
					
						
							|  |  |  | 		strcpy(path, text->name); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void text_setpath(struct BPathIterator *bpi, const char *path) { | 
					
						
							|  |  |  | 	Text *text= (Text *)bpi->data; | 
					
						
							|  |  |  | 	if (text==NULL) return;  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if(text->name) { | 
					
						
							|  |  |  | 		MEM_freeN(text->name); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	text->name= BLI_strdup(path); | 
					
						
							| 
									
										
										
										
											2008-04-25 16:09:16 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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) | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 		me= me->id.next; | 
					
						
							| 
									
										
										
										
											2010-01-28 18:20:28 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	while (me) { | 
					
						
							|  |  |  | 		if (me->fdata.external) { | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 		me= me->id.next; | 
					
						
							| 
									
										
										
										
											2010-01-28 18:20:28 +00:00
										 |  |  | 	}	 | 
					
						
							|  |  |  | 	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 */ | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	bpi->data= NULL; | 
					
						
							| 
									
										
										
										
											2008-04-25 16:09:16 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	switch (bpi->type) { | 
					
						
							|  |  |  | 	case BPATH_SEQ: | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 		bpi->getpath_callback= seq_getpath; | 
					
						
							|  |  |  | 		bpi->setpath_callback= seq_setpath; | 
					
						
							|  |  |  | 		break; | 
					
						
							|  |  |  | 	case BPATH_TEXT: /* path is malloc'd */ | 
					
						
							|  |  |  | 		bpi->getpath_callback= text_getpath; | 
					
						
							|  |  |  | 		bpi->setpath_callback= text_setpath; | 
					
						
							| 
									
										
										
										
											2008-04-25 16:09:16 +00:00
										 |  |  | 		break; | 
					
						
							|  |  |  | 	default: | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 		bpi->getpath_callback= NULL; | 
					
						
							|  |  |  | 		bpi->setpath_callback= NULL; | 
					
						
							| 
									
										
										
										
											2008-04-25 16:09:16 +00:00
										 |  |  | 		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) { | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 			/*if (bpi->data)	bpi->data= ((ID *)bpi->data)->next;*/ | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | 			if (bpi->data)	bpi->data= ima_stepdata__internal((Image *)bpi->data, 1, bpi->flag); /* must skip images that have no path */ | 
					
						
							|  |  |  | 			else 			bpi->data= ima_stepdata__internal(bpi->bmain->image.first, 0, bpi->flag); | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 			 | 
					
						
							|  |  |  | 			if (bpi->data) { | 
					
						
							|  |  |  | 				/* get the path info from this datatype */ | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 				Image *ima= (Image *)bpi->data; | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 				 | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 				bpi->_lib= ima->id.lib ? ima->id.lib->filepath : NULL; | 
					
						
							|  |  |  | 				bpi->_path= ima->name; | 
					
						
							|  |  |  | 				bpi->_name= ima->id.name+2; | 
					
						
							|  |  |  | 				bpi->len= sizeof(ima->name); | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 				 | 
					
						
							|  |  |  | 				/* we are done, advancing to the next item, this type worked fine */ | 
					
						
							|  |  |  | 				break; | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2008-04-25 16:09:16 +00:00
										 |  |  | 				bpi_type_step__internal(bpi); | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if  ((bpi->type) == BPATH_TEXTURE) { | 
					
						
							|  |  |  | 			/*if (bpi->data)	bpi->data= ((ID *)bpi->data)->next;*/ | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | 			if (bpi->data)	bpi->data= tex_stepdata__internal( (Tex *)bpi->data, 1, bpi->flag); /* must skip images that have no path */ | 
					
						
							|  |  |  | 			else 			bpi->data= tex_stepdata__internal(bpi->bmain->tex.first, 0, bpi->flag); | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 			if (bpi->data) { | 
					
						
							|  |  |  | 				/* get the path info from this datatype */ | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 				Tex *tex= (Tex *)bpi->data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				if(tex->type == TEX_VOXELDATA) { | 
					
						
							|  |  |  | 					bpi->_lib= tex->id.lib ? tex->id.lib->filepath : NULL; | 
					
						
							|  |  |  | 					bpi->_path= tex->vd->source_path; | 
					
						
							|  |  |  | 					bpi->_name= tex->id.name+2; | 
					
						
							|  |  |  | 					bpi->len= sizeof(tex->vd->source_path); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				else { | 
					
						
							|  |  |  | 					assert(!"Texture has no path, incorrect step 'tex_stepdata__internal'"); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				/* we are done, advancing to the next item, this type worked fine */ | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			} else { | 
					
						
							|  |  |  | 				bpi_type_step__internal(bpi); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if  ((bpi->type) == BPATH_TEXT) { | 
					
						
							|  |  |  | 			/*if (bpi->data)	bpi->data= ((ID *)bpi->data)->next;*/ | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | 			if (bpi->data)	bpi->data= text_stepdata__internal((Text *)bpi->data, 1, bpi->flag); /* must skip images that have no path */ | 
					
						
							|  |  |  | 			else 			bpi->data= text_stepdata__internal(bpi->bmain->text.first, 0, bpi->flag); | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			if (bpi->data) { | 
					
						
							|  |  |  | 				/* get the path info from this datatype */ | 
					
						
							|  |  |  | 				Text *text= (Text *)bpi->data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				bpi->_lib= text->id.lib ? text->id.lib->filepath : NULL; | 
					
						
							|  |  |  | 				bpi->_path= NULL; /* bpi->path= text->name; */ /* get/set functions override. */ | 
					
						
							|  |  |  | 				bpi->_name= text->id.name+2; | 
					
						
							|  |  |  | 				bpi->len= FILE_MAX; /* malloc'd but limit anyway since large paths may mess up other areas */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				/* we are done, advancing to the next item, this type worked fine */ | 
					
						
							|  |  |  | 				break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			} else { | 
					
						
							|  |  |  | 				bpi_type_step__internal(bpi); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		else if  ((bpi->type) == BPATH_SOUND) { | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | 			if (bpi->data)	bpi->data= snd_stepdata__internal((bSound *)bpi->data, 1, bpi->flag); /* must skip images that have no path */ | 
					
						
							|  |  |  | 			else 			bpi->data= snd_stepdata__internal(bpi->bmain->sound.first, 0, bpi->flag); | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			if (bpi->data) { | 
					
						
							|  |  |  | 				/* get the path info from this datatype */ | 
					
						
							|  |  |  | 				bSound *snd= (bSound *)bpi->data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				bpi->_lib= snd->id.lib ? snd->id.lib->filepath : NULL; | 
					
						
							|  |  |  | 				bpi->_path= snd->name; | 
					
						
							|  |  |  | 				bpi->_name= snd->id.name+2; | 
					
						
							|  |  |  | 				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) { | 
					
						
							|  |  |  | 			 | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | 			if (bpi->data)	bpi->data= vf_stepdata__internal((VFont *)bpi->data, 1, bpi->flag); | 
					
						
							|  |  |  | 			else 			bpi->data= vf_stepdata__internal(bpi->bmain->vfont.first, 0, bpi->flag); | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 			 | 
					
						
							|  |  |  | 			if (bpi->data) { | 
					
						
							|  |  |  | 				/* get the path info from this datatype */ | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 				VFont *vf= (VFont *)bpi->data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				bpi->_lib= vf->id.lib ? vf->id.lib->filepath : NULL; | 
					
						
							|  |  |  | 				bpi->_path= vf->name; | 
					
						
							|  |  |  | 				bpi->_name= vf->id.name+2; | 
					
						
							|  |  |  | 				bpi->len= sizeof(vf->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
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 		} else if  ((bpi->type) == BPATH_LIB) { | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 			if (bpi->data)	bpi->data= ((ID *)bpi->data)->next; | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 			else 			bpi->data= bpi->bmain->library.first; | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 			 | 
					
						
							|  |  |  | 			if (bpi->data) { | 
					
						
							|  |  |  | 				/* get the path info from this datatype */ | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 				Library *lib= (Library *)bpi->data; | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 				 | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 				bpi->_lib= NULL; | 
					
						
							|  |  |  | 				bpi->_path= lib->name; | 
					
						
							|  |  |  | 				bpi->_name= NULL; | 
					
						
							|  |  |  | 				bpi->len= sizeof(lib->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); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} else if  ((bpi->type) == BPATH_SEQ) { | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 			if (bpi->data)	bpi->data= seq_stepdata__internal( bpi, 1 ); | 
					
						
							|  |  |  | 			else 			bpi->data= seq_stepdata__internal( bpi, 0 ); | 
					
						
							| 
									
										
										
										
											2008-04-25 16:09:16 +00:00
										 |  |  | 			if (bpi->data) { | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 				Sequence *seq= (Sequence *)bpi->data; | 
					
						
							|  |  |  | 				bpi->_lib= NULL; | 
					
						
							|  |  |  | 				bpi->_name= seq->name+2; | 
					
						
							|  |  |  | 				bpi->len= seq->plugin ? sizeof(seq->plugin->name) : sizeof(seq->strip->dir) + sizeof(seq->strip->stripdata->name); | 
					
						
							| 
									
										
										
										
											2008-04-25 16:09:16 +00:00
										 |  |  | 				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) { | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 			if (bpi->data)	bpi->data= cdata_stepdata__internal( bpi->data, 1 ); | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 			else 			bpi->data= cdata_stepdata__internal( bpi->bmain->mesh.first, 0 ); | 
					
						
							| 
									
										
										
										
											2010-01-28 18:20:28 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			if (bpi->data) { | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 				Mesh *me= (Mesh *)bpi->data; | 
					
						
							|  |  |  | 				bpi->_lib= me->id.lib ? me->id.lib->filepath : NULL; | 
					
						
							|  |  |  | 				bpi->_path= me->fdata.external->filename; | 
					
						
							|  |  |  | 				bpi->_name= me->id.name+2; | 
					
						
							|  |  |  | 				bpi->len= sizeof(me->fdata.external->filename); | 
					
						
							| 
									
										
										
										
											2010-01-28 18:20:28 +00:00
										 |  |  | 				break; | 
					
						
							|  |  |  | 			} else { | 
					
						
							|  |  |  | 				bpi_type_step__internal(bpi); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2010-11-14 23:07:06 +00:00
										 |  |  | 		} else if  ((bpi->type) == BPATH_FRS_MODULE) { | 
					
						
							| 
									
										
										
										
											2010-12-06 01:23:18 +00:00
										 |  |  | 			if (bpi->data)	bpi->data= frs_module_stepdata__internal( bpi, 1 ); | 
					
						
							|  |  |  | 			else 			bpi->data= frs_module_stepdata__internal( bpi, 0 ); | 
					
						
							| 
									
										
										
										
											2010-11-14 23:07:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			if (bpi->data) { | 
					
						
							| 
									
										
										
										
											2010-12-06 01:23:18 +00:00
										 |  |  | 				FreestyleModuleConfig *module= (FreestyleModuleConfig *)bpi->data; | 
					
						
							|  |  |  | 				bpi->_lib= NULL; | 
					
						
							|  |  |  | 				bpi->_path= module->module_path; | 
					
						
							|  |  |  | 				bpi->_name= NULL; | 
					
						
							|  |  |  | 				bpi->len= sizeof(module->module_path); | 
					
						
							| 
									
										
										
										
											2010-11-14 23:07:06 +00:00
										 |  |  | 				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; | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	case BPATH_TEXTURE: | 
					
						
							|  |  |  | 		prefix= "Texture"; | 
					
						
							|  |  |  | 		break; | 
					
						
							|  |  |  | 	case BPATH_TEXT: | 
					
						
							|  |  |  | 		prefix= "Text"; | 
					
						
							|  |  |  | 		break; | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	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; | 
					
						
							| 
									
										
										
										
											2010-11-14 23:07:06 +00:00
										 |  |  | 	case BPATH_FRS_MODULE: | 
					
						
							|  |  |  | 		prefix= "Freestyle Module"; | 
					
						
							|  |  |  | 		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; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	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-12-06 00:52:30 +00:00
										 |  |  | void checkMissingFiles(Main *bmain, ReportList *reports) { | 
					
						
							|  |  |  | 	struct BPathIterator *bpi; | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	/* be sure there is low chance of the path being too short */ | 
					
						
							|  |  |  | 	char filepath_expanded[FILE_MAXDIR*2];  | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | 	BLI_bpathIterator_init(&bpi, bmain, bmain->name, 0); | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 	while (!BLI_bpathIterator_isDone(bpi)) { | 
					
						
							|  |  |  | 		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)) | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 			bpath_as_report(bpi, "file not found", reports); | 
					
						
							| 
									
										
										
										
											2010-01-08 17:50:55 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 		BLI_bpathIterator_step(bpi); | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +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-12-06 00:52:30 +00:00
										 |  |  | void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports) { | 
					
						
							| 
									
										
										
										
											2010-01-08 17:50:55 +00:00
										 |  |  | 	int tot= 0, changed= 0, failed= 0, linked= 0; | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +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]; | 
					
						
							| 
									
										
										
										
											2011-05-18 06:48:52 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if(basedir[0] == '\0') { | 
					
						
							|  |  |  | 		printf("makeFilesRelative: basedir='', this is a bug\n"); | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | 	BLI_bpathIterator_init(&bpi, bmain, basedir, 0); | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 	while (!BLI_bpathIterator_isDone(bpi)) { | 
					
						
							|  |  |  | 		BLI_bpathIterator_getPath(bpi, filepath); | 
					
						
							|  |  |  | 		libpath= BLI_bpathIterator_getLib(bpi); | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											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-12-06 00:52:30 +00:00
										 |  |  | 				BLI_cleanup_file(bpi->base_path, filepath_relative); /* fix any /foo/../foo/ */ | 
					
						
							|  |  |  | 				BLI_path_rel(filepath_relative, bpi->base_path); | 
					
						
							| 
									
										
										
										
											2007-12-24 17:07:52 +00:00
										 |  |  | 				/* be safe and check the length */ | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 				if (BLI_bpathIterator_getPathMaxLen(bpi) <= strlen(filepath_relative)) { | 
					
						
							|  |  |  | 					bpath_as_report(bpi, "couldn't make path relative (too long)", reports); | 
					
						
							| 
									
										
										
										
											2010-01-08 17:50:55 +00:00
										 |  |  | 					failed++; | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 				} else { | 
					
						
							|  |  |  | 					if(strncmp(filepath_relative, "//", 2)==0) { | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +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-12-06 00:52:30 +00:00
										 |  |  | 						bpath_as_report(bpi, "couldn't make path relative", reports); | 
					
						
							| 
									
										
										
										
											2010-01-08 17:50:55 +00:00
										 |  |  | 						failed++; | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 		BLI_bpathIterator_step(bpi); | 
					
						
							| 
									
										
										
										
											2010-01-08 17:50:55 +00:00
										 |  |  | 		tot++; | 
					
						
							| 
									
										
										
										
											2007-12-24 17:07:52 +00:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +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-12-06 00:52:30 +00:00
										 |  |  | void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports) | 
					
						
							| 
									
										
										
										
											2010-01-08 17:50:55 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	int tot= 0, changed= 0, failed= 0, linked= 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +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]; | 
					
						
							| 
									
										
										
										
											2011-05-18 05:21:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-18 06:48:52 +00:00
										 |  |  | 	if(basedir[0] == '\0') { | 
					
						
							|  |  |  | 		printf("makeFilesAbsolute: basedir='', this is a bug\n"); | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-05-18 05:21:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | 	BLI_bpathIterator_init(&bpi, bmain, basedir, 0); | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 	while (!BLI_bpathIterator_isDone(bpi)) { | 
					
						
							|  |  |  | 		BLI_bpathIterator_getPath(bpi, filepath); | 
					
						
							|  |  |  | 		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 */ | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 				BLI_bpathIterator_getPathExpanded(bpi, filepath_absolute); | 
					
						
							|  |  |  | 				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 */ | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 				if (BLI_bpathIterator_getPathMaxLen(bpi) <= strlen(filepath_absolute)) { | 
					
						
							|  |  |  | 					bpath_as_report(bpi, "couldn't make absolute (too long)", reports); | 
					
						
							| 
									
										
										
										
											2010-01-08 17:50:55 +00:00
										 |  |  | 					failed++; | 
					
						
							| 
									
										
										
										
											2007-12-24 17:07:52 +00:00
										 |  |  | 				} else { | 
					
						
							|  |  |  | 					if(strncmp(filepath_absolute, "//", 2)) { | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +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-12-06 00:52:30 +00:00
										 |  |  | 						bpath_as_report(bpi, "couldn't make absolute", reports); | 
					
						
							| 
									
										
										
										
											2010-01-08 17:50:55 +00:00
										 |  |  | 						failed++; | 
					
						
							| 
									
										
										
										
											2007-12-24 17:07:52 +00:00
										 |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 		BLI_bpathIterator_step(bpi); | 
					
						
							| 
									
										
										
										
											2010-01-08 17:50:55 +00:00
										 |  |  | 		tot++; | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +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; | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	dir= opendir(dirname); | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2011-02-13 10:52:18 +00:00
										 |  |  | 	if (dir==NULL) | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 		return 0; | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	if (*filesize == -1) | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 		*filesize= 0; /* dir opened fine */ | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 	while ((de= readdir(dir)) != NULL) { | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											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; | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2011-02-13 03:21:27 +00:00
										 |  |  | 		BLI_join_dirfile(path, sizeof(path), dirname, de->d_name); | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 		 | 
					
						
							|  |  |  | 		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-12-05 23:14:48 +00:00
										 |  |  | 				size= status.st_size; | 
					
						
							| 
									
										
										
										
											2008-01-21 22:10:20 +00:00
										 |  |  | 				if ((size > 0) && (size > *filesize)) { /* find the biggest file */ | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 					*filesize= size; | 
					
						
							| 
									
										
										
										
											2008-01-21 22:10:20 +00:00
										 |  |  | 					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-12-06 00:52:30 +00:00
										 |  |  | void findMissingFiles(Main *bmain, const char *str) { | 
					
						
							|  |  |  | 	struct BPathIterator *bpi; | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	/* 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
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2011-01-18 00:10:11 +00:00
										 |  |  | 	BLI_bpathIterator_init(&bpi, bmain, bmain->name, 0); | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 	while (!BLI_bpathIterator_isDone(bpi)) { | 
					
						
							|  |  |  | 		BLI_bpathIterator_getPath(bpi, filepath); | 
					
						
							|  |  |  | 		libpath= BLI_bpathIterator_getLib(bpi); | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											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) { | 
					
						
							|  |  |  | 			 | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +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? */ | 
					
						
							| 
									
										
										
										
											2010-12-05 23:14:48 +00:00
										 |  |  | 				filesize= -1; | 
					
						
							|  |  |  | 				recur_depth= 0; | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 				 | 
					
						
							| 
									
										
										
										
											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) { | 
					
						
							|  |  |  | 					 | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 					if (BLI_bpathIterator_getPathMaxLen(bpi) < strlen(filename_new)) {  | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 						printf("cannot set path \"%s\" too long!", filename_new); | 
					
						
							|  |  |  | 					} else { | 
					
						
							|  |  |  | 						/* copy the found path into the old one */ | 
					
						
							|  |  |  | 						if (G.relbase_valid) | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 							BLI_path_rel(filename_new, bpi->base_path); | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 						 | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 						BLI_bpathIterator_setPath(bpi, filename_new); | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 		BLI_bpathIterator_step(bpi); | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2010-12-06 00:52:30 +00:00
										 |  |  | 	BLI_bpathIterator_free(bpi); | 
					
						
							| 
									
										
										
										
											2008-04-25 16:09:16 +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( 0 );
 | 
					
						
							| 
									
										
										
										
											2007-12-20 10:27:13 +00:00
										 |  |  | } |