feat: color-code keyframe diamonds by crop mode
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -935,17 +935,45 @@ class TimelineWidget(QWidget):
|
|||||||
|
|
||||||
# ── crop keyframe diamonds ────────────────────────────────────
|
# ── crop keyframe diamonds ────────────────────────────────────
|
||||||
if self._crop_keyframes and self._duration > 0:
|
if self._crop_keyframes and self._duration > 0:
|
||||||
for (kt, _kc) in self._crop_keyframes:
|
_KF_GOLD = QColor(255, 180, 0)
|
||||||
|
_KF_RED = QColor(220, 60, 60)
|
||||||
|
_KF_BLUE = QColor(60, 180, 220)
|
||||||
|
for kf in self._crop_keyframes:
|
||||||
|
kt = kf[0]
|
||||||
|
rp = kf[3] if len(kf) > 3 else False
|
||||||
|
rs = kf[4] if len(kf) > 4 else False
|
||||||
kx = int(kt / self._duration * w)
|
kx = int(kt / self._duration * w)
|
||||||
d = 4 # half-size of diamond
|
d = 4 # half-size of diamond
|
||||||
ky = h - d - 2 # near bottom of track
|
ky = h - d - 2 # near bottom of track
|
||||||
diamond = QPolygon([
|
if rp and rs:
|
||||||
QPoint(kx, ky - d), QPoint(kx + d, ky),
|
# Split diamond: left half red, right half blue
|
||||||
QPoint(kx, ky + d), QPoint(kx - d, ky),
|
left = QPolygon([
|
||||||
])
|
QPoint(kx, ky - d), QPoint(kx, ky + d),
|
||||||
p.setBrush(QColor(255, 180, 0))
|
QPoint(kx - d, ky),
|
||||||
p.setPen(Qt.PenStyle.NoPen)
|
])
|
||||||
p.drawPolygon(diamond)
|
right = QPolygon([
|
||||||
|
QPoint(kx, ky - d), QPoint(kx + d, ky),
|
||||||
|
QPoint(kx, ky + d),
|
||||||
|
])
|
||||||
|
p.setPen(Qt.PenStyle.NoPen)
|
||||||
|
p.setBrush(_KF_RED)
|
||||||
|
p.drawPolygon(left)
|
||||||
|
p.setBrush(_KF_BLUE)
|
||||||
|
p.drawPolygon(right)
|
||||||
|
else:
|
||||||
|
diamond = QPolygon([
|
||||||
|
QPoint(kx, ky - d), QPoint(kx + d, ky),
|
||||||
|
QPoint(kx, ky + d), QPoint(kx - d, ky),
|
||||||
|
])
|
||||||
|
if rp:
|
||||||
|
color = _KF_RED
|
||||||
|
elif rs:
|
||||||
|
color = _KF_BLUE
|
||||||
|
else:
|
||||||
|
color = _KF_GOLD
|
||||||
|
p.setPen(Qt.PenStyle.NoPen)
|
||||||
|
p.setBrush(color)
|
||||||
|
p.drawPolygon(diamond)
|
||||||
|
|
||||||
# ── playhead ──────────────────────────────────────────────────
|
# ── playhead ──────────────────────────────────────────────────
|
||||||
p.setPen(self._cursor_pen)
|
p.setPen(self._cursor_pen)
|
||||||
@@ -1015,7 +1043,8 @@ class TimelineWidget(QWidget):
|
|||||||
w = self.width()
|
w = self.width()
|
||||||
# Check keyframe diamonds first.
|
# Check keyframe diamonds first.
|
||||||
hit_kf_time = None
|
hit_kf_time = None
|
||||||
for (kt, _kc) in self._crop_keyframes:
|
for kf in self._crop_keyframes:
|
||||||
|
kt = kf[0]
|
||||||
kx = kt / self._duration * w
|
kx = kt / self._duration * w
|
||||||
if abs(x - kx) <= 8:
|
if abs(x - kx) <= 8:
|
||||||
hit_kf_time = kt
|
hit_kf_time = kt
|
||||||
|
|||||||
Reference in New Issue
Block a user