@@ -195,11 +195,11 @@ def remove_keyframe(self, item):
195
195
if not c :
196
196
return
197
197
198
- # Create reference
198
+ # Create reference
199
199
clip_data = c .data
200
200
if object_id :
201
201
clip_data = c .data .get ('objects' ).get (object_id )
202
-
202
+
203
203
if property_key in clip_data : # Update clip attribute
204
204
log_id = "{}/{}" .format (clip_id , object_id ) if object_id else clip_id
205
205
log .debug ("%s: remove %s keyframe. %s" , log_id , property_key , clip_data .get (property_key ))
@@ -281,7 +281,7 @@ def color_update(self, item, new_color, interpolation=-1, interpolation_details=
281
281
c = Effect .get (id = clip_id )
282
282
283
283
if c :
284
- # Create reference
284
+ # Create reference
285
285
clip_data = c .data
286
286
if object_id :
287
287
clip_data = c .data .get ('objects' ).get (object_id )
@@ -301,7 +301,7 @@ def color_update(self, item, new_color, interpolation=-1, interpolation_details=
301
301
# Keyframe
302
302
# Loop through points, find a matching points on this frame
303
303
found_point = False
304
- for point in clip_data [property_key ][color ][ "Points" ] :
304
+ for point in clip_data [property_key ][color ]. get ( "Points" , []) :
305
305
log .debug ("looping points: co.X = %s" % point ["co" ]["X" ])
306
306
if interpolation == - 1 and point ["co" ]["X" ] == self .frame_number :
307
307
# Found point, Update value
@@ -348,7 +348,7 @@ def color_update(self, item, new_color, interpolation=-1, interpolation_details=
348
348
if not found_point :
349
349
clip_updated = True
350
350
log .debug ("Created new point at X=%d" , self .frame_number )
351
- clip_data [property_key ][color ][ "Points" ] .append ({
351
+ clip_data [property_key ][color ]. setdefault ( "Points" , []) .append ({
352
352
'co' : {'X' : self .frame_number , 'Y' : new_value },
353
353
'interpolation' : 1 ,
354
354
})
@@ -357,7 +357,7 @@ def color_update(self, item, new_color, interpolation=-1, interpolation_details=
357
357
clip_data = {property_key : clip_data [property_key ]}
358
358
if object_id :
359
359
clip_data = {'objects' : {object_id : clip_data }}
360
-
360
+
361
361
# Save changes
362
362
if clip_updated :
363
363
# Save
@@ -430,8 +430,8 @@ def value_updated(self, item, interpolation=-1, value=None, interpolation_detail
430
430
c = Effect .get (id = clip_id )
431
431
432
432
if c :
433
-
434
- # Create reference
433
+
434
+ # Create reference
435
435
clip_data = c .data
436
436
if object_id :
437
437
clip_data = c .data .get ('objects' ).get (object_id )
@@ -447,7 +447,7 @@ def value_updated(self, item, interpolation=-1, value=None, interpolation_detail
447
447
# Loop through points, find a matching points on this frame
448
448
found_point = False
449
449
point_to_delete = None
450
- for point in clip_data [property_key ][ " Points" ] :
450
+ for point in clip_data [property_key ]. get ( ' Points' , []) :
451
451
log .debug ("looping points: co.X = %s" % point ["co" ]["X" ])
452
452
if interpolation == - 1 and point ["co" ]["X" ] == self .frame_number :
453
453
# Found point, Update value
@@ -503,7 +503,7 @@ def value_updated(self, item, interpolation=-1, value=None, interpolation_detail
503
503
elif not found_point and new_value is not None :
504
504
clip_updated = True
505
505
log .debug ("Created new point at X=%d" , self .frame_number )
506
- clip_data [property_key ][ " Points" ] .append ({
506
+ clip_data [property_key ]. setdefault ( ' Points' , []) .append ({
507
507
'co' : {'X' : self .frame_number , 'Y' : new_value },
508
508
'interpolation' : 1 })
509
509
0 commit comments