Skip to content

Commit e638eaa

Browse files
committed
added change_default implementation to OpenGLMobject
1 parent b34766d commit e638eaa

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

manim/mobject/opengl_mobject.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import itertools as it
33
import random
44
import sys
5-
from functools import wraps
5+
from functools import partialmethod, wraps
66
from math import ceil
77
from typing import Iterable, Optional, Tuple, Union
88

@@ -121,6 +121,18 @@ def __init__(
121121
if self.depth_test:
122122
self.apply_depth_test()
123123

124+
@classmethod
125+
def __init_subclass__(cls, **kwargs):
126+
super().__init_subclass__(**kwargs)
127+
cls._original__init__ = cls.__init__
128+
129+
@classmethod
130+
def change_default(cls, **kwargs):
131+
if kwargs:
132+
cls.__init__ = partialmethod(cls.__init__, **kwargs)
133+
else:
134+
cls.__init__ = cls._original__init__
135+
124136
def __str__(self):
125137
return self.__class__.__name__
126138

0 commit comments

Comments
 (0)