feat: common right progress

This commit is contained in:
Swann 2019-09-20 23:58:57 +02:00
parent 51db89ca7a
commit db4dea94ed
4 changed files with 19 additions and 7 deletions

View File

@ -58,8 +58,7 @@ class BlGpencil(BlDatablock):
target.materials.append(bpy.data.materials[mat]) target.materials.append(bpy.data.materials[mat])
def diff(self): def diff(self):
return (self.bl_diff() or return (self.bl_diff())
len(diff(self.dump(pointer=self.pointer), self.buffer)) > 0)
def dump(self, pointer=None): def dump(self, pointer=None):
assert(pointer) assert(pointer)

View File

@ -85,16 +85,25 @@ class DynamicRightSelectTimer(Timer):
elif user_ref.pointer: elif user_ref.pointer:
current_selection = utils.get_selected_objects(bpy.context.scene) current_selection = utils.get_selected_objects(bpy.context.scene)
if current_selection != self.last_selection: if current_selection != self.last_selection:
self.last_selection = current_selection
user_ref.pointer.update_selected_objects(bpy.context) user_ref.pointer.update_selected_objects(bpy.context)
if settings.use_select_right: if settings.use_select_right:
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]
for obj in obj_common:
node = operators.client.get(reference=bpy.data.objects[obj])
if node:
node.owner = settings.username
operators.client.change_owner(node.uuid, 'common')
# update our rights # update our rights
for selected_obj in self.last_selection: for obj in obj_ours:
node = operators.client.get(reference=bpy.data.objects[selected_obj]) node = operators.client.get(reference=bpy.data.objects[obj])
if node: if node:
node.owner = settings.username node.owner = settings.username
operators.client.change_owner(node.uuid, settings.username) operators.client.change_owner(node.uuid, settings.username)
self.last_selection = current_selection
return self._timeout return self._timeout
# class CheckNewTimer(Timer): # class CheckNewTimer(Timer):

@ -1 +1 @@
Subproject commit b33d715ceb30d9e625926ca01fd44a42570aa793 Subproject commit 3d4a4b0b862680baa81f44bbf6c4a0df212da8df

6
ui.py
View File

@ -241,7 +241,11 @@ def draw_property(context, parent, property_uuid, level=0):
# Operations # Operations
have_right_to_modify = settings.is_admin or item.owner == settings.username have_right_to_modify = settings.is_admin or item.owner == settings.username
detail_item_box.operator(
"session.commit",
text="",
icon='TRIA_UP').target = item.uuid
detail_item_box.separator()
if item.state in [FETCHED, UP]: if item.state in [FETCHED, UP]:
detail_item_box.operator( detail_item_box.operator(
"session.apply", "session.apply",