@@ -219,57 +219,55 @@ def remove_keyframe(self, item):
219
219
# Get effect object
220
220
c = Effect .get (id = clip_id )
221
221
222
- if c :
223
- # Update clip attribute
224
- if property_key in c .data :
225
- log .info ("remove keyframe: %s" % c .data )
226
-
227
- # Determine type of keyframe (normal or color)
228
- keyframe_list = []
229
- if property_type == "color" :
230
- keyframe_list = [c .data [property_key ]["red" ], c .data [property_key ]["blue" ], c .data [property_key ]["green" ]]
231
- else :
232
- keyframe_list = [c .data [property_key ]]
222
+ if c and property_key in c .data : # Update clip attribute
223
+ log .info ("remove keyframe: %s" % c .data )
233
224
234
- # Loop through each keyframe (red, blue, and green)
235
- for keyframe in keyframe_list :
236
-
237
- # Keyframe
238
- # Loop through points, find a matching points on this frame
239
- closest_point = None
240
- point_to_delete = None
241
- for point in keyframe ["Points" ]:
242
- if point ["co" ]["X" ] == self .frame_number :
243
- # Found point, Update value
244
- clip_updated = True
245
- point_to_delete = point
246
- break
247
- if point ["co" ]["X" ] == closest_point_x :
248
- closest_point = point
225
+ # Determine type of keyframe (normal or color)
226
+ keyframe_list = []
227
+ if property_type == "color" :
228
+ keyframe_list = [c .data [property_key ]["red" ], c .data [property_key ]["blue" ], c .data [property_key ]["green" ]]
229
+ else :
230
+ keyframe_list = [c .data [property_key ]]
231
+
232
+ # Loop through each keyframe (red, blue, and green)
233
+ for keyframe in keyframe_list :
234
+
235
+ # Keyframe
236
+ # Loop through points, find a matching points on this frame
237
+ closest_point = None
238
+ point_to_delete = None
239
+ for point in keyframe ["Points" ]:
240
+ if point ["co" ]["X" ] == self .frame_number :
241
+ # Found point, Update value
242
+ clip_updated = True
243
+ point_to_delete = point
244
+ break
245
+ if point ["co" ]["X" ] == closest_point_x :
246
+ closest_point = point
249
247
250
- # If no point found, use closest point x
251
- if not point_to_delete :
252
- point_to_delete = closest_point
248
+ # If no point found, use closest point x
249
+ if not point_to_delete :
250
+ point_to_delete = closest_point
253
251
254
- # Delete point (if needed)
255
- if point_to_delete :
256
- clip_updated = True
257
- log .info ("Found point to delete at X=%s" % point_to_delete ["co" ]["X" ])
258
- keyframe ["Points" ].remove (point_to_delete )
252
+ # Delete point (if needed)
253
+ if point_to_delete :
254
+ clip_updated = True
255
+ log .info ("Found point to delete at X=%s" % point_to_delete ["co" ]["X" ])
256
+ keyframe ["Points" ].remove (point_to_delete )
259
257
260
- # Reduce # of clip properties we are saving (performance boost)
261
- c .data = {property_key : c .data [property_key ]}
258
+ # Reduce # of clip properties we are saving (performance boost)
259
+ c .data = {property_key : c .data [property_key ]}
262
260
263
- # Save changes
264
- if clip_updated :
265
- # Save
266
- c .save ()
261
+ # Save changes
262
+ if clip_updated :
263
+ # Save
264
+ c .save ()
267
265
268
- # Update the preview
269
- get_app ().window .refreshFrameSignal .emit ()
266
+ # Update the preview
267
+ get_app ().window .refreshFrameSignal .emit ()
270
268
271
- # Clear selection
272
- self .parent .clearSelection ()
269
+ # Clear selection
270
+ self .parent .clearSelection ()
273
271
274
272
def color_update (self , item , new_color , interpolation = - 1 , interpolation_details = []):
275
273
"""Insert/Update a color keyframe for the selected row"""
0 commit comments