From 8adb155e98e9699117bb652f17d63f0837cefa05 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 9 Jun 2009 18:21:48 +0000 Subject: [PATCH] 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. --- release/scripts/flt_properties.py | 1 - source/blender/python/BPY_menus.c | 15 +++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/release/scripts/flt_properties.py b/release/scripts/flt_properties.py index 4c841e9c0c0..b9d93b5f52d 100644 --- a/release/scripts/flt_properties.py +++ b/release/scripts/flt_properties.py @@ -1,4 +1,3 @@ -#!BPY # flt_properties.py. For setting default OpenFLight ID property types # Copyright (C) 2007 Blender Foundation # 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--; }