Merge branch '40-multi-scene-workflow' into 'develop'
Resolve "Multi scene workflow" See merge request slumber/multi-user!22
This commit is contained in:
commit
9df7cd4659
@ -98,6 +98,12 @@ class SessionProps(bpy.types.PropertyGroup):
|
||||
default=True,
|
||||
update=presence.update_overlay_settings
|
||||
)
|
||||
presence_show_far_user: bpy.props.BoolProperty(
|
||||
name="Show different scenes",
|
||||
description="Show user on different scenes",
|
||||
default=False,
|
||||
update=presence.update_overlay_settings
|
||||
)
|
||||
filter_owned: bpy.props.BoolProperty(
|
||||
name="filter_owned",
|
||||
description='Show only owned datablocks',
|
||||
|
@ -204,15 +204,21 @@ class DrawClient(Draw):
|
||||
|
||||
for user in users.values():
|
||||
metadata = user.get('metadata')
|
||||
|
||||
if 'color' in metadata:
|
||||
color = metadata.get('color')
|
||||
scene_current = metadata.get('scene_current')
|
||||
user_showable = scene_current == bpy.context.scene.name or settings.presence_show_far_user
|
||||
if color and scene_current and user_showable:
|
||||
if settings.presence_show_selected and 'selected_objects' in metadata.keys():
|
||||
renderer.draw_client_selection(
|
||||
user['id'], metadata['color'], metadata['selected_objects'])
|
||||
user['id'], color, metadata['selected_objects'])
|
||||
if settings.presence_show_user and 'view_corners' in metadata:
|
||||
renderer.draw_client_camera(
|
||||
user['id'], metadata['view_corners'], metadata['color'])
|
||||
|
||||
user['id'], metadata['view_corners'], color)
|
||||
if not user_showable:
|
||||
# TODO: remove this when user event drivent update will be
|
||||
# ready
|
||||
renderer.flush_selection()
|
||||
renderer.flush_users()
|
||||
|
||||
class ClientUpdate(Timer):
|
||||
def __init__(self, timout=.5):
|
||||
@ -236,7 +242,7 @@ class ClientUpdate(Timer):
|
||||
|
||||
local_user_metadata = local_user.get('metadata')
|
||||
current_view_corners = presence.get_view_corners()
|
||||
|
||||
scene_current = bpy.context.scene.name
|
||||
if not local_user_metadata or 'color' not in local_user_metadata.keys():
|
||||
metadata = {
|
||||
'view_corners': current_view_corners,
|
||||
@ -245,7 +251,8 @@ class ClientUpdate(Timer):
|
||||
settings.client_color.g,
|
||||
settings.client_color.b,
|
||||
1),
|
||||
'frame_current':bpy.context.scene.frame_current
|
||||
'frame_current':bpy.context.scene.frame_current,
|
||||
'scene_current': scene_current
|
||||
}
|
||||
session.update_user_metadata(metadata)
|
||||
elif current_view_corners != local_user_metadata['view_corners']:
|
||||
@ -253,6 +260,9 @@ class ClientUpdate(Timer):
|
||||
local_user_metadata['view_corners'] = current_view_corners
|
||||
local_user_metadata['view_matrix'] = presence.get_view_matrix()
|
||||
session.update_user_metadata(local_user_metadata)
|
||||
elif scene_current != local_user_metadata['scene_current']:
|
||||
local_user_metadata['scene_current'] = scene_current
|
||||
session.update_user_metadata(local_user_metadata)
|
||||
|
||||
# sync online users
|
||||
session_users = operators.client.online_users
|
||||
@ -261,11 +271,8 @@ class ClientUpdate(Timer):
|
||||
for index, user in enumerate(ui_users):
|
||||
if user.username not in session_users.keys():
|
||||
ui_users.remove(index)
|
||||
|
||||
renderer.flush_selection()
|
||||
renderer.flush_users()
|
||||
|
||||
|
||||
break
|
||||
|
||||
for user in session_users:
|
||||
|
@ -287,6 +287,10 @@ class SessionSnapUserOperator(bpy.types.Operator):
|
||||
target_ref = client.online_users.get(self.target_client)
|
||||
|
||||
if target_ref:
|
||||
target_scene = target_ref['metadata']['scene_current']
|
||||
if target_scene != context.scene.name:
|
||||
bpy.context.window.scene = bpy.data.scenes[target_scene]
|
||||
|
||||
rv3d.view_matrix = mathutils.Matrix(
|
||||
target_ref['metadata']['view_matrix'])
|
||||
else:
|
||||
|
@ -219,6 +219,10 @@ class DrawFactory(object):
|
||||
if ob.type == 'EMPTY':
|
||||
# TODO: Child case
|
||||
# Collection instance case
|
||||
indices = (
|
||||
(0, 1), (1, 2), (2, 3), (0, 3),
|
||||
(4, 5), (5, 6), (6, 7), (4, 7),
|
||||
(0, 4), (1, 5), (2, 6), (3, 7))
|
||||
if ob.instance_collection:
|
||||
for obj in ob.instance_collection.objects:
|
||||
if obj.type == 'MESH':
|
||||
|
@ -266,8 +266,10 @@ class SESSION_PT_user(bpy.types.Panel):
|
||||
# Create a simple row.
|
||||
row = layout.row()
|
||||
box = row.box()
|
||||
split = box.split(factor=0.5)
|
||||
split = box.split(factor=0.3)
|
||||
split.label(text="user")
|
||||
split = split.split(factor=0.5)
|
||||
split.label(text="localisation")
|
||||
split.label(text="frame")
|
||||
split.label(text="ping")
|
||||
|
||||
@ -297,6 +299,7 @@ class SESSION_UL_users(bpy.types.UIList):
|
||||
is_local_user = item.username == settings.username
|
||||
ping = '-'
|
||||
frame_current = '-'
|
||||
scene_current = '-'
|
||||
if session:
|
||||
user = session.online_users.get(item.username)
|
||||
if user:
|
||||
@ -304,9 +307,11 @@ class SESSION_UL_users(bpy.types.UIList):
|
||||
metadata = user.get('metadata')
|
||||
if metadata and 'frame_current' in metadata:
|
||||
frame_current = str(metadata['frame_current'])
|
||||
|
||||
split = layout.split(factor=0.5)
|
||||
scene_current = metadata['scene_current']
|
||||
split = layout.split(factor=0.3)
|
||||
split.label(text=item.username)
|
||||
split = split.split(factor=0.5)
|
||||
split.label(text=scene_current)
|
||||
split.label(text=frame_current)
|
||||
split.label(text=ping)
|
||||
|
||||
@ -336,7 +341,10 @@ class SESSION_PT_presence(bpy.types.Panel):
|
||||
col = layout.column()
|
||||
col.prop(settings,"presence_show_selected")
|
||||
col.prop(settings,"presence_show_user")
|
||||
row = layout.row()
|
||||
row = layout.column()
|
||||
row.active = settings.presence_show_user
|
||||
row.prop(settings,"presence_show_far_user")
|
||||
|
||||
|
||||
class SESSION_PT_services(bpy.types.Panel):
|
||||
bl_idname = "MULTIUSER_SERVICE_PT_panel"
|
||||
|
Loading…
x
Reference in New Issue
Block a user