mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
Remove container
This commit is contained in:
parent
148afc29aa
commit
afebc29440
3 changed files with 6 additions and 26 deletions
|
@ -1,20 +0,0 @@
|
|||
from manimlib.utils.config_ops import digest_config
|
||||
|
||||
# Currently, this is only used by both Scene and Mobject.
|
||||
# Still, we abstract its functionality here, albeit purely nominally.
|
||||
# All actual implementation has to be handled by derived classes for now.
|
||||
|
||||
# TODO: Move the "remove" functionality of Scene to this class
|
||||
|
||||
|
||||
class Container(object):
|
||||
def __init__(self, **kwargs):
|
||||
digest_config(self, kwargs)
|
||||
|
||||
def add(self, *items):
|
||||
raise Exception(
|
||||
"Container.add is not implemented; it is up to derived classes to implement")
|
||||
|
||||
def remove(self, *items):
|
||||
raise Exception(
|
||||
"Container.remove is not implemented; it is up to derived classes to implement")
|
|
@ -9,9 +9,9 @@ import moderngl
|
|||
import numpy as np
|
||||
|
||||
from manimlib.constants import *
|
||||
from manimlib.container.container import Container
|
||||
from manimlib.utils.color import color_gradient
|
||||
from manimlib.utils.color import interpolate_color
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
from manimlib.utils.iterables import batch_by_property
|
||||
from manimlib.utils.iterables import list_update
|
||||
from manimlib.utils.bezier import interpolate
|
||||
|
@ -26,7 +26,7 @@ from manimlib.shader_wrapper import ShaderWrapper
|
|||
# TODO: Explain array_attrs
|
||||
# TODO: Incorporate shader defaults
|
||||
|
||||
class Mobject(Container):
|
||||
class Mobject(object):
|
||||
"""
|
||||
Mathematical Object
|
||||
"""
|
||||
|
@ -55,7 +55,7 @@ class Mobject(Container):
|
|||
}
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
Container.__init__(self, **kwargs)
|
||||
digest_config(self, kwargs)
|
||||
self.submobjects = []
|
||||
self.parents = []
|
||||
self.family = [self]
|
||||
|
|
|
@ -15,15 +15,15 @@ from manimlib.mobject.mobject import Point
|
|||
from manimlib.camera.camera import Camera
|
||||
from manimlib.config import get_custom_defaults
|
||||
from manimlib.constants import *
|
||||
from manimlib.container.container import Container
|
||||
from manimlib.mobject.mobject import Mobject
|
||||
from manimlib.scene.scene_file_writer import SceneFileWriter
|
||||
from manimlib.utils.config_ops import digest_config
|
||||
from manimlib.utils.family_ops import extract_mobject_family_members
|
||||
from manimlib.utils.family_ops import restructure_list_to_exclude_certain_family_members
|
||||
from manimlib.window import Window
|
||||
|
||||
|
||||
class Scene(Container):
|
||||
class Scene(object):
|
||||
CONFIG = {
|
||||
"window_config": {},
|
||||
"camera_class": Camera,
|
||||
|
@ -40,7 +40,7 @@ class Scene(Container):
|
|||
}
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
Container.__init__(self, **kwargs)
|
||||
digest_config(self, kwargs)
|
||||
if self.preview:
|
||||
self.window = Window(self, **self.window_config)
|
||||
self.camera_config["ctx"] = self.window.ctx
|
||||
|
|
Loading…
Add table
Reference in a new issue