Skip to content

Commit da3cf6f

Browse files
[#1363] (Code style) Added keyframes of currently selected clips as markers for easy navigation
Popped duplicate code to function as suggested here : #1363 (comment)
1 parent 61aa4b0 commit da3cf6f

File tree

1 file changed

+16
-25
lines changed

1 file changed

+16
-25
lines changed

src/windows/main_window.py

+16-25
Original file line numberDiff line numberDiff line change
@@ -1248,18 +1248,7 @@ def actionPreviousMarker_trigger(self, event):
12481248
all_marker_positions.append(selected_clip.data["position"])
12491249
all_marker_positions.append(selected_clip.data["position"] + (selected_clip.data["end"] - selected_clip.data["start"]))
12501250
# add all keyframes. itterate on all properties of Data, look for each points
1251-
for property in selected_clip.data :
1252-
try :
1253-
for point in selected_clip.data[property]["Points"] :
1254-
log.info("point : %s", point)
1255-
keyframe=(point["co"]["X"]-1)/fps_float - selected_clip.data["start"] + selected_clip.data["position"]
1256-
if keyframe > start and keyframe < stop :
1257-
all_marker_positions.append(keyframe)
1258-
except TypeError:
1259-
log.info("%s : %s : not itterable", property, selected_clip.data[property])
1260-
pass- except KeyError:
1261-
log.info("%s : %s : has no points", property, selected_clip.data[property])
1262-
pass
1251+
addKeyframesToMarkers(selected_clip.data)
12631252

12641253
# Loop through selected transitions (and add key positions)
12651254
for tran_id in self.selected_transitions:
@@ -1314,19 +1303,7 @@ def actionNextMarker_trigger(self, event):
13141303
all_marker_positions.append(selected_clip.data["position"])
13151304
all_marker_positions.append(selected_clip.data["position"] + (selected_clip.data["end"] - selected_clip.data["start"]))
13161305
# add all keyframes. itterate on all properties of Data, look for each points
1317-
for property in selected_clip.data :
1318-
try :
1319-
for point in selected_clip.data[property]["Points"] :
1320-
keyframe=(point["co"]["X"]-1)/fps_float - selected_clip.data["start"] + selected_clip.data["position"]
1321-
if keyframe > start and keyframe < stop :
1322-
all_marker_positions.append(keyframe)
1323-
except TypeError:
1324-
log.info("%s : %s : not itterable", property, selected_clip.data[property])
1325-
pass
1326-
except KeyError:
1327-
log.info("%s : %s : has no points", property, selected_clip.data[property])
1328-
pass
1329-
1306+
addKeyframesToMarkers(selected_clip.data)
13301307
# Loop through selected transitions (and add key positions)
13311308
for tran_id in self.selected_transitions:
13321309
# Get selected object
@@ -1358,6 +1335,20 @@ def actionNextMarker_trigger(self, event):
13581335
get_app().window.refreshFrameSignal.emit()
13591336
get_app().window.propertyTableView.select_frame(frame_to_seek)
13601337

1338+
def addKeyframesToMarkers(self, data):
1339+
for property in data :
1340+
try :
1341+
for point in data[property]["Points"] :
1342+
keyframe=(point["co"]["X"]-1)/fps_float - data["start"] + data["position"]
1343+
if keyframe > start and keyframe < stop :
1344+
all_marker_positions.append(keyframe)
1345+
except TypeError:
1346+
log.info("%s : %s : not itterable", property, data[property])
1347+
pass
1348+
except KeyError:
1349+
log.info("%s : %s : has no points", property, data[property])
1350+
pass
1351+
13611352
def actionCenterOnPlayhead_trigger(self, event):
13621353
""" Center the timeline on the current playhead position """
13631354
self.timeline.centerOnPlayhead()

0 commit comments

Comments
 (0)