feat(general) : zmq auto config
This commit is contained in:
parent
c0b7f34b76
commit
385d416e6c
17
__init__.py
17
__init__.py
@ -12,7 +12,24 @@ bl_info = {
|
|||||||
import bpy
|
import bpy
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import subprocess
|
||||||
|
import bpy
|
||||||
|
import addon_utils
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
python_path = Path(bpy.app.binary_path_python)
|
||||||
|
cwd_for_subprocesses = python_path.parent
|
||||||
|
|
||||||
|
def get_package_install_directory():
|
||||||
|
for path in sys.path:
|
||||||
|
if os.path.basename(path) in ("dist-packages", "site-packages"):
|
||||||
|
return path
|
||||||
|
|
||||||
|
try:
|
||||||
|
import zmq
|
||||||
|
except:
|
||||||
|
target = get_package_install_directory()
|
||||||
|
subprocess.run([str(python_path), "-m", "pip", "install", "zmq", '--target', target], cwd=cwd_for_subprocesses)
|
||||||
|
|
||||||
from . import operators
|
from . import operators
|
||||||
from . import ui
|
from . import ui
|
||||||
|
@ -9,9 +9,10 @@ import threading
|
|||||||
import time
|
import time
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from random import randint
|
from random import randint
|
||||||
|
import zmq
|
||||||
|
|
||||||
from . import draw, helpers, message
|
from . import draw, helpers, message
|
||||||
from .libs import dump_anything, umsgpack, zmq
|
from .libs import dump_anything, umsgpack
|
||||||
|
|
||||||
# import zmq
|
# import zmq
|
||||||
lock = threading.Lock()
|
lock = threading.Lock()
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import logging
|
import logging
|
||||||
try:
|
try:
|
||||||
from .libs import umsgpack
|
from .libs import umsgpack
|
||||||
from .libs import zmq
|
|
||||||
except:
|
except:
|
||||||
# Server import
|
# Server import
|
||||||
from libs import umsgpack
|
from libs import umsgpack
|
||||||
from libs import zmq
|
|
||||||
|
import zmq
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
@ -15,6 +15,9 @@ import gpu
|
|||||||
import mathutils
|
import mathutils
|
||||||
from bpy_extras import view3d_utils
|
from bpy_extras import view3d_utils
|
||||||
from gpu_extras.batch import batch_for_shader
|
from gpu_extras.batch import batch_for_shader
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
python_path = Path(bpy.app.binary_path_python)
|
||||||
|
|
||||||
from . import client, draw, helpers, ui
|
from . import client, draw, helpers, ui
|
||||||
from .libs import umsgpack
|
from .libs import umsgpack
|
||||||
@ -299,8 +302,9 @@ class session_create(bpy.types.Operator):
|
|||||||
global client_instance
|
global client_instance
|
||||||
|
|
||||||
net_settings = context.scene.session_settings
|
net_settings = context.scene.session_settings
|
||||||
|
print(python_path)
|
||||||
server = subprocess.Popen(
|
server = subprocess.Popen(
|
||||||
['python', 'server.py'], shell=False, stdout=subprocess.PIPE)
|
[str(python_path), 'server.py'], shell=False, stdout=subprocess.PIPE)
|
||||||
# time.sleep(0.1)
|
# time.sleep(0.1)
|
||||||
|
|
||||||
bpy.ops.session.join()
|
bpy.ops.session.join()
|
||||||
|
@ -2,10 +2,8 @@ import logging
|
|||||||
import time
|
import time
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
|
|
||||||
from libs import zmq
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import zmq
|
||||||
import message
|
import message
|
||||||
logger = logging.getLogger("Server")
|
logger = logging.getLogger("Server")
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user