[Bf-extensions-cvs] [36edc11a] master: 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.
Gaia Clary
noreply at git.blender.org
Mon Aug 30 15:25:43 CEST 2021
Commit: 36edc11a436d73e3e503396ffe1c14136e37db8d
Author: Gaia Clary
Date: Sat Aug 28 14:55:47 2021 +0200
Branches: master
https://developer.blender.org/rBA36edc11a436d73e3e503396ffe1c14136e37db8d
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
===================================================================
M space_view3d_math_vis/utils.py
===================================================================
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()
More information about the Bf-extensions-cvs
mailing list