clean: timer related settings

This commit is contained in:
Swann 2021-02-12 10:49:04 +01:00
parent cdcb2de786
commit 1dd0235061
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB
28 changed files with 6 additions and 120 deletions

View File

@ -132,9 +132,6 @@ def load_fcurve(fcurve_data, fcurve):
class BlAction(BlDatablock):
bl_id = "actions"
bl_class = bpy.types.Action
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'ACTION_TWEAK'
bl_reload_parent = False

View File

@ -38,9 +38,6 @@ def get_roll(bone: bpy.types.Bone) -> float:
class BlArmature(BlDatablock):
bl_id = "armatures"
bl_class = bpy.types.Armature
bl_delay_refresh = 1
bl_delay_apply = 0
bl_automatic_push = True
bl_check_common = False
bl_icon = 'ARMATURE_DATA'
bl_reload_parent = False

View File

@ -26,9 +26,6 @@ from .bl_datablock import BlDatablock
class BlCamera(BlDatablock):
bl_id = "cameras"
bl_class = bpy.types.Camera
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'CAMERA_DATA'
bl_reload_parent = False

View File

@ -85,9 +85,6 @@ class BlCollection(BlDatablock):
bl_id = "collections"
bl_icon = 'FILE_FOLDER'
bl_class = bpy.types.Collection
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = True
bl_reload_parent = False

View File

