fix: env setup
fix: gpencil api change
This commit is contained in:
30
__init__.py
30
__init__.py
@ -19,7 +19,12 @@ bl_info = {
|
||||
|
||||
|
||||
|
||||
|
||||
def module_can_be_imported(name):
|
||||
try:
|
||||
__import__(name)
|
||||
return True
|
||||
except ModuleNotFoundError:
|
||||
return False
|
||||
|
||||
# UTILITY FUNCTIONS
|
||||
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)
|
||||
cwd_for_subprocesses = python_path.parent
|
||||
|
||||
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",
|
||||
"zmq", '--target', target], cwd=cwd_for_subprocesses)
|
||||
|
||||
|
20890
libs/get-pip.py
Normal file
20890
libs/get-pip.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -365,9 +365,9 @@ class SessionSnapUserOperator(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
area, region, rv3d = draw.view3d_find()
|
||||
|
||||
client = client.instance.get("Client/{}".format(self.target_client))
|
||||
if client:
|
||||
rv3d.view_location = client[0][1]['location'][0]
|
||||
target_client = client.instance.get("Client/{}".format(self.target_client))
|
||||
if target_client:
|
||||
rv3d.view_location = target_client[0][1]['location'][0]
|
||||
rv3d.view_distance = 30.0
|
||||
|
||||
return {"FINISHED"}
|
||||
|
Reference in New Issue
Block a user