parent
f5232ccea0
commit
79ccac915f
@ -101,6 +101,8 @@ class BlDatablock(ReplicatedDatablock):
|
||||
super().__init__(*args, **kwargs)
|
||||
instance = kwargs.get('instance', None)
|
||||
|
||||
self.preferences = utils.get_preferences()
|
||||
|
||||
# TODO: use is_library_indirect
|
||||
self.is_library = (instance and hasattr(instance, 'library') and
|
||||
instance.library) or \
|
||||
|
@ -27,7 +27,6 @@ from replication.constants import DIFF_BINARY
|
||||
from replication.exception import ContextError
|
||||
from .bl_datablock import BlDatablock
|
||||
|
||||
|
||||
VERTICE = ['co']
|
||||
|
||||
EDGE = [
|
||||
@ -114,7 +113,7 @@ class BlMesh(BlDatablock):
|
||||
def _dump_implementation(self, data, instance=None):
|
||||
assert(instance)
|
||||
|
||||
if instance.is_editmode:
|
||||
if instance.is_editmode and not self.preferences.enable_editmode_updates:
|
||||
raise ContextError("Mesh is in edit mode")
|
||||
mesh = instance
|
||||
|
||||
|
@ -16,14 +16,15 @@
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
|
||||
import bpy
|
||||
import mathutils
|
||||
import logging
|
||||
|
||||
from .dump_anything import Loader, Dumper
|
||||
from .bl_datablock import BlDatablock
|
||||
import bpy
|
||||
import mathutils
|
||||
from replication.exception import ContextError
|
||||
|
||||
from .bl_datablock import BlDatablock
|
||||
from .dump_anything import Dumper, Loader
|
||||
|
||||
|
||||
def load_pose(target_bone, data):
|
||||
target_bone.rotation_mode = data['rotation_mode']
|
||||
@ -31,6 +32,13 @@ def load_pose(target_bone, data):
|
||||
loader.load(target_bone, data)
|
||||
|
||||
|
||||
def _is_editmode(object: bpy.types.Object) -> bool:
|
||||
child_data = getattr(object, 'data', None)
|
||||
return (child_data and
|
||||
hasattr(child_data, 'is_editmode') and
|
||||
child_data.is_editmode)
|
||||
|
||||
|
||||
class BlObject(BlDatablock):
|
||||
bl_id = "objects"
|
||||
bl_class = bpy.types.Object
|
||||
@ -147,7 +155,6 @@ class BlObject(BlDatablock):
|
||||
if 'constraints' in bone_data.keys():
|
||||
loader.load(target_bone, bone_data['constraints'])
|
||||
|
||||
|
||||
load_pose(target_bone, bone_data)
|
||||
|
||||
if 'bone_index' in bone_data.keys():
|
||||
@ -163,9 +170,10 @@ class BlObject(BlDatablock):
|
||||
def _dump_implementation(self, data, instance=None):
|
||||
assert(instance)
|
||||
|
||||
child_data = getattr(instance, 'data', None)
|
||||
|
||||
if child_data and hasattr(child_data, 'is_editmode') and child_data.is_editmode:
|
||||
if _is_editmode(instance):
|
||||
if self.preferences.enable_editmode_updates:
|
||||
instance.update_from_editmode()
|
||||
else:
|
||||
raise ContextError("Object is in edit-mode.")
|
||||
|
||||
dumper = Dumper()
|
||||
@ -211,7 +219,6 @@ class BlObject(BlDatablock):
|
||||
data["modifiers"][modifier.name] = dumper.dump(modifier)
|
||||
|
||||
# CONSTRAINTS
|
||||
# OBJECT
|
||||
if hasattr(instance, 'constraints'):
|
||||
dumper.depth = 3
|
||||
data["constraints"] = dumper.dump(instance.constraints)
|
||||
@ -264,7 +271,8 @@ class BlObject(BlDatablock):
|
||||
|
||||
# VERTEx GROUP
|
||||
if len(instance.vertex_groups) > 0:
|
||||
points_attr = 'vertices' if isinstance(instance.data, bpy.types.Mesh) else 'points'
|
||||
points_attr = 'vertices' if isinstance(
|
||||
instance.data, bpy.types.Mesh) else 'points'
|
||||
vg_data = []
|
||||
for vg in instance.vertex_groups:
|
||||
vg_idx = vg.index
|
||||
@ -334,4 +342,3 @@ class BlObject(BlDatablock):
|
||||
deps.append(self.instance.instance_collection)
|
||||
|
||||
return deps
|
||||
|
||||
|
@ -631,7 +631,7 @@ def depsgraph_evaluation(scene):
|
||||
context = bpy.context
|
||||
blender_depsgraph = bpy.context.view_layer.depsgraph
|
||||
dependency_updates = [u for u in blender_depsgraph.updates]
|
||||
session_infos = utils.get_preferences()
|
||||
settings = utils.get_preferences()
|
||||
|
||||
# NOTE: maybe we don't need to check each update but only the first
|
||||
|
||||
@ -647,7 +647,8 @@ def depsgraph_evaluation(scene):
|
||||
# - if its to someone else, ignore the update (go deeper ?)
|
||||
if node and node.owner in [client.id, RP_COMMON] and node.state == UP:
|
||||
# Avoid slow geometry update
|
||||
if 'EDIT' in context.mode:
|
||||
if 'EDIT' in context.mode and \
|
||||
not settings.enable_editmode_updates:
|
||||
break
|
||||
|
||||
client.stash(node.uuid)
|
||||
|
@ -137,11 +137,17 @@ class SessionPrefs(bpy.types.AddonPreferences):
|
||||
('DEPSGRAPH', "Depsgraph", "Experimental: Use the blender dependency graph to trigger updates"),
|
||||
],
|
||||
)
|
||||
# Replication update settings
|
||||
depsgraph_update_rate: bpy.props.IntProperty(
|
||||
name='depsgraph update rate',
|
||||
description='Dependency graph uppdate rate (milliseconds)',
|
||||
default=100
|
||||
)
|
||||
enable_editmode_updates: bpy.props.BoolProperty(
|
||||
name="Edit mode updates",
|
||||
description="Enable objects update in edit mode (! Impact performances !)",
|
||||
default=False
|
||||
)
|
||||
# for UI
|
||||
category: bpy.props.EnumProperty(
|
||||
name="Category",
|
||||
|
@ -299,15 +299,19 @@ class SESSION_PT_advanced_settings(bpy.types.Panel):
|
||||
replication_section = layout.row().box()
|
||||
replication_section.label(text="Replication ", icon='TRIA_DOWN')
|
||||
replication_section_row = replication_section.row()
|
||||
if runtime_settings.session_mode == 'HOST':
|
||||
replication_section_row.label(text="Sync flags:")
|
||||
replication_section_row = replication_section.row()
|
||||
replication_section_row.prop(settings.sync_flags, "sync_render_settings")
|
||||
|
||||
replication_section_row = replication_section.row()
|
||||
# replication_section_row.label(text=":", icon='EDITMODE_HLT')
|
||||
replication_section_row.prop(settings, "enable_editmode_updates")
|
||||
replication_section_row = replication_section.row()
|
||||
replication_section_row.label(text="Update method:")
|
||||
replication_section_row.prop(settings, "update_method", text="")
|
||||
replication_section_row = replication_section.row()
|
||||
replication_section_row.prop(settings, "update_method", expand=True)
|
||||
replication_section_row = replication_section.row()
|
||||
replication_timers = replication_section_row.box()
|
||||
replication_timers.label(text="Per data type timers", icon='TIME')
|
||||
replication_timers.label(text="Replication timers", icon='TIME')
|
||||
if settings.update_method == "DEFAULT":
|
||||
replication_timers = replication_timers.row()
|
||||
# Replication frequencies
|
||||
|
Loading…
x
Reference in New Issue
Block a user