From 356ab943736e8a2434a8ff5845873482597ba5e2 Mon Sep 17 00:00:00 2001 From: Andrea Weikert Date: Sun, 2 Sep 2007 17:25:03 +0000 Subject: == imagebrowser == Initial commit of imagebrowser in trunk. BIG COMMIT! Main changes: * completely reworked imasel space * creation and storage of the preview images for materials, textures, world and lamp * thumbnails of images and movie files when browsing in the file system * loading previews from external .blend when linking or appending * thumbnail caching according to the Thumbnail Managing Standard: http://jens.triq.net/thumbnail-spec/ * for now just kept imasel access mostly as old imgbrowser (CTRL+F4, CTRL+F1) a bit hidden still. * filtering of file types (images, movies, .blend, py,...) * preliminary managing of bookmarks ('B' button to add, XKEY while bookmark active to delete) More detailed info which will be updated here: http://wiki.blender.org/index.php/User:Elubie/PreviewImageBrowser Places that need special review (and probably fixes): * BLO_blendhandle_get_previews in readblenentry * readfile.c: do_version and refactorings of do_library_append * UI integration TODO and known issues still: * Accented characters do not display correctly with international fonts * Crash was reported when browsing in directory with movie files * Bookmark management still needs some UI work (second scrollbar?), feedback here is welcome! Credits: Samir Bharadwaj (samirbharadwaj@yahoo.com) for the icon images. Many thanks to everyone who gave feedback and helped so far! --- source/blender/blenlib/BLI_blenlib.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender/blenlib/BLI_blenlib.h') diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index 6e51d171461..aaa50206ddb 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -217,6 +217,11 @@ int BLI_streq(char *a, char *b); */ int BLI_strcaseeq(char *a, char *b); +/* in util.c */ +#ifdef WITH_ICONV +void BLI_string_to_utf8(char *original, char *utf_8, char *code); +#endif + /** * Read a file as ASCII lines. An empty list is * returned if the file cannot be opened or read. -- cgit v1.2.3 From 3326d493a0d9b2b22bfb5c5446fed232bab9d28f Mon Sep 17 00:00:00 2001 From: Stephen Swaney Date: Mon, 3 Sep 2007 19:12:36 +0000 Subject: more warning fixes. sprinkle a few 'const char*'s around to remove warnings about discarding qualifiers in imbuf code. --- source/blender/blenlib/BLI_blenlib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenlib/BLI_blenlib.h') diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index aaa50206ddb..8cc148db343 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -173,7 +173,7 @@ void BLI_clean(char *path); * @param str The string to be duplicated * @retval Returns the duplicated string */ -char* BLI_strdup(char *str); +char* BLI_strdup(const char *str); /** * Duplicates the first @a len bytes of cstring @a str -- cgit v1.2.3 From e20e3e94ffdc9e7dbd846ed24bffdc1851cd5f41 Mon Sep 17 00:00:00 2001 From: Stephen Swaney Date: Tue, 4 Sep 2007 15:53:22 +0000 Subject: more warning cleanup: unused variables undefined variables discarded qualifiers --- source/blender/blenlib/BLI_blenlib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenlib/BLI_blenlib.h') diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index 8cc148db343..c73d0212869 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -184,7 +184,7 @@ char* BLI_strdup(const char *str); * @param len The number of bytes to duplicate * @retval Returns the duplicated string */ -char* BLI_strdupn(char *str, int len); +char* BLI_strdupn(const char *str, int len); /** * Like strncpy but ensures dst is always -- cgit v1.2.3 From a41da4fe110410394b964400bb1b5f49fa569f3b Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 4 Oct 2007 10:50:15 +0000 Subject: Some code cleanups: * editaction.c - merged the functions for channel properties (renaming, slider limits, protect/mute, etc.) * blenlib - added a new function BLI_findindex which finds the index position of a given item in a list. It will return -1 if it can't find the item - tidied up code formatting so that (the bits I have checked) have a single formatting style instead of a few different ones - added a few paranoia checks for NULL in one of the listbase-related functions - removed some half-dutch variable names still lurking around - culled a few compiler warnings... there are still two in util.c related to (const char *) and (char *) type things --- source/blender/blenlib/BLI_blenlib.h | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'source/blender/blenlib/BLI_blenlib.h') diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index c73d0212869..3306be76c47 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -102,13 +102,14 @@ void BLI_join_dirfile(char *string, const char *dir, const char *file); int BLI_testextensie(const char *str, const char *ext); void addlisttolist(ListBase *list1, ListBase *list2); void BLI_insertlink(struct ListBase *listbase, void *vprevlink, void *vnewlink); -void * BLI_findlink(struct ListBase *listbase, int number); +void *BLI_findlink(struct ListBase *listbase, int number); +int BLI_findindex(struct ListBase *listbase, void *vlink); void BLI_freelistN(struct ListBase *listbase); void BLI_addtail(struct ListBase *listbase, void *vlink); void BLI_remlink(struct ListBase *listbase, void *vlink); void BLI_newname(char * name, int add); -int BLI_stringdec(char *string, char *kop, char *staart, unsigned short *numlen); -void BLI_stringenc(char *string, char *kop, char *staart, unsigned short numlen, int pic); +int BLI_stringdec(char *string, char *kop, char *start, unsigned short *numlen); +void BLI_stringenc(char *string, char *kop, char *start, unsigned short numlen, int pic); void BLI_addhead(struct ListBase *listbase, void *vlink); void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink); void BLI_freelist(struct ListBase *listbase); @@ -173,7 +174,7 @@ void BLI_clean(char *path); * @param str The string to be duplicated * @retval Returns the duplicated string */ -char* BLI_strdup(const char *str); +char *BLI_strdup(const char *str); /** * Duplicates the first @a len bytes of cstring @a str @@ -184,7 +185,7 @@ char* BLI_strdup(const char *str); * @param len The number of bytes to duplicate * @retval Returns the duplicated string */ -char* BLI_strdupn(const char *str, int len); +char *BLI_strdupn(const char *str, int len); /** * Like strncpy but ensures dst is always @@ -196,7 +197,7 @@ char* BLI_strdupn(const char *str, int len); * the size of dst) * @retval Returns dst */ -char* BLI_strncpy(char *dst, const char *src, int maxncpy); +char *BLI_strncpy(char *dst, const char *src, int maxncpy); /* * Replacement for snprintf @@ -262,15 +263,15 @@ char* BLI_getbundle(void); #endif #ifdef WIN32 -int BLI_getInstallationDir( char * str ); +int BLI_getInstallationDir(char *str); #endif /* BLI_storage.h */ int BLI_filesize(int file); double BLI_diskfree(char *dir); -char * BLI_getwdN(char * dir); +char *BLI_getwdN(char *dir); void BLI_hide_dot_files(int set); -unsigned int BLI_getdir(char *dirname, struct direntry **filelist); +unsigned int BLI_getdir(char *dirname, struct direntry **filelist); /** * @attention Do not confuse with BLI_exists @@ -303,12 +304,12 @@ char *BLI_last_slash(char *string); * * @return True if @a rect is empty. */ -int BLI_rcti_is_empty(struct rcti * rect); +int BLI_rcti_is_empty(struct rcti *rect); void BLI_init_rctf(struct rctf *rect, float xmin, float xmax, float ymin, float ymax); void BLI_init_rcti(struct rcti *rect, int xmin, int xmax, int ymin, int ymax); void BLI_translate_rctf(struct rctf *rect, float x, float y); void BLI_translate_rcti(struct rcti *rect, int x, int y); -int BLI_in_rcti(struct rcti * rect, int x, int y); +int BLI_in_rcti(struct rcti *rect, int x, int y); int BLI_in_rctf(struct rctf *rect, float x, float y); int BLI_isect_rctf(struct rctf *src1, struct rctf *src2, struct rctf *dest); int BLI_isect_rcti(struct rcti *src1, struct rcti *src2, struct rcti *dest); -- cgit v1.2.3 From c3cc13e71b1d833ba40af4b290e995893c0163d4 Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Thu, 1 Nov 2007 21:44:41 +0000 Subject: == utils == New listbase functions: void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink); - corrolary to insertlinkbefore BLI_sortlist(struct ListBase *listbase, int (*cmp)(void *, void *)); - simple in place sorting method. NOT optimized, so use for small lists only. Uses a variant of insertion sort (I was lazy, people should feel free to rewrite). --- source/blender/blenlib/BLI_blenlib.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender/blenlib/BLI_blenlib.h') diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index 3306be76c47..57248fb1d68 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -112,6 +112,8 @@ int BLI_stringdec(char *string, char *kop, char *start, unsigned short *numlen); void BLI_stringenc(char *string, char *kop, char *start, unsigned short numlen, int pic); void BLI_addhead(struct ListBase *listbase, void *vlink); void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink); +void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink); +void BLI_sortlist(struct ListBase *listbase, int (*cmp)(void *, void *)); void BLI_freelist(struct ListBase *listbase); int BLI_countlist(struct ListBase *listbase); void BLI_freelinkN(ListBase *listbase, void *vlink); -- cgit v1.2.3 From f15956356c7706c93152f4267cd1cea24b2c9e30 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 13 Dec 2007 15:06:02 +0000 Subject: misc warning fixes and one fix for a big in curve allocation --- source/blender/blenlib/BLI_blenlib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenlib/BLI_blenlib.h') diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index 57248fb1d68..bcb51fa1393 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -368,7 +368,7 @@ void BLI_setInterruptCallBack(int (*f)(void)); char *BLI_strcasestr(const char *s, const char *find); int BLI_strcasecmp(const char *s1, const char *s2); int BLI_strncasecmp(const char *s1, const char *s2, int n); -void BLI_timestr(double time, char *str); +void BLI_timestr(double _time, char *str); /* time var is global */ /** * Trick to address 32 GB with an int (only for malloced pointers) -- cgit v1.2.3 From 5e4d32a9ffa7157a40bbd4d1d821c6dad860af0d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 31 Dec 2007 12:03:26 +0000 Subject: Improvements to File->External Data->Make Paths Relative & Make Paths Absolute, made when testing peach blend files wont have path issues when sent to the renderfarm. * log failed path conversions * clean the path so //foo/../foo/ is removed (not sure why but some peach files had this problem) Also added a function to util.c BLI_cleanup_file, same as BLI_cleanup_dir but dosnt add a slash at the end. --- source/blender/blenlib/BLI_blenlib.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source/blender/blenlib/BLI_blenlib.h') diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index bcb51fa1393..eb13ddc318c 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -135,7 +135,8 @@ void BLI_dlist_reinit(struct DynamicList *dlist); * converts it to a regular full path. * Also removes garbage from directory paths, like /../ or double slashes etc */ -void BLI_cleanup_dir(const char *relabase, char *dir); +void BLI_cleanup_file(const char *relabase, char *dir); +void BLI_cleanup_dir(const char *relabase, char *dir); /* same as above but adds a trailing slash */ /** * Blender's path code replacement function. -- cgit v1.2.3 From 09c2fd6f11eb00809678e869aec32f305e03ef02 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 18 Jan 2008 15:10:17 +0000 Subject: Linux only addition to know for sure the path of blender because sometimes the Play button doesn't work depending on how blender is started. This uses binreloc - http://autopackage.org/docs/binreloc/ it should also solve the problem of python scripts not being found. --- source/blender/blenlib/BLI_blenlib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/blenlib/BLI_blenlib.h') diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index eb13ddc318c..42b3bf2ce14 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -254,7 +254,7 @@ void BLI_free_file_lines(struct LinkNode *lines); * @param fullname The full path and full name of the executable * @param name The name of the executable (usually argv[0]) to be checked */ -void BLI_where_am_i(char *fullname, char *name); +void BLI_where_am_i(char *fullname, const char *name); /** * determines the full path to the application bundle on OS X @@ -297,7 +297,7 @@ int BLI_gzip(char *from, char *to); int BLI_delete(char *file, int dir, int recursive); int BLI_move(char *file, char *to); int BLI_touch(char *file); -char *BLI_last_slash(char *string); +char *BLI_last_slash(const char *string); /* BLI_rct.c */ /** -- cgit v1.2.3 From 88561ed669da880561ca323db52f9370287475c2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 20 Jan 2008 21:27:16 +0000 Subject: touch function that should also work on non unix os's, though I cant test here. --- source/blender/blenlib/BLI_blenlib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenlib/BLI_blenlib.h') diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index 42b3bf2ce14..e149c92c72b 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -296,7 +296,7 @@ int BLI_rename(char *from, char *to); int BLI_gzip(char *from, char *to); int BLI_delete(char *file, int dir, int recursive); int BLI_move(char *file, char *to); -int BLI_touch(char *file); +int BLI_touch(const char *file); char *BLI_last_slash(const char *string); /* BLI_rct.c */ -- cgit v1.2.3 From aa03132bc30369dc310fdcebe0bf1d94bab1114f Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 20 Jan 2008 23:53:13 +0000 Subject: [Coder API's]: Added a "generic unique name-finding function". Basically, this is based on the behaviour of the unique_constraint_name (or equivilant) functions, which have traditionally been duplicated everytime a new datatype needed this. Currently, this is in use for the following things: * Constraints * Action/Bone Groups * Local Action Markers / PoseLib poses Usage Notes: * The file in which this is to be used should include the standard header file . This defines the offsetof() macro, which should be used to find the relative location of the "name" member of the structs * This function is only designed for names of up to 128 chars in length (Most names are at most 32. TimeMarkers are 64). If a longer string needs to be handled, the function will need to be modified accordingly. * defname is the default name that should be used in case one hasn't been specified already --- source/blender/blenlib/BLI_blenlib.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/blenlib/BLI_blenlib.h') diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index e149c92c72b..fed513d3279 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -107,6 +107,7 @@ int BLI_findindex(struct ListBase *listbase, void *vlink); void BLI_freelistN(struct ListBase *listbase); void BLI_addtail(struct ListBase *listbase, void *vlink); void BLI_remlink(struct ListBase *listbase, void *vlink); +void BLI_uniquename(struct ListBase *list, void *vlink, char defname[], short name_offs, short len); void BLI_newname(char * name, int add); int BLI_stringdec(char *string, char *kop, char *start, unsigned short *numlen); void BLI_stringenc(char *string, char *kop, char *start, unsigned short numlen, int pic); -- cgit v1.2.3 From 643e29c7362305d37a3bbfc82e9654653ff4884a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 21 Jan 2008 22:10:20 +0000 Subject: added function BLI_filepathsize - so you dont have to open the file to get its size. made render Touch function remove the touched file if the animation is canceled. --- source/blender/blenlib/BLI_blenlib.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/blenlib/BLI_blenlib.h') diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index fed513d3279..4fc4241e6dc 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -272,6 +272,7 @@ int BLI_getInstallationDir(char *str); /* BLI_storage.h */ int BLI_filesize(int file); +int BLI_filepathsize(const char *path); double BLI_diskfree(char *dir); char *BLI_getwdN(char *dir); void BLI_hide_dot_files(int set); -- cgit v1.2.3 From bc9848f7e67c3e695403179f8bcdb78b0e5764a3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 13 Feb 2008 13:55:22 +0000 Subject: Added a global string to be used for the tempdir. since the user preference is not loaded in background mode and the user preference is not validated and has no fallback. 'btempdir' is set with BLI_where_is_temp() - This tries to use U.tempdir but falls back to $TEMP or /tmp/ --- source/blender/blenlib/BLI_blenlib.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'source/blender/blenlib/BLI_blenlib.h') diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index 4fc4241e6dc..39b679144d5 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -70,7 +70,6 @@ #include "DNA_listBase.h" #include - extern ListBase fillfacebase; extern ListBase fillvertbase; /** @@ -79,6 +78,8 @@ extern ListBase fillvertbase; extern ListBase filledgebase; extern int totblock; +extern char btempdir[]; /* creator.c temp dir used instead of U.tempdir, set with BLI_where_is_temp( btempdir, 1 ); */ + struct chardesc; struct direntry; struct rctf; @@ -257,6 +258,17 @@ void BLI_free_file_lines(struct LinkNode *lines); */ void BLI_where_am_i(char *fullname, const char *name); + /** + * Gets the temp directory when blender first runs. + * If the default path is not found, use try $TEMP + * + * Also make sure the temp dir has a trailing slash + * + * @param fullname The full path to the temp directory + */ +void BLI_where_is_temp(char *fullname, int usertemp); + + /** * determines the full path to the application bundle on OS X * @@ -300,6 +312,7 @@ int BLI_delete(char *file, int dir, int recursive); int BLI_move(char *file, char *to); int BLI_touch(const char *file); char *BLI_last_slash(const char *string); +void BLI_add_slash(char *string); /* BLI_rct.c */ /** -- cgit v1.2.3 From b226eb925b7306486e55998c790a3376c177bbef Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 27 Feb 2008 09:48:43 +0000 Subject: should fix bug on win32 with user python menu's not loading because stat() didnt like the trailing slash and returned the dir as missing. --- source/blender/blenlib/BLI_blenlib.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/blenlib/BLI_blenlib.h') diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index 39b679144d5..551b6732333 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -313,6 +313,7 @@ int BLI_move(char *file, char *to); int BLI_touch(const char *file); char *BLI_last_slash(const char *string); void BLI_add_slash(char *string); +void BLI_del_slash(char *string); /* BLI_rct.c */ /** -- cgit v1.2.3 From 08f306c81cb8015db59fe63ad1ef2c977751652e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 6 Mar 2008 21:25:15 +0000 Subject: Made python scripts save and load in the blend file so you can have the same scripts running when you open a blend file. Also scripts will re-run on undo rather then closing. This is done by saving and loading the name of the script or textblock of the 'Script' datablock, connected to the ScriptSpace. This way when there is a name but the script dosnt run. Blender runs the script or text block if available. --- source/blender/blenlib/BLI_blenlib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenlib/BLI_blenlib.h') diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index 551b6732333..e8c73398635 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -98,7 +98,7 @@ char *BLI_gethome(void); void BLI_make_file_string(const char *relabase, char *string, const char *dir, const char *file); void BLI_make_exist(char *dir); void BLI_make_existing_file(char *name); -void BLI_split_dirfile(const char *string, char *dir, char *file); +void BLI_split_dirfile(char *string, char *dir, char *file); void BLI_join_dirfile(char *string, const char *dir, const char *file); int BLI_testextensie(const char *str, const char *ext); void addlisttolist(ListBase *list1, ListBase *list2); -- cgit v1.2.3