feat: flush history on collection and scene update only
feat: enable deploy for undo branch
This commit is contained in:
@ -21,4 +21,5 @@ deploy:
|
||||
only:
|
||||
refs:
|
||||
- master
|
||||
- develop
|
||||
- develop
|
||||
- 132-fix-undo-edit-last-operation-redo-handling-2
|
@ -19,7 +19,7 @@
|
||||
bl_info = {
|
||||
"name": "Multi-User",
|
||||
"author": "Swann Martinez",
|
||||
"version": (0, 2, 0),
|
||||
"version": (0, 3, 0),
|
||||
"description": "Enable real-time collaborative workflow inside blender",
|
||||
"blender": (2, 82, 0),
|
||||
"location": "3D View > Sidebar > Multi-User tab",
|
||||
|
@ -114,6 +114,10 @@ class BlCollection(BlDatablock):
|
||||
# Link childrens
|
||||
load_collection_childrens(data['children'], target)
|
||||
|
||||
# FIXME: Find a better way after the replication big refacotoring
|
||||
# Keep other user from deleting collection object by flushing their history
|
||||
utils.flush_history()
|
||||
|
||||
def _dump_implementation(self, data, instance=None):
|
||||
assert(instance)
|
||||
|
||||
|
@ -148,12 +148,6 @@ class BlDatablock(ReplicatedDatablock):
|
||||
logging.debug(f"Constructing {name}")
|
||||
datablock_ref = self._construct(data=self.data)
|
||||
|
||||
try:
|
||||
for i in range(bpy.context.preferences.edit.undo_steps+1):
|
||||
bpy.ops.ed.undo_push(message="Multiuser history flush")
|
||||
except RuntimeError:
|
||||
logging.error("Fail to overwrite history")
|
||||
|
||||
if datablock_ref is not None:
|
||||
setattr(datablock_ref, 'uuid', self.uuid)
|
||||
self.instance = datablock_ref
|
||||
|
@ -28,6 +28,7 @@ from .bl_collection import (dump_collection_children, dump_collection_objects,
|
||||
resolve_collection_dependencies)
|
||||
from .bl_datablock import BlDatablock
|
||||
from .dump_anything import Dumper, Loader
|
||||
from ..utils import flush_history
|
||||
|
||||
RENDER_SETTINGS = [
|
||||
'dither_intensity',
|
||||
@ -328,6 +329,10 @@ class BlScene(BlDatablock):
|
||||
'view_settings']['curve_mapping']['black_level']
|
||||
target.view_settings.curve_mapping.update()
|
||||
|
||||
# FIXME: Find a better way after the replication big refacotoring
|
||||
# Keep other user from deleting collection object by flushing their history
|
||||
flush_history()
|
||||
|
||||
def _dump_implementation(self, data, instance=None):
|
||||
assert(instance)
|
||||
|
||||
|
@ -99,8 +99,7 @@ def initialize_session():
|
||||
bpy.ops.session.apply_armature_operator('INVOKE_DEFAULT')
|
||||
|
||||
# Step 0: Clearing history
|
||||
for i in range(bpy.context.preferences.edit.undo_steps+1):
|
||||
bpy.ops.ed.undo_push(message="Multiuser history flush")
|
||||
utils.flush_history()
|
||||
|
||||
|
||||
@session_callback('on_exit')
|
||||
|
@ -65,6 +65,15 @@ def get_datablock_users(datablock):
|
||||
return users
|
||||
|
||||
|
||||
def flush_history():
|
||||
try:
|
||||
logging.info("Flushing history")
|
||||
for i in range(bpy.context.preferences.edit.undo_steps+1):
|
||||
bpy.ops.ed.undo_push(message="Multiuser history flush")
|
||||
except RuntimeError:
|
||||
logging.error("Fail to overwrite history")
|
||||
|
||||
|
||||
def get_state_str(state):
|
||||
state_str = 'UNKOWN'
|
||||
if state == STATE_WAITING:
|
||||
|
Reference in New Issue
Block a user