fix: env setup
fix: gpencil api change
This commit is contained in:
34
__init__.py
34
__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
|
# UTILITY FUNCTIONS
|
||||||
def client_list_callback(scene, context):
|
def client_list_callback(scene, context):
|
||||||
@ -114,14 +119,27 @@ classes = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def register():
|
python_path = Path(bpy.app.binary_path_python)
|
||||||
try:
|
cwd_for_subprocesses = python_path.parent
|
||||||
import zmq
|
target = get_package_install_directory()
|
||||||
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",
|
subprocess.run([str(python_path), "-m", "pip", "install",
|
||||||
"zmq", '--target', target], cwd=cwd_for_subprocesses)
|
"zmq", '--target', target], cwd=cwd_for_subprocesses)
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ def load(key, value):
|
|||||||
elif target_type == 'Material':
|
elif target_type == 'Material':
|
||||||
load_material(target=target, data=value,
|
load_material(target=target, data=value,
|
||||||
create=True)
|
create=True)
|
||||||
elif target_type == 'Grease Pencil':
|
elif target_type == 'GreasePencil':
|
||||||
load_gpencil(target=target, data=value,
|
load_gpencil(target=target, data=value,
|
||||||
create=True)
|
create=True)
|
||||||
elif target_type == 'Scene':
|
elif target_type == 'Scene':
|
||||||
@ -530,7 +530,7 @@ def dump(key):
|
|||||||
if target_type == 'Material':
|
if target_type == 'Material':
|
||||||
data = dump_datablock(target, 2)
|
data = dump_datablock(target, 2)
|
||||||
dump_datablock_attibute(target, ['node_tree'], 7, data)
|
dump_datablock_attibute(target, ['node_tree'], 7, data)
|
||||||
elif target_type == 'Grease Pencil':
|
elif target_type == 'GreasePencil':
|
||||||
data = dump_datablock(target, 2)
|
data = dump_datablock(target, 2)
|
||||||
dump_datablock_attibute(
|
dump_datablock_attibute(
|
||||||
target, ['layers'], 9, data)
|
target, ['layers'], 9, data)
|
||||||
|
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):
|
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"}
|
||||||
|
@ -9,7 +9,7 @@ import message
|
|||||||
logger = logging.getLogger("Server")
|
logger = logging.getLogger("Server")
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
SUPPORTED_TYPES = ['Client','Curve','Material','Texture', 'Light', 'Camera', 'Mesh','Armature', 'Grease Pencil', 'Object', 'Action', 'Collection', 'Scene']
|
SUPPORTED_TYPES = ['Client','Curve','Material','Texture', 'Light', 'Camera', 'Mesh','Armature', 'GreasePencil', 'Object', 'Action', 'Collection', 'Scene']
|
||||||
|
|
||||||
class ServerAgent():
|
class ServerAgent():
|
||||||
def __init__(self, context=zmq.Context.instance(), id="admin"):
|
def __init__(self, context=zmq.Context.instance(), id="admin"):
|
||||||
|
2
ui.py
2
ui.py
@ -5,7 +5,7 @@ from . import client, operators
|
|||||||
|
|
||||||
|
|
||||||
ICONS = {'Curve':'CURVE_DATA', 'Client':'SOLO_ON','Collection': 'FILE_FOLDER', 'Mesh': 'MESH_DATA', 'Object': 'OBJECT_DATA', 'Material': 'MATERIAL_DATA',
|
ICONS = {'Curve':'CURVE_DATA', 'Client':'SOLO_ON','Collection': 'FILE_FOLDER', 'Mesh': 'MESH_DATA', 'Object': 'OBJECT_DATA', 'Material': 'MATERIAL_DATA',
|
||||||
'Texture': 'TEXTURE_DATA', 'Scene': 'SCENE_DATA', 'Light': 'LIGHT_DATA', 'SpotLight': 'LIGHT_DATA', 'SunLight': 'LIGHT_DATA', 'PointLight': 'LIGHT_DATA', 'Camera': 'CAMERA_DATA', 'Action': 'ACTION_DATA', 'Armature': 'ARMATURE_DATA', 'Grease Pencil': 'GREASEPENCIL'}
|
'Texture': 'TEXTURE_DATA', 'Scene': 'SCENE_DATA', 'Light': 'LIGHT_DATA', 'SpotLight': 'LIGHT_DATA', 'SunLight': 'LIGHT_DATA', 'PointLight': 'LIGHT_DATA', 'Camera': 'CAMERA_DATA', 'Action': 'ACTION_DATA', 'Armature': 'ARMATURE_DATA', 'GreasePencil': 'GREASEPENCIL'}
|
||||||
|
|
||||||
class SESSION_PT_settings(bpy.types.Panel):
|
class SESSION_PT_settings(bpy.types.Panel):
|
||||||
bl_label = "NET settings"
|
bl_label = "NET settings"
|
||||||
|
Reference in New Issue
Block a user