forked from JPfeP/AddRoutes
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathg_vars.py
93 lines (77 loc) · 2.74 KB
/
g_vars.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# Copyright (C) 2019 JPfeP
#
# ##### END GPL LICENSE BLOCK #####
import bpy
import rtmidi
# Creation of two MIDI ports
midiin = rtmidi.MidiIn()
midiout = rtmidi.MidiOut()
# for inhibiting saving
save_inh = False
midi_update_inh = False
# just to have a global namespace
last_osc_addr = None
blemote_midi_fb = []
osc_queue = []
blemote_fb = []
# OSC
osc_out_enable = False
osc_in_enable = False
osc_client = None
addroutes_in = {}
addroutes_osc_in = []
addroutes_blemote = {}
eval_ref = None
eval_prop = None
highest_rank = 0
def evalprop (toeval, withctx):
for window in bpy.data.window_managers[0].windows:
screen = window.screen
for area in screen.areas:
if area.type == withctx:
override = {'window': window, 'screen': screen, 'area': area}
bpy.ops.addroutes.getctx(override, s=toeval)
def get_item(i, j):
if j == 0:
return bpy.context.scene.MOM_Items[i]
else:
return bpy.context.preferences.addons[__package__].preferences.AddR_System_Routes[i]
def debugcopy(self, context):
prefs = bpy.context.preferences.addons[__package__].preferences
text = bpy.data.texts.get("AddRoutes: Debug in/out")
if text is None and prefs.debug_copy:
bpy.ops.text.new()
text = bpy.data.texts[-1]
text.name = 'AddRoutes: Debug in/out'
return
Cont_types = [
('key_on', 'Key On number', ''),
('key_off', 'Key Off number', ''),
('key_on', 'Note On velocity', 'f_opt'),
('key_off', 'Note Off velocity', 'f_opt'),
('AT_mono', 'Aftertouch mono', ''),
('AT_poly', 'Aftertouch poly', 'f_forced'),
('pitchbend', 'Pitchbend 14bit', ''),
('pgm', 'Program Change', ''),
('cc7', 'Continous Controller 7bit', 'f_forced'),
('rpn', 'RPN 7bit', 'f_forced'),
('rpn14', 'RPN 14bit', 'f_forced'),
('nrpn', 'NRPN 7bit', 'f_forced'),
('nrpn14', 'NRPN 14bit', 'f_forced'),
]