forked from millerhooks/close2mocap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init__.py
101 lines (77 loc) · 2.81 KB
/
__init__.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
94
95
96
97
98
99
100
101
'''
Copyright 2021 Manuel Acevedo
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
'''
import bpy
import sys
import subprocess
import ensurepip
import os
import imp
bl_info = {
"name" : "close2mocap",
"author" : "manuel acevedo",
"description" : "an addon that uses mediapipe to track head rotation. more features coming soon...ish",
"blender" : (2, 80, 0),
"version" : (0, 0, 1),
"location" : "",
"warning" : "THIS ADDON WILL INSTALL 3RD PARTY LIBRARIES",
"category" : "motion capture"
}
def install_libs():
ensurepip.bootstrap()
os.environ.pop("PIP_REQ_TRACKER", None)
# forcing the path cause i can
version = bpy.app.version_string
version = int(version[2])
if version == 9:
path = sys.executable
path = path.split('bin')[0]
path = path + 'lib\site-packages'
python_path = sys.executable
else:
path = sys.executable
path = path = path.split('blender.exe')[0]
path = path + '2.83\python\lib\site-packages'
python_path = bpy.app.binary_path_python
print('this is the path look here', path)
print('this is the python path', python_path)
subprocess.check_output([python_path, '-m', 'pip', 'install', 'opencv-python', '-t', path])
subprocess.check_output([python_path, '-m', 'pip', 'install', 'mediapipe', '-t', path])
subprocess.check_output([python_path, '-m', 'pip', 'install', '--ignore-installed', 'six', '-t', path])
subprocess.check_output([python_path, '-m', 'pip', 'install', '--ignore-installed', 'attrs', '-t', path])
subprocess.check_output([python_path, '-m', 'pip', 'install', '--ignore-installed', 'matplotlib', '-t', path])
try:
imp.find_module('mediapipe')
except ImportError:
install_libs()
from .operators import *
classes = (
My_settings,
TRACK_OT_load_data,
VIEW3D_PT_load_data,
VIEW3D_PT_track,
TRACK_OT_track_head,
TRACK_OT_track_mouth,
TRACK_OT_track_blinks,
TRACK_OT_track_eyes,
TRACK_OT_track_fingers
)
def register():
for cls in classes:
bpy.utils.register_class(cls)
bpy.types.Scene.my_tool = bpy.props.PointerProperty(type=My_settings)
def unregister():
for cls in reversed(classes):
bpy.utils.unregister_class(cls)
del bpy.types.Scene.my_tool
if __name__ == "__main__":
register()