added a generic find for the cr, uses regex

This commit is contained in:
Zachary Pavlov 2007-08-14 17:47:47 +00:00
parent bc62667675
commit f481109861

View File

@ -1,4 +1,5 @@
from direct.distributed import DoHierarchy
import re
#hack:
BAD_DO_ID = BAD_ZONE_ID = 0 # 0xFFFFFFFF
@ -66,6 +67,17 @@ class DoCollectionManager:
matches.append(value)
return matches
def doFindAllMatching(self, str):
"""
Returns list of distributed objects with matching str in value.
"""
matches = []
for value in self.doId2do.values():
if re.search(str,`value`):
matches.append(value)
return matches
def _getDistanceFromLA(self, do):
if hasattr(do, 'getPos'):
return do.getPos(localAvatar).length()