@ -137,9 +137,6 @@ SPLINE_METADATA = [
class BlCurve(BlDatablock):
bl_id = "curves"
bl_class = bpy.types.Curve
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'CURVE_DATA'
bl_reload_parent = False

View File

@ -106,9 +106,6 @@ class BlDatablock(ReplicatedDatablock):
bl_id : blender internal storage identifier
bl_class : blender internal type
bl_delay_refresh : refresh rate in second for observers
bl_delay_apply : refresh rate in sec for apply
bl_automatic_push : boolean
bl_icon : type icon (blender icon name)
bl_check_common: enable check even in common rights
bl_reload_parent: reload parent

View File

@ -54,9 +54,6 @@ class BlFile(ReplicatedDatablock):
bl_id = 'file'
bl_name = "file"
bl_class = Path
bl_delay_refresh = 2
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'FILE'
bl_reload_parent = True

View File

@ -30,9 +30,6 @@ from .dump_anything import Dumper, Loader
class BlFont(BlDatablock):
bl_id = "fonts"
bl_class = bpy.types.VectorFont
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'FILE_FONT'
bl_reload_parent = False

View File

@ -231,9 +231,6 @@ def load_layer(layer_data, layer):
class BlGpencil(BlDatablock):
bl_id = "grease_pencils"
bl_class = bpy.types.GreasePencil
bl_delay_refresh = 2
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'GREASEPENCIL'
bl_reload_parent = False

View File

@ -51,9 +51,6 @@ format_to_ext = {
class BlImage(BlDatablock):
bl_id = "images"
bl_class = bpy.types.Image
bl_delay_refresh = 2
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'IMAGE_DATA'
bl_reload_parent = False

View File

@ -29,9 +29,6 @@ POINT = ['co', 'weight_softbody', 'co_deform']
class BlLattice(BlDatablock):
bl_id = "lattices"
bl_class = bpy.types.Lattice
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'LATTICE_DATA'
bl_reload_parent = False

View File

@ -26,9 +26,6 @@ from .bl_datablock import BlDatablock
class BlLibrary(BlDatablock):
bl_id = "libraries"
bl_class = bpy.types.Library
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'LIBRARY_DATA_DIRECT'
bl_reload_parent = False

View File

@ -26,9 +26,6 @@ from .bl_datablock import BlDatablock
class BlLight(BlDatablock):
bl_id = "lights"
bl_class = bpy.types.Light
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'LIGHT_DATA'
bl_reload_parent = False

View File

@ -27,9 +27,6 @@ from .bl_datablock import BlDatablock
class BlLightprobe(BlDatablock):
bl_id = "lightprobes"
bl_class = bpy.types.LightProbe
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'LIGHTPROBE_GRID'
bl_reload_parent = False

View File

@ -364,9 +364,6 @@ def load_materials_slots(src_materials: list, dst_materials: bpy.types.bpy_prop_
class BlMaterial(BlDatablock):
bl_id = "materials"
bl_class = bpy.types.Material
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'MATERIAL_DATA'
bl_reload_parent = False

View File

@ -50,9 +50,6 @@ POLYGON = [
class BlMesh(BlDatablock):
bl_id = "meshes"
bl_class = bpy.types.Mesh
bl_delay_refresh = 2
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'MESH_DATA'
bl_reload_parent = False

View File

@ -65,9 +65,6 @@ def load_metaball_elements(elements_data, elements):
class BlMetaball(BlDatablock):
bl_id = "metaballs"
bl_class = bpy.types.MetaBall
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'META_BALL'
bl_reload_parent = False

View File

@ -28,9 +28,6 @@ from .bl_material import (dump_shader_node_tree,
class BlNodeGroup(BlDatablock):
bl_id = "node_groups"
bl_class = bpy.types.ShaderNodeTree
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'NODETREE'
bl_reload_parent = False

View File

@ -107,9 +107,6 @@ def find_textures_dependencies(collection):
class BlObject(BlDatablock):
bl_id = "objects"
bl_class = bpy.types.Object
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'OBJECT_DATA'
bl_reload_parent = False

View File

@ -370,9 +370,6 @@ def load_sequence(sequence_data: dict, sequence_editor: bpy.types.SequenceEditor
class BlScene(BlDatablock):
bl_id = "scenes"
bl_class = bpy.types.Scene
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = True
bl_icon = 'SCENE_DATA'
bl_reload_parent = False

View File

@ -30,9 +30,6 @@ from .dump_anything import Dumper, Loader
class BlSound(BlDatablock):
bl_id = "sounds"
bl_class = bpy.types.Sound
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'SOUND'
bl_reload_parent = False

View File

@ -26,9 +26,6 @@ from .bl_datablock import BlDatablock
class BlSpeaker(BlDatablock):
bl_id = "speakers"
bl_class = bpy.types.Speaker
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'SPEAKER'
bl_reload_parent = False

View File

@ -26,9 +26,6 @@ from .bl_datablock import BlDatablock
class BlTexture(BlDatablock):
bl_id = "textures"
bl_class = bpy.types.Texture
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'TEXTURE'
bl_reload_parent = False

View File

@ -27,9 +27,6 @@ from .bl_material import dump_materials_slots, load_materials_slots
class BlVolume(BlDatablock):
bl_id = "volumes"
bl_class = bpy.types.Volume
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'VOLUME_DATA'
bl_reload_parent = False

View File

@ -29,9 +29,6 @@ from .bl_material import (load_shader_node_tree,
class BlWorld(BlDatablock):
bl_id = "worlds"
bl_class = bpy.types.World
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = True
bl_icon = 'WORLD_DATA'
bl_reload_parent = False

View File

@ -97,8 +97,6 @@ def get_log_level(self):
class ReplicatedDatablock(bpy.types.PropertyGroup):
type_name: bpy.props.StringProperty()
bl_name: bpy.props.StringProperty()
bl_delay_refresh: bpy.props.FloatProperty()
bl_delay_apply: bpy.props.FloatProperty()
use_as_filter: bpy.props.BoolProperty(default=True)
auto_push: bpy.props.BoolProperty(default=True)
icon: bpy.props.StringProperty()
@ -273,11 +271,6 @@ class SessionPrefs(bpy.types.AddonPreferences):
description="Rights",
default=False
)
conf_session_timing_expanded: bpy.props.BoolProperty(
name="timings",
description="timings",
default=False
)
conf_session_cache_expanded: bpy.props.BoolProperty(
name="Cache",
description="cache",
@ -382,24 +375,6 @@ class SessionPrefs(bpy.types.AddonPreferences):
row.label(text="Init the session from:")
row.prop(self, "init_method", text="")
table = box.box()
table.row().prop(
self, "conf_session_timing_expanded", text="Refresh rates",
icon=get_expanded_icon(self.conf_session_timing_expanded),
emboss=False)
if self.conf_session_timing_expanded:
line = table.row()
line.label(text=" ")
line.separator()
line.label(text="refresh (sec)")
line.label(text="apply (sec)")
for item in self.supported_datablocks:
line = table.row(align=True)
line.label(text="", icon=item.icon)
line.prop(item, "bl_delay_refresh", text="")
line.prop(item, "bl_delay_apply", text="")
# HOST SETTINGS
box = grid.box()
box.prop(
@ -455,11 +430,8 @@ class SessionPrefs(bpy.types.AddonPreferences):
type_module_class = getattr(type_module, type_impl_name)
new_db.name = type_impl_name
new_db.type_name = type_impl_name
new_db.bl_delay_refresh = type_module_class.bl_delay_refresh
new_db.bl_delay_apply = type_module_class.bl_delay_apply
new_db.use_as_filter = True
new_db.icon = type_module_class.bl_icon
new_db.auto_push = type_module_class.bl_automatic_push
new_db.bl_name = type_module_class.bl_id

View File

@ -101,16 +101,8 @@ class SessionBackupTimer(Timer):
session.save(self._filepath)
class ApplyTimer(Timer):
def __init__(self, timeout=1, target_type=None):
self._type = target_type
super().__init__(timeout)
self.id = target_type.__name__ if target_type else "ApplyTimer"
def execute(self):
if session and session.state['STATE'] == STATE_ACTIVE:
if self._type:
nodes = session.list(filter=self._type)
else:
nodes = session.list()
for node in nodes:
@ -122,13 +114,10 @@ class ApplyTimer(Timer):
except Exception as e:
logging.error(f"Fail to apply {node_ref.uuid}: {e}")
else:
if self._type.bl_reload_parent:
parents = []
for n in session.list():
deps = session.get(uuid=n).dependencies
if deps and node in deps:
session.apply(n, force=True)
if node_ref.bl_reload_parent:
for parent in session._graph.find_parents(node):
logging.debug("Refresh parent {node}")
session.apply(parent, force=True)
class DynamicRightSelectTimer(Timer):

View File

@ -281,7 +281,7 @@ class SESSION_PT_advanced_settings(bpy.types.Panel):
warning = replication_section_row.box()
warning.label(text="Don't use this with heavy meshes !", icon='ERROR')
replication_section_row = replication_section.row()
replication_section_row.prop(settings, "depsgraph_update_rate")
replication_section_row.prop(settings, "depsgraph_update_rate", text="Apply delay")
cache_section = layout.row().box()