fix: depsgraph API changes
feat: function renaming feat: pep8 compliant
This commit is contained in:
+26
-25
@@ -1,24 +1,22 @@
|
||||
from pathlib import Path
|
||||
import addon_utils
|
||||
import random
|
||||
import string
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
import bpy
|
||||
bl_info = {
|
||||
"name" : "rcf",
|
||||
"author" : "CUBE",
|
||||
"description" : "",
|
||||
"blender" : (2, 80, 0),
|
||||
"location" : "",
|
||||
"warning" : "",
|
||||
"category" : "Collaboration"
|
||||
"name": "Multi-User ",
|
||||
"author": "CUBE",
|
||||
"description": "",
|
||||
"blender": (2, 80, 0),
|
||||
"location": "",
|
||||
"warning": "",
|
||||
"category": "Collaboration"
|
||||
}
|
||||
|
||||
|
||||
import bpy
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import string
|
||||
import random
|
||||
import bpy
|
||||
import addon_utils
|
||||
from pathlib import Path
|
||||
|
||||
python_path = Path(bpy.app.binary_path_python)
|
||||
cwd_for_subprocesses = python_path.parent
|
||||
|
||||
@@ -28,13 +26,13 @@ def client_list_callback(scene, context):
|
||||
global client_keys
|
||||
items = [("Common", "Common", "")]
|
||||
|
||||
username = bpy.context.window_manager.session.username
|
||||
username = bpy.context.window_manager.session.username
|
||||
|
||||
if client_keys:
|
||||
for k in client_keys:
|
||||
if 'Client' in k[0]:
|
||||
name = k[1]
|
||||
|
||||
|
||||
if name == username:
|
||||
name += " (self)"
|
||||
|
||||
@@ -62,11 +60,11 @@ def get_package_install_directory():
|
||||
return path
|
||||
|
||||
|
||||
class RCFSessionProps(bpy.types.PropertyGroup):
|
||||
class SessionProps(bpy.types.PropertyGroup):
|
||||
username: bpy.props.StringProperty(
|
||||
name="Username",
|
||||
default="user_{}".format(randomStringDigits())
|
||||
)
|
||||
)
|
||||
ip: bpy.props.StringProperty(
|
||||
name="ip",
|
||||
description='Distant host ip',
|
||||
@@ -109,16 +107,19 @@ class RCFSessionProps(bpy.types.PropertyGroup):
|
||||
description='Enable overlay drawing module',
|
||||
default=True)
|
||||
|
||||
|
||||
classes = {
|
||||
RCFSessionProps,
|
||||
SessionProps,
|
||||
}
|
||||
|
||||
|
||||
def register():
|
||||
try:
|
||||
import zmq
|
||||
except:
|
||||
target = get_package_install_directory()
|
||||
subprocess.run([str(python_path), "-m", "pip", "install", "zmq", '--target', target], cwd=cwd_for_subprocesses)
|
||||
subprocess.run([str(python_path), "-m", "pip", "install",
|
||||
"zmq", '--target', target], cwd=cwd_for_subprocesses)
|
||||
|
||||
from . import operators
|
||||
from . import ui
|
||||
@@ -129,7 +130,7 @@ def register():
|
||||
bpy.types.ID.id = bpy.props.StringProperty(default="None")
|
||||
bpy.types.ID.is_dirty = bpy.props.BoolProperty(default=False)
|
||||
bpy.types.WindowManager.session = bpy.props.PointerProperty(
|
||||
type=RCFSessionProps)
|
||||
type=SessionProps)
|
||||
|
||||
operators.register()
|
||||
ui.register()
|
||||
@@ -138,7 +139,7 @@ def register():
|
||||
def unregister():
|
||||
from . import operators
|
||||
from . import ui
|
||||
|
||||
|
||||
ui.unregister()
|
||||
operators.unregister()
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 15 KiB |
+1
-1
@@ -11,7 +11,7 @@ import zmq
|
||||
logger = logging.getLogger(__name__)
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
class RCFMessage(object):
|
||||
class Message(object):
|
||||
"""
|
||||
Message is formatted on wire as 2 frames:
|
||||
frame 0: key (0MQ string) // property path
|
||||
|
||||
+2
-2
@@ -149,7 +149,7 @@ class SessionJoinOperator(bpy.types.Operator):
|
||||
if len(net_settings.ip) < 1:
|
||||
net_settings.ip = "127.0.0.1"
|
||||
|
||||
client_instance = client.RCFClient()
|
||||
client_instance = client.Client()
|
||||
client_instance.connect(net_settings.username,
|
||||
net_settings.ip, net_settings.port)
|
||||
|
||||
@@ -463,7 +463,7 @@ def depsgraph_update(scene):
|
||||
if client_state == 3:
|
||||
|
||||
if ctx.mode in ['OBJECT','PAINT_GPENCIL']:
|
||||
updates = ctx.depsgraph.updates
|
||||
updates = ctx.view_layer.depsgraph.updates
|
||||
username = ctx.window_manager.session.username
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
SUPPORTED_TYPES = ['Client','Curve','Material','Texture', 'Light', 'Camera', 'Mesh','Armature', 'Grease Pencil', 'Object', 'Action', 'Collection', 'Scene']
|
||||
|
||||
class RCFServerAgent():
|
||||
class ServerAgent():
|
||||
def __init__(self, context=zmq.Context.instance(), id="admin"):
|
||||
self.context = context
|
||||
|
||||
@@ -80,18 +80,18 @@ class RCFServerAgent():
|
||||
self.request_sock.send(identity, zmq.SNDMORE)
|
||||
v.send(self.request_sock)
|
||||
|
||||
msg_end_snapshot = message.RCFMessage(key="SNAPSHOT_END", id=identity)
|
||||
msg_end_snapshot = message.Message(key="SNAPSHOT_END", id=identity)
|
||||
self.request_sock.send(identity, zmq.SNDMORE)
|
||||
msg_end_snapshot.send(self.request_sock)
|
||||
logger.info("done")
|
||||
|
||||
# Regular update routing (Clients / Client)
|
||||
elif self.collector_sock in socks:
|
||||
msg = message.RCFMessage.recv(self.collector_sock)
|
||||
msg = message.Message.recv(self.collector_sock)
|
||||
# logger.info("received object")
|
||||
# Update all clients
|
||||
msg.store(self.property_map)
|
||||
msg.send(self.pub_sock)
|
||||
|
||||
server = RCFServerAgent()
|
||||
server = ServerAgent()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user