1
#====================== BEGIN GPL LICENSE BLOCK ======================
3
# This program is free software; you can redistribute it and/or
4
# modify it under the terms of the GNU General Public License
5
# as published by the Free Software Foundation; either version 2
6
# of the License, or (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software Foundation,
15
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
#======================= END GPL LICENSE BLOCK ========================
19
def console_namespace():
21
get_consoles = console_python.get_console
22
consoles = getattr(get_consoles, "consoles", None)
24
for console, stdout, stderr in get_consoles.consoles.values():
28
def console_math_data():
29
from mathutils import Matrix, Vector, Quaternion, Euler
35
data_vector_array = {}
37
for key, var in console_namespace().items():
43
if var_type is Matrix:
44
if len(var.col) != 4 or len(var.row) != 4:
45
if len(var.col) == len(var.row):
47
else: # todo, support 4x3 matrix
49
data_matrix[key] = var
50
elif var_type is Vector:
53
data_vector[key] = var
54
elif var_type is Quaternion:
56
elif var_type is Euler:
58
elif var_type in {list, tuple}:
62
if type(item) is not Vector:
66
data_vector_array[key] = var
68
return data_matrix, data_quat, data_euler, data_vector, data_vector_array