fix: env setup

fix: gpencil api change
This commit is contained in:
Swann Martinez
2019-05-23 16:49:32 +02:00
parent 53f0811b94
commit d53165f17e
6 changed files with 20923 additions and 15 deletions

View File

@ -19,7 +19,12 @@ bl_info = {
def module_can_be_imported(name):
try:
__import__(name)
return True
except ModuleNotFoundError:
return False
# UTILITY FUNCTIONS # UTILITY FUNCTIONS
def client_list_callback(scene, context): def client_list_callback(scene, context):
@ -114,14 +119,27 @@ classes = {
} }
def register():
try:
import zmq
except:
python_path = Path(bpy.app.binary_path_python) python_path = Path(bpy.app.binary_path_python)
cwd_for_subprocesses = python_path.parent cwd_for_subprocesses = python_path.parent
target = get_package_install_directory() target = get_package_install_directory()
def install_pip():
# pip can not necessarily be imported into Blender after this
get_pip_path = Path(__file__).parent / "libs" / "get-pip.py"
subprocess.run([str(python_path), str(get_pip_path)], cwd=cwd_for_subprocesses)
def install_package(name):
target = get_package_install_directory()
subprocess.run([str(python_path), "-m", "pip", "install", name, '--target', target], cwd=cwd_for_subprocesses)
def register():
if not module_can_be_imported("pip"):
install_pip()
if not module_can_be_imported("zmq"):
subprocess.run([str(python_path), "-m", "pip", "install", subprocess.run([str(python_path), "-m", "pip", "install",
"zmq", '--target', target], cwd=cwd_for_subprocesses) "zmq", '--target', target], cwd=cwd_for_subprocesses)

20890
libs/get-pip.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -365,9 +365,9 @@ class SessionSnapUserOperator(bpy.types.Operator):
def execute(self, context): def execute(self, context):
area, region, rv3d = draw.view3d_find() area, region, rv3d = draw.view3d_find()
client = client.instance.get("Client/{}".format(self.target_client)) target_client = client.instance.get("Client/{}".format(self.target_client))
if client: if target_client:
rv3d.view_location = client[0][1]['location'][0] rv3d.view_location = target_client[0][1]['location'][0]
rv3d.view_distance = 30.0 rv3d.view_distance = 30.0
return {"FINISHED"} return {"FINISHED"}