Skip to content
Snippets Groups Projects
Commit 32baafe4 authored by Gaia Clary's avatar Gaia Clary
Browse files

T91111: possible out of range when iterating over Math Vis item list

While preparing T91111 i found an issue with out of date index after my recent changes.
The problem is:

bpy.context.window_manager.MathVisProp can be "0" even when the list is actually empty.

This patch fixes the index issue, although the true cause might still be found elsewhere.
there is more to fix, so this is only a first step to a complete fix.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12390
parent 87d1c381
No related branches found
No related tags found
No related merge requests found
...@@ -149,8 +149,12 @@ def draw_callback_view(): ...@@ -149,8 +149,12 @@ def draw_callback_view():
bgl.glDepthFunc(bgl.GL_LESS) bgl.glDepthFunc(bgl.GL_LESS)
data_matrix, data_quat, data_euler, data_vector, data_vector_array = utils.console_math_data() data_matrix, data_quat, data_euler, data_vector, data_vector_array = utils.console_math_data()
if settings.index in range(0,len(prop_states)):
active_index = settings.index active_index = settings.index
active_key = prop_states[active_index].name if active_index >= 0 else None active_key = prop_states[active_index].name
else:
active_index = -1
active_key = None
if data_vector: if data_vector:
coords = [tuple(vec.to_3d()) for vec in data_vector.values()] coords = [tuple(vec.to_3d()) for vec in data_vector.values()]
......
...@@ -23,11 +23,14 @@ import bpy ...@@ -23,11 +23,14 @@ import bpy
def console_namespace(): def console_namespace():
import console_python import console_python
get_consoles = console_python.get_console for window in bpy.context.window_manager.windows:
consoles = getattr(get_consoles, "consoles", None) for area in window.screen.areas:
if consoles: if area.type == 'CONSOLE':
for console, stdout, stderr in get_consoles.consoles.values(): for region in area.regions:
return console.locals if region.type == 'WINDOW':
console = console_python.get_console(hash(region))
if console:
return console[0].locals
return {} return {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment