feat: active camera sync flag
This commit is contained in:
@ -60,6 +60,7 @@ class BlScene(BlDatablock):
|
|||||||
# Annotation
|
# Annotation
|
||||||
if 'grease_pencil' in data.keys():
|
if 'grease_pencil' in data.keys():
|
||||||
target.grease_pencil = bpy.data.grease_pencils[data['grease_pencil']]
|
target.grease_pencil = bpy.data.grease_pencils[data['grease_pencil']]
|
||||||
|
|
||||||
if self.preferences.sync_flags.sync_render_settings:
|
if self.preferences.sync_flags.sync_render_settings:
|
||||||
if 'eevee' in data.keys():
|
if 'eevee' in data.keys():
|
||||||
loader.load(target.eevee, data['eevee'])
|
loader.load(target.eevee, data['eevee'])
|
||||||
@ -88,12 +89,14 @@ class BlScene(BlDatablock):
|
|||||||
'name',
|
'name',
|
||||||
'world',
|
'world',
|
||||||
'id',
|
'id',
|
||||||
'camera',
|
|
||||||
'grease_pencil',
|
'grease_pencil',
|
||||||
'frame_start',
|
'frame_start',
|
||||||
'frame_end',
|
'frame_end',
|
||||||
'frame_step',
|
'frame_step',
|
||||||
]
|
]
|
||||||
|
if self.preferences.sync_flags.sync_active_camera:
|
||||||
|
scene_dumper.include_filter.append('camera')
|
||||||
|
|
||||||
data = scene_dumper.dump(instance)
|
data = scene_dumper.dump(instance)
|
||||||
|
|
||||||
scene_dumper.depth = 3
|
scene_dumper.depth = 3
|
||||||
@ -172,4 +175,7 @@ class BlScene(BlDatablock):
|
|||||||
exclude_path.append("root['view_settings']")
|
exclude_path.append("root['view_settings']")
|
||||||
exclude_path.append("root['render']")
|
exclude_path.append("root['render']")
|
||||||
|
|
||||||
|
if not self.preferences.sync_flags.sync_active_camera:
|
||||||
|
exclude_path.append("root['camera']")
|
||||||
|
|
||||||
return DeepDiff(self.data, self._dump(instance=self.instance),exclude_paths=exclude_path, cache_size=5000)
|
return DeepDiff(self.data, self._dump(instance=self.instance),exclude_paths=exclude_path, cache_size=5000)
|
@ -99,29 +99,47 @@ class ReplicatedDatablock(bpy.types.PropertyGroup):
|
|||||||
icon: bpy.props.StringProperty()
|
icon: bpy.props.StringProperty()
|
||||||
|
|
||||||
|
|
||||||
def update_scene_settings(self, value):
|
def set_sync_render_settings(self, value):
|
||||||
from .operators import client
|
|
||||||
|
|
||||||
self['sync_render_settings'] = value
|
self['sync_render_settings'] = value
|
||||||
|
|
||||||
|
from .operators import client
|
||||||
if client and bpy.context.scene.uuid and value:
|
if client and bpy.context.scene.uuid and value:
|
||||||
bpy.ops.session.apply('INVOKE_DEFAULT', target=bpy.context.scene.uuid)
|
bpy.ops.session.apply('INVOKE_DEFAULT', target=bpy.context.scene.uuid)
|
||||||
|
|
||||||
|
|
||||||
|
def set_sync_active_camera(self, value):
|
||||||
|
self['sync_active_camera'] = value
|
||||||
|
|
||||||
|
from .operators import client
|
||||||
|
if client and bpy.context.scene.uuid and value:
|
||||||
|
bpy.ops.session.apply('INVOKE_DEFAULT', target=bpy.context.scene.uuid)
|
||||||
|
|
||||||
|
|
||||||
class ReplicationFlags(bpy.types.PropertyGroup):
|
class ReplicationFlags(bpy.types.PropertyGroup):
|
||||||
def get_scene_settings(self):
|
def get_sync_render_settings(self):
|
||||||
return self.get('sync_render_settings', False)
|
return self.get('sync_render_settings', False)
|
||||||
|
|
||||||
|
def get_sync_active_camera(self):
|
||||||
|
return self.get('sync_active_camera', True)
|
||||||
|
|
||||||
sync_render_settings: bpy.props.BoolProperty(
|
sync_render_settings: bpy.props.BoolProperty(
|
||||||
name="Synchronize render settings",
|
name="Synchronize render settings",
|
||||||
description="Synchronize render settings (eevee and cycles only)",
|
description="Synchronize render settings (eevee and cycles only)",
|
||||||
default=True,
|
default=True,
|
||||||
set=update_scene_settings,
|
set=set_sync_render_settings,
|
||||||
get=get_scene_settings)
|
get=get_sync_render_settings)
|
||||||
sync_during_editmode: bpy.props.BoolProperty(
|
sync_during_editmode: bpy.props.BoolProperty(
|
||||||
name="Edit mode updates",
|
name="Edit mode updates",
|
||||||
description="Enable objects update in edit mode (! Impact performances !)",
|
description="Enable objects update in edit mode (! Impact performances !)",
|
||||||
default=False
|
default=False
|
||||||
)
|
)
|
||||||
|
sync_active_camera: bpy.props.BoolProperty(
|
||||||
|
name="Synchronize active camera",
|
||||||
|
description="Synchronize the active camera",
|
||||||
|
default=True,
|
||||||
|
get=get_sync_active_camera,
|
||||||
|
set=set_sync_active_camera
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class SessionPrefs(bpy.types.AddonPreferences):
|
class SessionPrefs(bpy.types.AddonPreferences):
|
||||||
@ -154,7 +172,7 @@ class SessionPrefs(bpy.types.AddonPreferences):
|
|||||||
ipc_port: bpy.props.IntProperty(
|
ipc_port: bpy.props.IntProperty(
|
||||||
name="ipc_port",
|
name="ipc_port",
|
||||||
description='internal ttl port(only usefull for multiple local instances)',
|
description='internal ttl port(only usefull for multiple local instances)',
|
||||||
default=random.randrange(5570,70000),
|
default=random.randrange(5570, 70000),
|
||||||
update=update_port,
|
update=update_port,
|
||||||
)
|
)
|
||||||
init_method: bpy.props.EnumProperty(
|
init_method: bpy.props.EnumProperty(
|
||||||
|
@ -290,6 +290,8 @@ class SESSION_PT_advanced_settings(bpy.types.Panel):
|
|||||||
replication_section_row = replication_section.row()
|
replication_section_row = replication_section.row()
|
||||||
replication_section_row.prop(settings.sync_flags, "sync_render_settings")
|
replication_section_row.prop(settings.sync_flags, "sync_render_settings")
|
||||||
replication_section_row = replication_section.row()
|
replication_section_row = replication_section.row()
|
||||||
|
replication_section_row.prop(settings.sync_flags, "sync_active_camera")
|
||||||
|
replication_section_row = replication_section.row()
|
||||||
|
|
||||||
replication_section_row.prop(settings.sync_flags, "sync_during_editmode")
|
replication_section_row.prop(settings.sync_flags, "sync_during_editmode")
|
||||||
replication_section_row = replication_section.row()
|
replication_section_row = replication_section.row()
|
||||||
@ -496,6 +498,8 @@ class SESSION_PT_synchronization(bpy.types.Panel):
|
|||||||
row.prop(settings.sync_flags, "sync_render_settings")
|
row.prop(settings.sync_flags, "sync_render_settings")
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.prop(settings.sync_flags, "sync_during_editmode")
|
row.prop(settings.sync_flags, "sync_during_editmode")
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(settings.sync_flags, "sync_active_camera")
|
||||||
|
|
||||||
def draw_property(context, parent, property_uuid, level=0):
|
def draw_property(context, parent, property_uuid, level=0):
|
||||||
settings = get_preferences()
|
settings = get_preferences()
|
||||||
|
Reference in New Issue
Block a user