interpolated age

This commit is contained in:
q
2025-08-07 22:03:18 +03:00
parent 37807f6d5e
commit 0b29f59cda

View File

@@ -417,7 +417,7 @@ class Marker:
} }
def get_interpolated_point(self, nr=None, index=None): def get_interpolated_point(self, nr=None, index=None):
"""{x0,y0,x1,y1, cx, cy, visible,type}""" """{x0,y0,x1,y1, cx, cy, visible, type, age}"""
if nr is None: if nr is None:
nr = self.nr nr = self.nr
if index is None: if index is None:
@@ -434,7 +434,7 @@ class Marker:
) )
return value return value
return {"x0": None, "y0": None, "x1": None, "y1": None, "cx": None, "cy": None, "visible": 0, "type": None} return {"x0": None, "y0": None, "x1": None, "y1": None, "cx": None, "cy": None, "visible": 0, "type": None, "age": None}
def modify_point(self, position, x, y): def modify_point(self, position, x, y):
"""position: tl topleft, br bottomright, c center""" """position: tl topleft, br bottomright, c center"""
@@ -623,8 +623,8 @@ class World:
post: after any keyframes post: after any keyframes
""" """
def i_point(x0=None, y0=None, x1=None, y1=None, t=None, visible=None): def i_point(x0=None, y0=None, x1=None, y1=None, t=None, visible=None, age=None):
return {"x0": x0, "y0": y0, "x1": x1, "y1": y1, "type": t, "visible": visible} return {"x0": x0, "y0": y0, "x1": x1, "y1": y1, "type": t, "visible": visible, "age"=age}
def point2array(p): def point2array(p):
@@ -683,6 +683,13 @@ class World:
# clicked points (not necessary, could determine at draw time!) # clicked points (not necessary, could determine at draw time!)
for key in point_keys: for key in point_keys:
self.points_interpolated[self.point_index][key]["type"] = "key" self.points_interpolated[self.point_index][key]["type"] = "key"
age=0
for key in self.points_interpolated[self.point_index]:
if self.points_interpolated[self.point_index][key]["type"] == "key":
age = 0
if self.points_interpolated[self.point_index][key]["type"] == "interp":
age += 1
self.points_interpolated[self.point_index][key]["type"] = age
def draw_help(self, frame): def draw_help(self, frame):