ManimCommunity / ManimCommunity/manim
Mobject `.become` causes shifting into Submobjects with Empty Parametric functions while using Updaters
- Dominant language
- Python
- Stars
- 40.9k
- Forks
- 3.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
Consider the code below.
If I remove the line `plot = ax.plot(myfunc, x_range=[0.0, t_final, 0.2])`, then `plot` results at the end a VMobject with no points in-spite it is supposed to be updated through the updater function. I have to manually retrieve its last state. Is it normal behaviuor?
```py
import manim as mn
class Test(mn.Scene):
def construct(self):
def myfunc(t):
return t**2
t = mn.ValueTracker(0)
plot = mn.VMobject()
ax = mn.Axes(x_range=[0,6,1], y_range=[0, 28, 4])
self.add(ax, plot)
def GraphUpdater(mob):
mob_next = ax.plot(myfunc, x_range=[0.0, t.get_value(), 0.2] )
mob.become(mob_next)
plot.add_updater(GraphUpdater, call_updater=True)
# Animation
t_final = 5
self.play(t.animate.set_value(t_final))
self.wait()
plot.suspend_updating()
# If I remove the following line then I get error.
# I think that plot shall already have this value due to the updater, I shouldn't re-do it manually
plot = ax.plot(myfunc, x_range=[0.0, t_final, 0.2])
# plot is empty if I remove the previous instruction.
print(plot.get_end())
```
EDIT: The error message related to the last line is:
`Exception: Cannot call Mobject.get_end for a Mobject with no points`
Contributor guide
Research direction
Start with the provided Scene reproduction, focusing on VMobject, add_updater, Mobject.become, and the empty result from get_end(). Compare behavior with and without the initial ax.plot call, then trace the updater lifecycle during the ValueTracker animation. Done means the reproduction no longer leaves the updated plot without points, or the documented behavior and required usage are made clear.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100