fix: image renamin support

fix: sync Color Space Settings

related to #201
This commit is contained in:
Swann 2021-06-29 15:59:26 +02:00
parent e706c8e0bf
commit a207c51973
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB
5 changed files with 12 additions and 17 deletions

View File

@ -56,7 +56,7 @@ class BlCamera(ReplicatedDatablock):
background_images = data.get('background_images') background_images = data.get('background_images')
datablock.background_images.clear() datablock.background_images.clear()
# TODO: Use image uuid
if background_images: if background_images:
for img_name, img_data in background_images.items(): for img_name, img_data in background_images.items():
img_id = img_data.get('image') img_id = img_data.get('image')

View File

@ -69,11 +69,12 @@ class BlImage(ReplicatedDatablock):
@staticmethod @staticmethod
def load(data: dict, datablock: object): def load(data: dict, datablock: object):
loader = Loader() loader = Loader()
loader.load(data, datablock) loader.load(datablock, data)
# datablock.name = data.get('name')
datablock.source = 'FILE' datablock.source = 'FILE'
datablock.filepath_raw = get_filepath(data['filename']) datablock.filepath_raw = get_filepath(data['filename'])
color_space_name = data["colorspace_settings"]["name"] color_space_name = data.get("colorspace")
if color_space_name: if color_space_name:
datablock.colorspace_settings.name = color_space_name datablock.colorspace_settings.name = color_space_name
@ -92,12 +93,10 @@ class BlImage(ReplicatedDatablock):
"name", "name",
# 'source', # 'source',
'size', 'size',
'height', 'alpha_mode']
'alpha',
'float_buffer',
'alpha_mode',
'colorspace_settings']
data.update(dumper.dump(datablock)) data.update(dumper.dump(datablock))
data['colorspace'] = datablock.colorspace_settings.name
return data return data
@staticmethod @staticmethod
@ -132,10 +131,7 @@ class BlImage(ReplicatedDatablock):
if datablock.is_dirty: if datablock.is_dirty:
datablock.save() datablock.save()
if not data or (datablock and (datablock.name != data.get('name'))): return True
return True
else:
return False
_type = bpy.types.Image _type = bpy.types.Image
_class = BlImage _class = BlImage

View File

@ -124,8 +124,7 @@ def dump_node(node: bpy.types.ShaderNode) -> dict:
"show_preview", "show_preview",
"show_texture", "show_texture",
"outputs", "outputs",
"width_hidden", "width_hidden"
"image"
] ]
dumped_node = node_dumper.dump(node) dumped_node = node_dumper.dump(node)

View File

@ -52,7 +52,8 @@ def sanitize_deps_graph(remove_nodes: bool = False):
def update_external_dependencies(): def update_external_dependencies():
"""Force external dependencies(files such as images) evaluation """Force external dependencies(files such as images) evaluation
""" """
nodes_ids = [n.uuid for n in session.repository.graph.values() if n.data['type_id'] in ['WindowsPath', 'PosixPath']] external_types = ['WindowsPath', 'PosixPath', 'Image']
nodes_ids = [n.uuid for n in session.repository.graph.values() if n.data['type_id'] in external_types]
for node_id in nodes_ids: for node_id in nodes_ids:
node = session.repository.graph.get(node_id) node = session.repository.graph.get(node_id)
if node and node.owner in [session.repository.username, RP_COMMON]: if node and node.owner in [session.repository.username, RP_COMMON]:

View File

@ -273,8 +273,7 @@ class SessionStartOperator(bpy.types.Operator):
session_update = timers.SessionStatusUpdate() session_update = timers.SessionStatusUpdate()
session_user_sync = timers.SessionUserSync() session_user_sync = timers.SessionUserSync()
session_background_executor = timers.MainThreadExecutor( session_background_executor = timers.MainThreadExecutor(execution_queue=background_execution_queue)
execution_queue=background_execution_queue)
session_listen = timers.SessionListenTimer(timeout=0.001) session_listen = timers.SessionListenTimer(timeout=0.001)
session_listen.register() session_listen.register()