mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
feat: add flag to disable rendering for mobjects
Similar to https://github.com/ManimCommunity/manim/pull/2172 for cairo renderer. Mobjects flagged with `should_render=False` will not be rendered.
This commit is contained in:
parent
21cf9998cc
commit
c7692c98ea
2 changed files with 3 additions and 0 deletions
|
|
@ -111,6 +111,7 @@ class Mobject:
|
|||
dim: int = 3,
|
||||
target: Mobject | None = None,
|
||||
z_index: float = 0,
|
||||
should_render: bool = True,
|
||||
):
|
||||
self.name = self.__class__.__name__ if name is None else name
|
||||
self.dim = dim
|
||||
|
|
@ -121,6 +122,7 @@ class Mobject:
|
|||
self.updaters: list[_Updater] = []
|
||||
self.updating_suspended = False
|
||||
self.color = ManimColor.parse(color)
|
||||
self.should_render = should_render
|
||||
|
||||
self.reset_points()
|
||||
self.generate_points()
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ class CairoRenderer:
|
|||
self.camera.reset()
|
||||
|
||||
kwargs["include_submobjects"] = include_submobjects
|
||||
kwargs["excluded_mobjects"] = [mob for mob in mobjects if not mob.should_render]
|
||||
self.camera.capture_mobjects(mobjects, **kwargs)
|
||||
|
||||
def render(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue