@@ -1231,25 +1231,31 @@ def actionAddMarker_trigger(self, event):
1231
1231
def findAllMarkerPositions (self ):
1232
1232
"""Build and return a list of all seekable locations for the currently-selected timeline elements"""
1233
1233
1234
- def getKeyframePositions ( data , clip_start_time , clip_stop_time , fps_float ):
1235
- """ Add all keyframes of a clip.data to all_marker_positions """
1234
+ def getTimelineObjectPositions ( obj ):
1235
+ """ Add boundaries & all keyframes of a timeline object ( clip, transition...) to all_marker_positions """
1236
1236
positions = []
1237
- for property in data :
1237
+
1238
+ fps = get_app ().project .get ("fps" )
1239
+ fps_float = float (fps ["num" ]) / float (fps ["den" ])
1240
+
1241
+ clip_start_time = obj .data ["position" ]
1242
+ clip_stop_time = obj .data ["position" ] + (obj .data ["end" ] - obj .data ["start" ])
1243
+
1244
+ # add clip boundaries
1245
+ all_marker_positions .append (clip_start_time )
1246
+ all_marker_positions .append (clip_stop_time )
1247
+
1248
+ # add all keyframes
1249
+ for property in obj .data :
1238
1250
try :
1239
- for point in data [property ]["Points" ] :
1240
- keyframe_time = (point ["co" ]["X" ]- 1 )/ fps_float - data ["start" ] + data ["position" ]
1251
+ for point in obj . data [property ]["Points" ] :
1252
+ keyframe_time = (point ["co" ]["X" ]- 1 )/ fps_float - obj . data ["start" ] + obj . data ["position" ]
1241
1253
if keyframe_time > clip_start_time and keyframe_time < clip_stop_time :
1242
1254
positions .append (keyframe_time )
1243
- except TypeError :
1244
- log .info ("%s : %s : not itterable" , property , data [property ])
1245
- pass
1246
- except KeyError :
1247
- log .info ("%s : %s : has no points" , property , data [property ])
1255
+ except (TypeError , KeyError ):
1248
1256
pass
1249
1257
return positions
1250
1258
1251
- fps = get_app ().project .get ("fps" )
1252
- fps_float = float (fps ["num" ]) / float (fps ["den" ])
1253
1259
all_marker_positions = []
1254
1260
1255
1261
# Get list of marker and important positions (like selected clip bounds)
@@ -1261,20 +1267,14 @@ def getKeyframePositions(data, clip_start_time, clip_stop_time, fps_float):
1261
1267
# Get selected object
1262
1268
selected_clip = Clip .get (id = clip_id )
1263
1269
if selected_clip :
1264
- clip_start_time = selected_clip .data ["position" ]
1265
- clip_stop_time = selected_clip .data ["position" ] + (selected_clip .data ["end" ] - selected_clip .data ["start" ])
1266
- all_marker_positions .append (clip_start_time )
1267
- all_marker_positions .append (clip_stop_time )
1268
- # add all keyframes
1269
- all_marker_positions .extend (getKeyframePositions (selected_clip .data , clip_start_time , clip_stop_time , fps_float ))
1270
+ all_marker_positions .extend (getTimelineObjectPositions (selected_clip ))
1270
1271
1271
1272
# Loop through selected transitions (and add key positions)
1272
1273
for tran_id in self .selected_transitions :
1273
1274
# Get selected object
1274
1275
selected_tran = Transition .get (id = tran_id )
1275
1276
if selected_tran :
1276
- all_marker_positions .append (selected_tran .data ["position" ])
1277
- all_marker_positions .append (selected_tran .data ["position" ] + (selected_tran .data ["end" ] - selected_tran .data ["start" ]))
1277
+ all_marker_positions .extend (getTimelineObjectPositions (selected_tran ))
1278
1278
1279
1279
# remove duplicates
1280
1280
all_marker_positions = list (set (all_marker_positions ))
0 commit comments