From 349b592d199761397b578b934d89c4bad623ffec Mon Sep 17 00:00:00 2001 From: David Cattermole Date: Sat, 22 Jun 2024 01:23:54 +1000 Subject: [PATCH] mmImagePlaneShape2 - Unlock/Relock color space attributes This will fix an error caused when the user changes the Image Sequence slot. --- .../tools/createimageplane/_lib/main.py | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/python/mmSolver/tools/createimageplane/_lib/main.py b/python/mmSolver/tools/createimageplane/_lib/main.py index 32fd8bc8..633815a7 100644 --- a/python/mmSolver/tools/createimageplane/_lib/main.py +++ b/python/mmSolver/tools/createimageplane/_lib/main.py @@ -171,6 +171,13 @@ def _set_image_sequence_v1(mm_image_plane_node, image_sequence_path, attr_name=N return +def _set_locked_string_attr(node_attr, value): + maya.cmds.setAttr(node_attr, lock=False) + maya.cmds.setAttr(node_attr, value, type='string') + maya.cmds.setAttr(node_attr, lock=True) + return + + def _set_image_sequence_v2(mm_image_plane_node, image_sequence_path, attr_name=None): if attr_name is None: attr_name = lib_const.DEFAULT_IMAGE_SEQUENCE_ATTR_NAME @@ -208,16 +215,11 @@ def _set_image_sequence_v2(mm_image_plane_node, image_sequence_path, attr_name=N input_color_space = _guess_color_space(first_frame_file_seq) output_color_space = maya.cmds.mmColorIO(roleSceneLinear=True) - maya.cmds.setAttr( - shp + '.' + lib_const.INPUT_COLOR_SPACE_ATTR_NAME, - input_color_space, - type='string', - ) - maya.cmds.setAttr( - shp + '.' + lib_const.OUTPUT_COLOR_SPACE_ATTR_NAME, - output_color_space, - type='string', - ) + node_attr = shp + '.' + lib_const.INPUT_COLOR_SPACE_ATTR_NAME + _set_locked_string_attr(node_attr, input_color_space) + + node_attr = shp + '.' + lib_const.OUTPUT_COLOR_SPACE_ATTR_NAME + _set_locked_string_attr(node_attr, output_color_space) return