[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28392] trunk/blender/source/blender: unix style outliner name wildcards *.*, Any.???, etc (using fnmatch), also removed last beos reference :)

Campbell Barton ideasman42 at gmail.com
Sat Apr 24 00:08:11 CEST 2010


Revision: 28392
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28392
Author:   campbellbarton
Date:     2010-04-24 00:08:11 +0200 (Sat, 24 Apr 2010)

Log Message:
-----------
unix style outliner name wildcards *.*, Any.???, etc (using fnmatch), also removed last beos reference :)

Modified Paths:
--------------
    trunk/blender/source/blender/blenfont/BLF_api.h
    trunk/blender/source/blender/blenlib/BLI_fnmatch.h
    trunk/blender/source/blender/editors/space_file/filesel.c
    trunk/blender/source/blender/editors/space_outliner/outliner.c

Modified: trunk/blender/source/blender/blenfont/BLF_api.h
===================================================================
--- trunk/blender/source/blender/blenfont/BLF_api.h	2010-04-23 20:05:16 UTC (rev 28391)
+++ trunk/blender/source/blender/blenfont/BLF_api.h	2010-04-23 22:08:11 UTC (rev 28392)
@@ -104,6 +104,7 @@
  */
 void BLF_rotation(int fontid, float angle);
 void BLF_clipping(int fontid, float xmin, float ymin, float xmax, float ymax);
+void BLF_clipping_default(float xmin, float ymin, float xmax, float ymax);
 void BLF_blur(int fontid, int size);
 
 void BLF_enable(int fontid, int option);

Modified: trunk/blender/source/blender/blenlib/BLI_fnmatch.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_fnmatch.h	2010-04-23 20:05:16 UTC (rev 28391)
+++ trunk/blender/source/blender/blenlib/BLI_fnmatch.h	2010-04-23 22:08:11 UTC (rev 28392)
@@ -47,7 +47,7 @@
 #define	FNM_PATHNAME	(1 << 0) /* No wildcard can ever match `/'.  */
 #define	FNM_NOESCAPE	(1 << 1) /* Backslashes don't quote special chars.  */
 #define	FNM_PERIOD	(1 << 2) /* Leading `.' is matched only explicitly.  */
-
+	
 #if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE)
 #define	FNM_FILE_NAME	FNM_PATHNAME /* Preferred GNU name.  */
 #define	FNM_LEADING_DIR	(1 << 3) /* Ignore `/...' after a match.  */

Modified: trunk/blender/source/blender/editors/space_file/filesel.c
===================================================================
--- trunk/blender/source/blender/editors/space_file/filesel.c	2010-04-23 20:05:16 UTC (rev 28391)
+++ trunk/blender/source/blender/editors/space_file/filesel.c	2010-04-23 22:08:11 UTC (rev 28392)
@@ -77,16 +77,10 @@
 #include "file_intern.h"
 #include "filelist.h"
 
-#if defined __BeOS
-static int fnmatch(const char *pattern, const char *string, int flags)
-{
-	return 0;
-}
-#elif defined WIN32 && !defined _LIBC
-	/* use fnmatch included in blenlib */
-	#include "BLI_fnmatch.h"
+#if defined WIN32 && !defined _LIBC
+# include "BLI_fnmatch.h" /* use fnmatch included in blenlib */
 #else
-	#include <fnmatch.h>
+# include <fnmatch.h>
 #endif
 
 FileSelectParams* ED_fileselect_get_params(struct SpaceFile *sfile)

Modified: trunk/blender/source/blender/editors/space_outliner/outliner.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner.c	2010-04-23 20:05:16 UTC (rev 28391)
+++ trunk/blender/source/blender/editors/space_outliner/outliner.c	2010-04-23 22:08:11 UTC (rev 28392)
@@ -50,6 +50,13 @@
 
 #include "BLI_blenlib.h"
 
+#if defined WIN32 && !defined _LIBC
+# include "BLI_fnmatch.h" /* use fnmatch included in blenlib */
+#else
+# define _GNU_SOURCE
+# include <fnmatch.h>
+#endif
+
 #include "IMB_imbuf_types.h"
 
 #include "BKE_animsys.h"
@@ -1237,6 +1244,7 @@
 
 static int outliner_filter_has_name(TreeElement *te, char *name, int flags)
 {
+#if 0
 	int found= 0;
 	
 	/* determine if match */
@@ -1252,8 +1260,24 @@
 		else
 			found= BLI_strcasestr(te->name, name) != NULL;
 	}
+#else
 	
+	int fn_flag= 0;
+	int found= 0;
+	
+	if(flags & SO_FIND_CASE_SENSITIVE)
+		fn_flag |= FNM_CASEFOLD;
+
+	if(flags & SO_FIND_COMPLETE) {
+		found= fnmatch(name, te->name, fn_flag)==0;
+	}
+	else {
+		char fn_name[sizeof(((struct SpaceOops *)NULL)->search_string) + 2];
+		sprintf(fn_name, "*%s*", name);
+		found= fnmatch(fn_name, te->name, fn_flag)==0;
+	}
 	return found;
+#endif
 }
 
 static int outliner_filter_tree(SpaceOops *soops, ListBase *lb)





More information about the Bf-blender-cvs mailing list