diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-06-09 22:21:48 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-06-09 22:21:48 +0400 |
commit | 8adb155e98e9699117bb652f17d63f0837cefa05 (patch) | |
tree | 7f39679a57dc5fbd945236a8fc13f31ea8d04699 /source | |
parent | 8704629945c015ec0c34298c406402373c01efa4 (diff) |
Built in limitations for script scanning was making python fail on meta-androcto script pack.
If a total of 30 subdirs was hit, or 4 dirs deep was hit - script scanning would quit, skipping files in the root scripts path too.
To work around this the script pack included some of blenders scripts twice just so they would get into the menu but this is a dodgy workaround.
* dont stop scanning for scripts when limits are reached (just dont scan further).
* global 30 dir limit per scan is silly - removed.
* limit recursive depth is kept but keep scanning at lower depths.
* bumped recursive limit from 4 to 6
* flt_properties.py had #!BPY without a menu header.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/BPY_menus.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/python/BPY_menus.c b/source/blender/python/BPY_menus.c index 9e7abc44657..cdcdd8402bf 100644 --- a/source/blender/python/BPY_menus.c +++ b/source/blender/python/BPY_menus.c @@ -49,7 +49,7 @@ #include "api2_2x/EXPP_interface.h" /* for bpy_gethome() */ #define BPYMENU_DATAFILE "Bpymenus" -#define MAX_DIR_DEPTH 4 /* max depth for traversing scripts dirs */ +#define MAX_DIR_DEPTH 6 /* max depth for traversing scripts dirs */ #define MAX_DIR_NUMBER 30 /* max number of dirs in scripts dirs trees */ static int DEBUG; @@ -929,17 +929,20 @@ static int bpymenu_ParseDir(char *dirname, char *parentdir, int is_userdir ) else if (S_ISDIR(status.st_mode)) { /* is subdir */ Dirs_Number++; Dir_Depth++; +#if 0 // Limiting the total number of directories is too restrictive, only limit recursion should be enough if (Dirs_Number > MAX_DIR_NUMBER) { if (DEBUG) { - fprintf(stderr, "BPyMenus error: too many subdirs.\n"); + fprintf(stderr, "BPyMenus error: too many subdirs %s/%s.\n", dirname, de->d_name); } closedir(dir); return -1; } - else if (Dir_Depth > MAX_DIR_DEPTH) { + else +#endif + if (Dir_Depth > MAX_DIR_DEPTH) { if (DEBUG) fprintf(stderr, - "BPyMenus error: max depth reached traversing dir tree.\n"); + "BPyMenus error: max depth reached traversing dir tree %s/%s.\n", dirname, de->d_name); closedir(dir); return -1; } @@ -949,10 +952,14 @@ static int bpymenu_ParseDir(char *dirname, char *parentdir, int is_userdir ) BLI_join_dirfile(subdir, parentdir, de->d_name); s = subdir; } +#if 0 // to stop searching for scripts once the maxdir is hit is bad, just dont look further but keep going with other dirs. if (bpymenu_ParseDir(path, s, is_userdir) == -1) { closedir(dir); return -1; } +#else + bpymenu_ParseDir(path, s, is_userdir); +#endif Dir_Depth--; } |