Skip to content

Commit

Permalink
fix: storyboard add_new_entry() might return None, handle it with ass…
Browse files Browse the repository at this point in the history
…uring that it never really happens
  • Loading branch information
vasarhelyi committed Aug 29, 2023
1 parent 771de9f commit 1fe47d9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/modules/sbstudio/plugin/model/storyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def add_new_entry(
formation: Optional[Collection] = None,
select: bool = False,
context: Optional[Context] = None,
) -> StoryboardEntry:
) -> Optional[StoryboardEntry]:
"""Appends a new entry to the end of the storyboard.
Parameters:
Expand All @@ -365,6 +365,9 @@ def add_new_entry(
default
formation: the formation that the newly added entry should refer to
select: whether to select the newly added entry after it was created
Returns:
the new entry created or None if it cannot be found after creation
"""
if name is None:
if formation is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def execute_on_formation(self, formation, context):
entry = storyboard.add_new_entry(
name=formation.name, select=True, formation=formation
)
assert entry is not None

fps = context.scene.render.fps

Expand Down
1 change: 1 addition & 0 deletions src/modules/sbstudio/plugin/operators/land.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def _run(self, storyboard, *, context) -> bool:
select=True,
context=context,
)
assert entry is not None
entry.transition_type = "MANUAL"

# Set up the custom departure delays for the drones
Expand Down
1 change: 1 addition & 0 deletions src/modules/sbstudio/plugin/operators/takeoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def _run(self, storyboard: Storyboard, *, context) -> bool:
select=True,
context=context,
)
assert entry is not None
entry.transition_type = "MANUAL"

# Set up the custom departure delays for the drones
Expand Down

0 comments on commit 1fe47d9

Please sign in to comment.