Skip to content

Commit

Permalink
Fix graph keyframes
Browse files Browse the repository at this point in the history
I broke them by "thinking ahead" while extending _get_kf and reimplementing stuff I'd already done correctly, but incorrectly this time
  • Loading branch information
clayote committed Aug 27, 2024
1 parent bd5ef61 commit 96f6da3
Showing 1 changed file with 4 additions and 58 deletions.
62 changes: 4 additions & 58 deletions LiSE/LiSE/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,63 +720,6 @@ def _make_edge(

def _get_kf(self, branch, turn, tick):
kf = super()._get_kf(branch, turn, tick)
try:
charrbs_kf = self._characters_rulebooks_cache.get_keyframe(
branch, turn, tick
)
except KeyError:
charrbs_kf = {}
try:
unitrbs_kf = self._units_rulebooks_cache.get_keyframe(
branch, turn, tick
)
except KeyError:
unitrbs_kf = {}
try:
charthrbs_kf = (
self._characters_things_rulebooks_cache.get_keyframe(
branch, turn, tick
)
)
except KeyError:
charthrbs_kf = {}
try:
charplrbs_kf = (
self._characters_places_rulebooks_cache.get_keyframe(
branch, turn, tick
)
)
except KeyError:
charplrbs_kf = {}
try:
charporbs_kf = (
self._characters_portals_rulebooks_cache.get_keyframe(
branch, turn, tick
)
)
except KeyError:
charporbs_kf = {}
for (char,), vals in kf["graph_val"].items():
if vals.get("name", True) is None:
continue
try:
vals["units"] = self._unitness_cache.get_keyframe(
char, branch, turn, tick
)
except KeyError:
vals["units"] = {}
vals["rulebooks"] = rbs = {}
for key, kf2 in [
("character", charrbs_kf),
("unit", unitrbs_kf),
("thing", charthrbs_kf),
("place", charplrbs_kf),
("portal", charporbs_kf),
]:
if char in kf2:
rbs[key] = kf2[char]
else:
rbs[key] = (char, key)
try:
kf["universal"] = self._universal_cache.get_keyframe(
branch, turn, tick
Expand Down Expand Up @@ -1282,7 +1225,10 @@ def close(self) -> None:
self.cache_arrange_queue.put("shutdown")
if self._cache_arrange_thread.is_alive():
self._cache_arrange_thread.join()
if self._keyframe_on_close and self._btt() not in self._keyframes_times:
if (
self._keyframe_on_close
and self._btt() not in self._keyframes_times
):
self.snap_keyframe()
for store in self.stores:
if hasattr(store, "save"):
Expand Down

0 comments on commit 96f6da3

Please sign in to comment.