[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20765] trunk/blender: Built in limitations for script scanning was making python fail on meta-androcto script pack .

Campbell Barton ideasman42 at gmail.com
Tue Jun 9 20:21:48 CEST 2009


Revision: 20765
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20765
Author:   campbellbarton
Date:     2009-06-09 20:21:48 +0200 (Tue, 09 Jun 2009)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/release/scripts/flt_properties.py
    trunk/blender/source/blender/python/BPY_menus.c

Modified: trunk/blender/release/scripts/flt_properties.py
===================================================================
--- trunk/blender/release/scripts/flt_properties.py	2009-06-09 18:08:45 UTC (rev 20764)
+++ trunk/blender/release/scripts/flt_properties.py	2009-06-09 18:21:48 UTC (rev 20765)
@@ -1,4 +1,3 @@
-#!BPY
 # flt_properties.py. For setting default OpenFLight ID property types
 # Copyright (C) 2007 Blender Foundation
 #

Modified: trunk/blender/source/blender/python/BPY_menus.c
===================================================================
--- trunk/blender/source/blender/python/BPY_menus.c	2009-06-09 18:08:45 UTC (rev 20764)
+++ trunk/blender/source/blender/python/BPY_menus.c	2009-06-09 18:21:48 UTC (rev 20765)
@@ -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 @@
 			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 @@
 					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--;
 			}
 





More information about the Bf-blender-cvs mailing list