Browse Source

fix NearEvent: .map fail wen not stop at first

Bastien Sevajol 8 years ago
parent
commit
2b28cebfcb
1 changed files with 3 additions and 3 deletions
  1. 3 3
      intelligine/synergy/event/src/NearEvent.py

+ 3 - 3
intelligine/synergy/event/src/NearEvent.py View File

11
 
11
 
12
     # TODO: parameters en entre/sortie c pas bon ca
12
     # TODO: parameters en entre/sortie c pas bon ca
13
     def map(self, context, parameters, stop_at_first=False, filter=lambda near_object_id, context: True):
13
     def map(self, context, parameters, stop_at_first=False, filter=lambda near_object_id, context: True):
14
+        parameters[self._near_name] = []
14
         for near_object_id in parameters['objects_ids_near']:
15
         for near_object_id in parameters['objects_ids_near']:
15
             if self._near_map(near_object_id, context) and filter(near_object_id, context):
16
             if self._near_map(near_object_id, context) and filter(near_object_id, context):
16
-                if self._near_name not in parameters:
17
-                    parameters[self._near_name] = []
18
                 parameters[self._near_name].append(near_object_id)
17
                 parameters[self._near_name].append(near_object_id)
19
                 if stop_at_first:
18
                 if stop_at_first:
20
                     return
19
                     return
21
-        raise NearNothingFound()
20
+        if not parameters[self._near_name]:
21
+            raise NearNothingFound()