mirror of
https://github.com/jeertmans/manim-slides.git
synced 2025-06-17 10:22:50 +08:00
feat(lib): allow to insert external videos as slides (#526)
* feat(lib): allow to insert external videos as slides See https://github.com/jeertmans/manim-slides/discussions/520 * chore(lib): lint and changelog entry * chore: fix PR # fix * fix: docs
This commit is contained in:
@ -305,7 +305,7 @@ class BaseSlide:
|
||||
:param skip_animations:
|
||||
Exclude the next slide from the output.
|
||||
|
||||
If `manim` is used, this is also passed to `:meth:`Scene.next_section<manim.scene.scene.Scene.next_section>`,
|
||||
If `manim` is used, this is also passed to :meth:`Scene.next_section<manim.scene.scene.Scene.next_section>`,
|
||||
which will avoid rendering the corresponding animations.
|
||||
|
||||
.. seealso::
|
||||
@ -348,6 +348,11 @@ class BaseSlide:
|
||||
``manim-slides convert --to=pptx``.
|
||||
:param dedent_notes:
|
||||
If set, apply :func:`textwrap.dedent` to notes.
|
||||
:param pathlib.Path src:
|
||||
An optional path to a video file to include as next slide.
|
||||
|
||||
The video will be copied into the output folder, but no rescaling
|
||||
is applied.
|
||||
:param kwargs:
|
||||
Keyword arguments passed to
|
||||
:meth:`Scene.next_section<manim.scene.scene.Scene.next_section>`,
|
||||
@ -471,6 +476,18 @@ class BaseSlide:
|
||||
|
||||
self._current_slide += 1
|
||||
|
||||
if base_slide_config.src is not None:
|
||||
self._slides.append(
|
||||
PreSlideConfig.from_base_slide_config_and_animation_indices(
|
||||
base_slide_config,
|
||||
self._current_animation,
|
||||
self._current_animation,
|
||||
)
|
||||
)
|
||||
|
||||
base_slide_config = BaseSlideConfig() # default
|
||||
self._current_slide += 1
|
||||
|
||||
if self._skip_animations:
|
||||
base_slide_config.skip_animations = True
|
||||
|
||||
@ -493,7 +510,7 @@ class BaseSlide:
|
||||
)
|
||||
)
|
||||
|
||||
def _save_slides(
|
||||
def _save_slides( # noqa: C901
|
||||
self,
|
||||
use_cache: bool = True,
|
||||
flush_cache: bool = False,
|
||||
@ -540,7 +557,10 @@ class BaseSlide:
|
||||
):
|
||||
if pre_slide_config.skip_animations:
|
||||
continue
|
||||
slide_files = files[pre_slide_config.slides_slice]
|
||||
if pre_slide_config.src:
|
||||
slide_files = [pre_slide_config.src]
|
||||
else:
|
||||
slide_files = files[pre_slide_config.slides_slice]
|
||||
|
||||
try:
|
||||
file = merge_basenames(slide_files)
|
||||
|
Reference in New Issue
Block a user