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
This commit is contained in:
Gaia Clary 2021-08-28 14:55:47 +02:00
parent f583ecf0ad
commit 36edc11a43
1 changed files with 6 additions and 0 deletions

View File

@ -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()