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')
datablock.background_images.clear()
# TODO: Use image uuid
if background_images:
for img_name, img_data in background_images.items():
img_id = img_data.get('image')

View File

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

View File

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

View File

@ -52,7 +52,8 @@ def sanitize_deps_graph(remove_nodes: bool = False):
def update_external_dependencies():
"""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:
node = session.repository.graph.get(node_id)
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_user_sync = timers.SessionUserSync()
session_background_executor = timers.MainThreadExecutor(
execution_queue=background_execution_queue)
session_background_executor = timers.MainThreadExecutor(execution_queue=background_execution_queue)
session_listen = timers.SessionListenTimer(timeout=0.001)
session_listen.register()