Selaa lähdekoodia

added a generic find for the cr, uses regex

Zachary Pavlov 18 vuotta sitten
vanhempi
sitoutus
f481109861
1 muutettua tiedostoa jossa 12 lisäystä ja 0 poistoa
  1. 12 0
      direct/src/distributed/DoCollectionManager.py

+ 12 - 0
direct/src/distributed/DoCollectionManager.py

@@ -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()