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 #####
21 def console_namespace():
23 get_consoles
= console_python
.get_console
24 consoles
= getattr(get_consoles
, "consoles", None)
26 for console
, stdout
, stderr
in get_consoles
.consoles
.values():
31 def console_math_data():
32 from mathutils
import Matrix
, Vector
, Quaternion
, Euler
38 data_vector_array
= {}
40 for key
, var
in console_namespace().items():
46 if var_type
is Matrix
:
47 if len(var
.col
) != 4 or len(var
.row
) != 4:
48 if len(var
.col
) == len(var
.row
):
50 else: # todo, support 4x3 matrix
52 data_matrix
[key
] = var
53 elif var_type
is Vector
:
56 data_vector
[key
] = var
57 elif var_type
is Quaternion
:
59 elif var_type
is Euler
:
61 elif var_type
in {list, tuple}:
65 if type(item
) is not Vector
:
69 data_vector_array
[key
] = var
71 return data_matrix
, data_quat
, data_euler
, data_vector
, data_vector_array