Skip to content

Commit

Permalink
Protecting from missing attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
BrennoCaldato committed Mar 16, 2021
1 parent e10f970 commit ea93464
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/windows/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -2285,7 +2285,7 @@ def addSelection(self, item_id, item_type, clear_existing=False):

effect = Effect.get(id=item_id)
if effect:
if effect.data["has_tracked_object"]:
if effect.data.get("has_tracked_object"):
# Show bounding boxes transform on preview
clip_id = effect.parent['id']
self.KeyFrameTransformSignal.emit(item_id, clip_id)
Expand All @@ -2296,8 +2296,6 @@ def addSelection(self, item_id, item_type, clear_existing=False):
self.show_property_type = item_type
self.show_property_timer.start()



# Remove from the selected items
def removeSelection(self, item_id, item_type):
# Remove existing selection (if any)
Expand Down
2 changes: 1 addition & 1 deletion src/windows/views/properties_tableview.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ def contextMenuEvent(self, event):
tracked_objects = []
for effect in clip_instance_data["effects"]:
# Check if effect has a tracked object
if effect["has_tracked_object"]:
if effect.get("has_tracked_object"):
# Instantiate the effect
effect_instance = timeline_instance.GetClipEffect(effect["id"])
# Get the visible object's ids
Expand Down
4 changes: 2 additions & 2 deletions src/windows/views/webview.py
Original file line number Diff line number Diff line change
Expand Up @@ -3027,11 +3027,11 @@ def callback(self, effect_names, callback_data):

# Get Effect JSON
effect.Id(get_app().project.generate_id())

effect_json = json.loads(effect.Json())

# Generate box_id for the TrackedObjectBBox object
if effect_json["has_tracked_object"]:
if effect_json.get("has_tracked_object"):
for object_id_index in range(len(effect_json["objects_id"])):
boxId = get_app().project.generate_id()
effect_json["objects_id"][object_id_index] = boxId
Expand Down

0 comments on commit ea93464

Please sign in to comment.