From 22b840522e911f8e521504e1b46f5f5c4aaf5a09 Mon Sep 17 00:00:00 2001 From: Dan Masquelier Date: Thu, 13 Jan 2022 21:48:38 -0800 Subject: [PATCH] fix order of operations --- __init__.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/__init__.py b/__init__.py index 08867c4..bddb835 100644 --- a/__init__.py +++ b/__init__.py @@ -38,30 +38,30 @@ def get_vertex_data(): 'vertices_length': vertices_length} -def get_next_vertex(): - data = get_vertex_data() - return 0 if data['current_vertex_index'] + 1 >= data['vertices_length'] else data['current_vertex_index'] + 1 +def get_prev_vertex_index(data): + return data['vertices_length'] - 1 if data['current_vertex_index'] - 1 < 0 else data['current_vertex_index'] - 1 -def get_prev_vertex(): - data = get_vertex_data() - return data['vertices_length'] - 1 if data['current_vertex_index'] - 1 < 0 else data['current_vertex_index'] - 1 +def get_next_vertex_index(data): + return 0 if data['current_vertex_index'] + 1 >= data['vertices_length'] else data['current_vertex_index'] + 1 def select_next_vertex(): + data = get_vertex_data() obj = get_active_object() deselect() set_object_mode() - next_vertex_index = get_next_vertex() + next_vertex_index = get_next_vertex_index(data) obj.data.vertices[next_vertex_index].select = True set_edit_mode() def select_prev_vertex(): + data = get_vertex_data() obj = get_active_object() deselect() set_object_mode() - prev_vertex_index = get_prev_vertex() + prev_vertex_index = get_prev_vertex_index(data) obj.data.vertices[prev_vertex_index].select = True set_edit_mode()