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.
This commit is contained in:
Campbell Barton 2009-06-09 18:21:48 +00:00
parent 8704629945
commit 8adb155e98
2 changed files with 11 additions and 5 deletions

@ -1,4 +1,3 @@
#!BPY
# flt_properties.py. For setting default OpenFLight ID property types
# Copyright (C) 2007 Blender Foundation
#

@ -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--;
}