Skip to content

Commit 1a89ef0

Browse files
Apply suggestions from code review
Thanks @ferdync Co-authored-by: Frank Dana <[email protected]>
1 parent 2390092 commit 1a89ef0

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/windows/models/properties_model.py

+16-8
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,8 @@ def remove_keyframe(self, item):
200200
clip_data = c.data.get('objects').get(object_id)
201201

202202
if property_key in clip_data: # Update clip attribute
203-
log.debug("remove keyframe: %s" % clip_data)
203+
log_id = f"{clip_id}/{object_id}" if object_id else clip_id
204+
log.debug("%s: remove %s keyframe. %s", log_id, property_key, clip_data.get(property_key))
204205

205206
# Determine type of keyframe (normal or color)
206207
keyframe_list = []
@@ -238,7 +239,9 @@ def remove_keyframe(self, item):
238239
# Reduce # of clip properties we are saving (performance boost)
239240
clip_data = {property_key: clip_data[property_key]}
240241
if object_id:
241-
clip_data = {'objects': {object_id: clip_data}}
242+
c.data = {'objects': {object_id: clip_data}}
243+
else:
244+
c.data = clip_data
242245

243246
# Save changes
244247
if clip_updated:
@@ -286,7 +289,8 @@ def color_update(self, item, new_color, interpolation=-1, interpolation_details=
286289

287290
# Update clip attribute
288291
if property_key in clip_data:
289-
log.debug("color update: %s" % clip_data)
292+
log_id = f"{clip_id}/{object_id}" if object_id else clip_id
293+
log.debug("%s: update color property %s. %s", log_id, property_key, clip_data.get(property_key))
290294

291295
# Loop through each keyframe (red, blue, and green)
292296
for color, new_value in [
@@ -353,7 +357,9 @@ def color_update(self, item, new_color, interpolation=-1, interpolation_details=
353357
# Reduce # of clip properties we are saving (performance boost)
354358
clip_data = {property_key: clip_data[property_key]}
355359
if object_id:
356-
clip_data = {'objects': {object_id: clip_data}}
360+
c.data = {'objects': {object_id: clip_data}}
361+
else:
362+
c.data = clip_data
357363

358364
# Save changes
359365
if clip_updated:
@@ -435,7 +441,8 @@ def value_updated(self, item, interpolation=-1, value=None, interpolation_detail
435441

436442
# Update clip attribute
437443
if property_key in clip_data:
438-
log.debug("value updated: %s" % clip_data)
444+
log_id = f"{clip_id}/{object_id}" if object_id else clip_id
445+
log.debug("%s: update property %s. %s", log_id, property_key, clip_data.get(property_key))
439446

440447
# Check the type of property (some are keyframe, and some are not)
441448
if property_type != "reader" and type(clip_data[property_key]) == dict:
@@ -554,9 +561,10 @@ def value_updated(self, item, interpolation=-1, value=None, interpolation_detail
554561

555562
# Reduce # of clip properties we are saving (performance boost)
556563
clip_data = {property_key: clip_data.get(property_key)}
557-
558564
if object_id:
559-
clip_data = {'objects': {object_id: clip_data}}
565+
c.data = {'objects': {object_id: clip_data}}
566+
else:
567+
c.data = clip_data
560568

561569
# Save changes
562570
if clip_updated:
@@ -837,7 +845,7 @@ def update_model(self, filter=""):
837845
for property in all_properties.items():
838846
self.add_property(property, filter, c, item_type)
839847

840-
# Insert objects properties from custom effetcs
848+
# Insert objects properties from custom effects
841849
if objects_raw_properties:
842850
for obj_id in objects_raw_properties:
843851
objects_all_properties = OrderedDict(sorted(objects_raw_properties[obj_id].items(), key=lambda x: x[1]['name']))

0 commit comments

Comments
 (0)