refactor: remove unused STRICT right strategy

This commit is contained in:
Swann 2020-06-16 18:04:27 +02:00
parent 88e69711ba
commit bcdefca32c
No known key found for this signature in database
GPG Key ID: 5E0D936BD280E963
5 changed files with 47 additions and 65 deletions

View File

@ -115,71 +115,66 @@ class DynamicRightSelectTimer(Timer):
if self._user is None:
self._user = session.online_users.get(settings.username)
if self._right_strategy is None:
self._right_strategy = session.config[
'right_strategy']
if self._user:
current_selection = utils.get_selected_objects(
bpy.context.scene,
bpy.data.window_managers['WinMan'].windows[0].view_layer
)
if current_selection != self._last_selection:
if self._right_strategy == RP_COMMON:
obj_common = [
o for o in self._last_selection if o not in current_selection]
obj_ours = [
o for o in current_selection if o not in self._last_selection]
obj_common = [
o for o in self._last_selection if o not in current_selection]
obj_ours = [
o for o in current_selection if o not in self._last_selection]
# change old selection right to common
for obj in obj_common:
node = session.get(uuid=obj)
# change old selection right to common
for obj in obj_common:
node = session.get(uuid=obj)
if node and (node.owner == settings.username or node.owner == RP_COMMON):
recursive = True
if node.data and 'instance_type' in node.data.keys():
recursive = node.data['instance_type'] != 'COLLECTION'
session.change_owner(
node.uuid,
RP_COMMON,
recursive=recursive)
if node and (node.owner == settings.username or node.owner == RP_COMMON):
recursive = True
if node.data and 'instance_type' in node.data.keys():
recursive = node.data['instance_type'] != 'COLLECTION'
session.change_owner(
node.uuid,
RP_COMMON,
recursive=recursive)
# change new selection to our
for obj in obj_ours:
node = session.get(uuid=obj)
# change new selection to our
for obj in obj_ours:
node = session.get(uuid=obj)
if node and node.owner == RP_COMMON:
recursive = True
if node.data and 'instance_type' in node.data.keys():
recursive = node.data['instance_type'] != 'COLLECTION'
if node and node.owner == RP_COMMON:
recursive = True
if node.data and 'instance_type' in node.data.keys():
recursive = node.data['instance_type'] != 'COLLECTION'
session.change_owner(
node.uuid,
settings.username,
recursive=recursive)
else:
return
session.change_owner(
node.uuid,
settings.username,
recursive=recursive)
else:
return
self._last_selection = current_selection
self._last_selection = current_selection
user_metadata = {
'selected_objects': current_selection
}
user_metadata = {
'selected_objects': current_selection
}
session.update_user_metadata(user_metadata)
logging.debug("Update selection")
session.update_user_metadata(user_metadata)
logging.debug("Update selection")
# Fix deselection until right managment refactoring (with Roles concepts)
if len(current_selection) == 0 and self._right_strategy == RP_COMMON:
owned_keys = session.list(
filter_owner=settings.username)
for key in owned_keys:
node = session.get(uuid=key)
# Fix deselection until right managment refactoring (with Roles concepts)
if len(current_selection) == 0 and self._right_strategy == RP_COMMON:
owned_keys = session.list(
filter_owner=settings.username)
for key in owned_keys:
node = session.get(uuid=key)
session.change_owner(
key,
RP_COMMON,
recursive=recursive)
session.change_owner(
key,
RP_COMMON,
recursive=recursive)
for user, user_info in session.online_users.items():
if user != settings.username:

@ -1 +1 @@
Subproject commit 4d7b8d96a832d12de0d7e5616d84fc56dc902c26
Subproject commit 6ed4e63b3d2f8afe3f10cad0992c9d4af1b9274a

View File

@ -112,8 +112,7 @@ class SessionStartOperator(bpy.types.Operator):
client = Session(
factory=bpy_factory,
python_path=bpy.app.binary_path_python,
default_strategy=settings.right_strategy)
python_path=bpy.app.binary_path_python)
# Host a session
if self.host:

View File

@ -97,13 +97,6 @@ class SessionPrefs(bpy.types.AddonPreferences):
name="start_empty",
default=False
)
right_strategy: bpy.props.EnumProperty(
name='right_strategy',
description='right strategy',
items={
('STRICT', 'strict', 'strict right repartition'),
('COMMON', 'common', 'relaxed right repartition')},
default='COMMON')
cache_directory: bpy.props.StringProperty(
name="cache directory",
subtype="DIR_PATH",
@ -264,7 +257,6 @@ class SessionPrefs(bpy.types.AddonPreferences):
icon='DISCLOSURE_TRI_DOWN' if self.conf_session_hosting_expanded
else 'DISCLOSURE_TRI_RIGHT', emboss=False)
if self.conf_session_hosting_expanded:
box.row().prop(self, "right_strategy", text="Right model")
row = box.row()
row.label(text="Start with an empty scene:")
row.prop(self, "start_empty", text="")

View File

@ -262,10 +262,6 @@ class SESSION_PT_settings_replication(bpy.types.Panel):
row = layout.row()
row.prop(settings.sync_flags, "sync_render_settings")
row = layout.row(align=True)
row.label(text="Right strategy:")
row.prop(settings, "right_strategy", text="")
row = layout.row()
row = layout.row()
@ -420,7 +416,7 @@ class SESSION_PT_services(bpy.types.Panel):
selected_user = context.window_manager.user_index
settings = context.window_manager.session
active_user = online_users[selected_user] if len(online_users)-1 >= selected_user else 0
# Create a simple row.
for name, state in operators.client.services_state.items():
row = layout.row()