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
No known key found for this signature in database
GPG Key ID: 414CCAFD8DA720E1
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
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
python_path = Path(bpy.app.binary_path_python)
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",
"zmq", '--target', target], cwd=cwd_for_subprocesses)

View File

@ -87,7 +87,7 @@ def load(key, value):
elif target_type == 'Material':
load_material(target=target, data=value,
create=True)
elif target_type == 'Grease Pencil':
elif target_type == 'GreasePencil':
load_gpencil(target=target, data=value,
create=True)
elif target_type == 'Scene':
@ -530,7 +530,7 @@ def dump(key):
if target_type == 'Material':
data = dump_datablock(target, 2)
dump_datablock_attibute(target, ['node_tree'], 7, data)
elif target_type == 'Grease Pencil':
elif target_type == 'GreasePencil':
data = dump_datablock(target, 2)
dump_datablock_attibute(
target, ['layers'], 9, data)

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):
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"}

View File

@ -9,7 +9,7 @@ import message
logger = logging.getLogger("Server")
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():
def __init__(self, context=zmq.Context.instance(), id="admin"):

2
ui.py
View File

@ -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',
'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):
bl_label = "NET settings"