|
|
|
|
@@ -814,7 +814,7 @@ class World:
|
|
|
|
|
return True
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
def interpolate_set(self, point_index=None, nr=None):
|
|
|
|
|
def interpolate_set(self, point_index=None, nr=None, refresh=False):
|
|
|
|
|
|
|
|
|
|
if point_index is None:
|
|
|
|
|
point_index = self.point_index
|
|
|
|
|
@@ -823,6 +823,11 @@ class World:
|
|
|
|
|
if not point_index in self.points_interpolation_required:
|
|
|
|
|
self.points_interpolation_required[point_index] = []
|
|
|
|
|
self.points_interpolation_required[point_index].append(nr)
|
|
|
|
|
if refresh:
|
|
|
|
|
# refresh all points
|
|
|
|
|
if point_index in self.points:
|
|
|
|
|
self.points_interpolation_required[point_index].extend(list(self.points[point_index].keys()))
|
|
|
|
|
|
|
|
|
|
if not self.interpolate_thread_alive():
|
|
|
|
|
print("ERROR: Interpolator thread is not running!")
|
|
|
|
|
self.interpolate_thread_start()
|
|
|
|
|
@@ -846,12 +851,6 @@ class World:
|
|
|
|
|
def point2array(p):
|
|
|
|
|
return [p["x0"], p["y0"], p["x1"], p["y1"]]
|
|
|
|
|
|
|
|
|
|
def tryadd(s, key, l):
|
|
|
|
|
try:
|
|
|
|
|
s.add(l[key])
|
|
|
|
|
except IndexError:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
if point_index in self.points_interpolation_required:
|
|
|
|
|
seed_keys = (
|
|
|
|
|
[x for x in self.points_interpolation_required[point_index]]
|
|
|
|
|
@@ -881,35 +880,23 @@ class World:
|
|
|
|
|
global_point_keys = list(sorted(list(self.points[point_index].keys())))
|
|
|
|
|
|
|
|
|
|
if len(seed_keys) > 0:
|
|
|
|
|
point_keys = set()
|
|
|
|
|
point_indexes = []
|
|
|
|
|
min_seed = min(seed_keys)
|
|
|
|
|
max_seed = max(seed_keys)
|
|
|
|
|
min_found = False
|
|
|
|
|
max_found = False
|
|
|
|
|
first_seed = None
|
|
|
|
|
for pi, nr in enumerate(global_point_keys):
|
|
|
|
|
if not min_found:
|
|
|
|
|
min_index = pi
|
|
|
|
|
if not max_found:
|
|
|
|
|
max_index = pi
|
|
|
|
|
if nr >= min_seed:
|
|
|
|
|
min_found = True
|
|
|
|
|
if nr <= max_seed:
|
|
|
|
|
tryadd(point_keys, pi, global_point_keys)
|
|
|
|
|
|
|
|
|
|
if nr >= min_seed and nr <= max_seed:
|
|
|
|
|
point_indexes.append(pi)
|
|
|
|
|
if nr > min_seed and first_seed is None:
|
|
|
|
|
first_seed = pi
|
|
|
|
|
point_indexes.append(pi)
|
|
|
|
|
if nr > max_seed:
|
|
|
|
|
max_found = True
|
|
|
|
|
break
|
|
|
|
|
if min_found:
|
|
|
|
|
for shift in range(-3, 0):
|
|
|
|
|
tryadd(point_keys, min_index + shift, global_point_keys)
|
|
|
|
|
if max_found:
|
|
|
|
|
for shift in range(2):
|
|
|
|
|
tryadd(point_keys, max_index + shift, global_point_keys)
|
|
|
|
|
else:
|
|
|
|
|
for shift in range(-3, -1):
|
|
|
|
|
tryadd(point_keys, len(global_point_keys) + shift, global_point_keys)
|
|
|
|
|
|
|
|
|
|
point_keys = list(sorted(list(point_keys)))
|
|
|
|
|
if len(point_indexes) == 0:
|
|
|
|
|
point_indexes.append(pi)
|
|
|
|
|
min_index = max(0, min(point_indexes) - 3)
|
|
|
|
|
max_index = min(len(global_point_keys) - 1, max(point_indexes) + 3)
|
|
|
|
|
point_keys = [global_point_keys[pi] for pi in range(min_index, max_index + 1)]
|
|
|
|
|
else:
|
|
|
|
|
point_keys = global_point_keys
|
|
|
|
|
|
|
|
|
|
@@ -954,10 +941,10 @@ class World:
|
|
|
|
|
new_points[key]["age"] = age
|
|
|
|
|
|
|
|
|
|
self.points_interpolated[point_index] = new_points
|
|
|
|
|
if point_index in self.points_interpolation_required:
|
|
|
|
|
self.points_interpolation_required[point_index] = [
|
|
|
|
|
x for x in self.points_interpolation_required[point_index] if x not in seed_keys
|
|
|
|
|
]
|
|
|
|
|
if point_index in self.points_interpolation_required:
|
|
|
|
|
self.points_interpolation_required[point_index] = [
|
|
|
|
|
x for x in self.points_interpolation_required[point_index] if x not in seed_keys
|
|
|
|
|
]
|
|
|
|
|
except Exception as e:
|
|
|
|
|
print(f"Interpolation error: {e}")
|
|
|
|
|
|
|
|
|
|
@@ -988,7 +975,7 @@ class World:
|
|
|
|
|
|
|
|
|
|
def interpolate_points_in_thread(self):
|
|
|
|
|
|
|
|
|
|
self.points_interpolation_frequency = 1
|
|
|
|
|
self.points_interpolation_frequency = 0.5
|
|
|
|
|
|
|
|
|
|
while True:
|
|
|
|
|
if self.points_interpolation_thread_exit:
|
|
|
|
|
@@ -998,6 +985,8 @@ class World:
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
for point_index in self.points_interpolation_required:
|
|
|
|
|
if self.points_interpolation_thread_exit:
|
|
|
|
|
return
|
|
|
|
|
if self.get_interpolation_required(point_index):
|
|
|
|
|
self.interpolate_points(point_index)
|
|
|
|
|
|
|
|
|
|
@@ -1249,7 +1238,7 @@ class World:
|
|
|
|
|
)
|
|
|
|
|
if not self.points[index][key].get("visible", "NA") in POINT_VISIBILITY:
|
|
|
|
|
self.points[index][key]["visible"] = POINT_VISIBILITY[0]
|
|
|
|
|
self.interpolate_set(index, key)
|
|
|
|
|
self.interpolate_set(index, refresh=True)
|
|
|
|
|
print(f"Loaded points with index: {index}")
|
|
|
|
|
self.point_index = None
|
|
|
|
|
|
|
|
|
|
@@ -1561,6 +1550,7 @@ class World:
|
|
|
|
|
self.point_click = 0
|
|
|
|
|
else:
|
|
|
|
|
self.point_index = chr(k2)
|
|
|
|
|
self.interpolate_set(refresh=True)
|
|
|
|
|
elif k & 0xFF == ord("g"): # Go to
|
|
|
|
|
self.shadow_text(
|
|
|
|
|
frame_visu,
|
|
|
|
|
|