Open dphfox opened 2 months ago
Closes #303.
Diverged a bit from the algorithm as written. Now, it only paints validity/invalidity, as well as storing a change time for avoiding computations for non-meaningful changes.
New algorithm documented on Technical Fluff: https://fluff.blog/2024/04/16/monotonic-painting.html
The new execution model exposed a shortcoming of the existing For internals, where there was an infinite loop between pair processors and the main object.
So I've been mulling over the problem for a few days, and I realised that I probably should have a better mental model of what should be going on inside a For object.
This is the structure I landed on:
TI
doesn't produce a value itself (graph only), but instead manages the disassembly of the table into individual KI
and VI
state objects as efficiently as possible, reconciling them with the key/value pairs in the input table.KI
and VI
are basically just state objects holding a value. They exist purely to filter updates from TI
that wouldn't be meaningfully different.
KO
and VO
are constructed via a user callback and have arbitrary dependencies. Typically they'll depend on the key and value inputs they're given from KI
and/or VI
.TO
assembles all KO
/VO
outputs into key/value pairs in the output table. Its dependencies and state of validation are managed by TI
.It's been so long.
Tweens are now up and running, and alongside them, there is a bevy of new internal utilities for managing timing based objects. This will make some other things much easier to implement in the future!
The system is designed to work with custom time sources too, so it should be flexible.
So I've been playing around with the bugs in this branch for a short while this evening. As best as I can tell, this branch messes up the lifetimes of something somehow - I suspect something that promises to create a new inner scope for a callback is instead returning an outer scope somewhere. Just a hunch.
Fixed some of the major lifetime issues - after a lot of diagnosis, it turns out the issue was that New calls were being cached, which is incorrect because scope upvalues were being used in the cached functions.
Ported the Word Game example just fine... so looks like I'll need a more complex example to figure out what's going wrong.
if you create a tween with a repeat count of -1 then the first time its evaluated self._activeFrom is nil so it sets self._activeElapsed to self._activeDuration (which is infinity) which then causes getTweenRatio to return nan so it gives a warning
Will need to fix this
Will also need to fix the infinite loop check in change
to allow for cyclic changes if they happen through a dependency that doesn't meaningfully change (likely, this just means allowing cycles in change
).
Closes #144. Implements Reactively's hybrid push-pull algorithm for Fusion's graph objects, as described on Technical Fluff and as described by Reactively's author.