mirror of
https://github.com/3b1b/manim.git
synced 2025-09-19 04:41:56 +00:00
Allow for tracking which data keys should always have the same size as points
This commit is contained in:
parent
108bb3da44
commit
440138aac5
1 changed files with 3 additions and 2 deletions
|
@ -67,6 +67,7 @@ class Mobject(object):
|
||||||
shader_dtype: Sequence[Tuple[str, type, Tuple[int]]] = [
|
shader_dtype: Sequence[Tuple[str, type, Tuple[int]]] = [
|
||||||
('point', np.float32, (3,)),
|
('point', np.float32, (3,)),
|
||||||
]
|
]
|
||||||
|
aligned_data_keys = ['points']
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
@ -171,8 +172,8 @@ class Mobject(object):
|
||||||
new_length: int,
|
new_length: int,
|
||||||
resize_func: Callable[[np.ndarray, int], np.ndarray] = resize_array
|
resize_func: Callable[[np.ndarray, int], np.ndarray] = resize_array
|
||||||
):
|
):
|
||||||
if new_length != len(self.data["points"]):
|
for key in self.aligned_data_keys:
|
||||||
self.data["points"] = resize_func(self.data["points"], new_length)
|
self.data[key] = resize_func(self.data[key], new_length)
|
||||||
self.refresh_bounding_box()
|
self.refresh_bounding_box()
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue