- based on a request by Campbell (he also provided a patch for scene.Layer) access to layers was improved a little, keeping the old method (ob.Layers is a bitmask) and adding the nicer one (ob.layers is a list of ints).  Done for objects and scenes.  House-cleaning: .Layer was renamed to .Layers (actually just using strncmp instead of strcmp, so both work, same done for Window.ViewLayers).
- finally committing patch by Ken Hughes to let .clearScriptLinks() accept a parameter (list of strings) to clear only specified texts.
- doc updates and fixes (JMS reported a problem in nmesh.transform() example code).

Thanks all who contributed.
This commit is contained in:
2005-04-21 19:44:52 +00:00
parent c5214c1571
commit 589ce4a005
24 changed files with 657 additions and 347 deletions

View File

@@ -43,7 +43,7 @@ from Blender import Registry, sys as bsys
_EXT = '.cfg' # file extension for saved config data
# limits:
MAX_ITEMS_NUM = 50 # max number of keys per dict and itens per list and tuple
MAX_ITEMS_NUM = 60 # max number of keys per dict and itens per list and tuple
MAX_STR_LEN = 300 # max string length (remember this is just for config data)
_CFG_DIR = ''
@@ -61,10 +61,12 @@ if bsys.dirsep == '\\':
_KEYS = [k for k in Registry.Keys() if k[0] != '_']
_ITEMS_NUM = 0
def _sanitize(o):
"Check recursively that all objects are valid, set invalid ones to None"
global MAX_ITEMS_NUM, MAX_STR_LEN
global MAX_ITEMS_NUM, MAX_STR_LEN, _ITEMS_NUM
valid_types = [int, float, bool, long, type]
valid_checked_types = [str, unicode]
@@ -75,12 +77,16 @@ def _sanitize(o):
if t == dict:
keys = o.keys()
if len(keys) > MAX_ITEMS_NUM:
len_keys = len(keys)
_ITEMS_NUM += len_keys
if _ITEMS_NUM > MAX_ITEMS_NUM:
return None
for k in keys:
o[k] = _sanitize(o[k])
elif t in [list, tuple]:
if len(o) > MAX_ITEMS_NUM:
len_seq = len(o)
_ITEMS_NUM += len_seq
if _ITEMS_NUM > MAX_ITEMS_NUM:
return None
result = []
for i in o: result.append(_sanitize(i))