Skip to content

Added an example to dynamically alter the scene in each frame#376

Merged
IgorTatarnikov merged 6 commits intomainfrom
add-callback-example
Aug 20, 2024
Merged

Added an example to dynamically alter the scene in each frame#376
IgorTatarnikov merged 6 commits intomainfrom
add-callback-example

Conversation

@IgorTatarnikov
Copy link
Copy Markdown
Member

Before submitting a pull request (PR), please read the contributing guide.

Please fill out as much of this template as you can, but if you have any problems or questions, just leave a comment and we will help out :)

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?
See https://forum.image.sc/t/brainrender-animation-of-slices/100612

What does this PR do?
Adds a new flag to make_video to fix the camera to the perspective of the first frame. Otherwise, if the root mesh is sliced throughout the animation the perspective will shift as the centre of mass of the root volume shifts.

Passes the callback function to subsequent frames after the last frame.

Adds an example for how to use a callback function to dynamically alter the scene throughout the Animation.

How has this PR been tested?

All tests pass locally.

Is this a breaking change?

No, the new flag is optional and the default provides the previous behaviour.

Does this PR require an update to the documentation?

Yes, will come in subsequent PR.

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality (unit & integration)
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

@IgorTatarnikov IgorTatarnikov requested a review from a team August 20, 2024 10:48
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 20, 2024

Codecov Report

Attention: Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 86.62%. Comparing base (242dad8) to head (c0bd5e6).
Report is 1 commits behind head on main.

Files Patch % Lines
brainrender/video.py 20.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #376      +/-   ##
==========================================
- Coverage   88.06%   86.62%   -1.44%     
==========================================
  Files          27       27              
  Lines        1215     1219       +4     
==========================================
- Hits         1070     1056      -14     
- Misses        145      163      +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Member

@alessandrofelder alessandrofelder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, tiny comment about documenting arguments.

@IgorTatarnikov IgorTatarnikov merged commit 11d0d76 into main Aug 20, 2024
@IgorTatarnikov IgorTatarnikov deleted the add-callback-example branch August 20, 2024 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants