diff options
author | Gaia Clary <gaia.clary@machinimatrix.org> | 2021-08-28 15:55:47 +0300 |
---|---|---|
committer | Gaia Clary <gaia.clary@machinimatrix.org> | 2021-08-30 16:25:29 +0300 |
commit | 36edc11a436d73e3e503396ffe1c14136e37db8d (patch) | |
tree | 4d0168df2c25fa2a0af1bec3a4982817d75f6bba | |
parent | f583ecf0ad14d969c8b53f8a4234c1b5df9a0703 (diff) |
When deleting a variable from the console, the MathVis data is not updated. When later trying to remove the data from MathVis we see a stack trace.
This patch takes care to update the MathVis list instantly via the
VarStates:store_states() hook
-rw-r--r-- | space_view3d_math_vis/utils.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/space_view3d_math_vis/utils.py b/space_view3d_math_vis/utils.py index 7910bb9c..50c8aba3 100644 --- a/space_view3d_math_vis/utils.py +++ b/space_view3d_math_vis/utils.py @@ -50,6 +50,12 @@ class VarStates: # console variables. state_props = bpy.context.window_manager.MathVisStatePropList variables = get_math_data() + + for index, state_prop in reversed(list(enumerate(state_props))): + if state_prop.name not in variables: + # Variable has been removed from console + state_props.remove(index) + for key, ktype in variables.items(): if key and key not in state_props: prop = state_props.add() |