diff options
| -rw-r--r-- | Scripts/generate_utils.py | 9 | ||||
| -rw-r--r-- | Scripts/libtastt.py | 11 |
2 files changed, 19 insertions, 1 deletions
diff --git a/Scripts/generate_utils.py b/Scripts/generate_utils.py index 1e12103..7d231f9 100644 --- a/Scripts/generate_utils.py +++ b/Scripts/generate_utils.py @@ -23,6 +23,15 @@ class Config(): else: return ceil(float_result) + def layerNeedsParity(self, which_layer): + num_cells = self.BOARD_ROWS * self.BOARD_COLS + layers_in_last_region = num_cells % self.CHARS_PER_SYNC + float_result = num_cells / self.CHARS_PER_SYNC + if which_layer >= layers_in_last_region: + return True + else: + return False + config = Config() # Implementation detail. We use this parameter to return from the terminal diff --git a/Scripts/libtastt.py b/Scripts/libtastt.py index 5e216ca..4b4dda9 100644 --- a/Scripts/libtastt.py +++ b/Scripts/libtastt.py @@ -761,7 +761,16 @@ def generateFXLayer(which_layer: int, anim: libunity.UnityAnimator, layer: dummy_param = generate_utils.getDummyParam() anim.addTransitionBooleanCondition(state, home_state_transition, dummy_param, False) - pass + + if generate_utils.config.layerNeedsParity(which_layer): + # There may be layers which never write to the text box. In this case, + # when those layers are turned on to write to that last region, they + # simply transition back to the default (idle) state. + home_state_transition = anim.addTransition(default_state) + select_param = generate_utils.getSelectParam() + i = generate_utils.config.numRegions(0) - 1 + anim.addTransitionIntegerEqualityCondition(active_state, + home_state_transition, select_param, i) # Generic toggle adding utility. # Generates the layer and parameter. |
