Skip to content

Commit 3b260d7

Browse files
committed
Fix object detector and tracker effects when using context menus, color pickers, and other property dialog editors - to correctly update the JSON without destroying certain data or "objects"
1 parent bb85b5b commit 3b260d7

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/windows/models/properties_model.py

+14-6
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,17 @@ def remove_keyframe(self, item):
285285
has_waveform = True
286286

287287
# Reduce # of clip properties we are saving (performance boost)
288-
clip_data = {property_key: clip_data[property_key]}
289-
if object_id:
290-
clip_data = {'objects': {object_id: clip_data}}
288+
if not object_id:
289+
clip_data = {property_key: clip_data.get(property_key)}
290+
else:
291+
# If objects dict detected - don't reduce the # of objects
292+
objects[object_id] = clip_data
293+
clip_data = {'objects': objects}
291294

292295
# Save changes
293296
if clip_updated:
294297
# Save
298+
c.data = clip_data
295299
c.save()
296300

297301
# Update waveforms (if needed)
@@ -411,13 +415,17 @@ def color_update(self, item, new_color, interpolation=-1, interpolation_details=
411415
})
412416

413417
# Reduce # of clip properties we are saving (performance boost)
414-
clip_data = {property_key: clip_data[property_key]}
415-
if object_id:
416-
clip_data = {'objects': {object_id: clip_data}}
418+
if not object_id:
419+
clip_data = {property_key: clip_data.get(property_key)}
420+
else:
421+
# If objects dict detected - don't reduce the # of objects
422+
objects[object_id] = clip_data
423+
clip_data = {'objects': objects}
417424

418425
# Save changes
419426
if clip_updated:
420427
# Save
428+
c.data = clip_data
421429
c.save()
422430

423431
# Update the preview

0 commit comments

Comments
 (0)