From 86c1207f5405b17ef4613ed16d981f767482efb0 Mon Sep 17 00:00:00 2001 From: John Haddon Date: Fri, 27 Oct 2023 14:50:22 +0100 Subject: [PATCH] PlugLayout : Update layout when custom widget metadata changes This fixes the hiding of the unwanted "Execute" buttons in the DispatchDialogue, because it overwrites the `layout:customWidget:dispatchButton:widgetType` metadata _after_ creating the UI for the nodes. --- Changes.md | 2 ++ python/GafferUI/PlugLayout.py | 3 +++ python/GafferUITest/PlugLayoutTest.py | 3 +++ 3 files changed, 8 insertions(+) diff --git a/Changes.md b/Changes.md index 55e383e8d38..8db0d3d097c 100644 --- a/Changes.md +++ b/Changes.md @@ -21,6 +21,8 @@ Fixes - Fixed a bug preventing anything except strings from being copied and pasted. - Fixed likely cause of crash when resizing Spreadsheet column width (#5296). - Reference : Fixed rare reloading error. +- PlugLayout : Fixed lack of update when `layout:customWidget:*` metadata changes. +- Dispatch app : Removed unnecessary and misleading "Execute" button. 1.3.5.0 (relative to 1.3.4.0) ======= diff --git a/python/GafferUI/PlugLayout.py b/python/GafferUI/PlugLayout.py index 0f65d6117fd..f0ef601d675 100644 --- a/python/GafferUI/PlugLayout.py +++ b/python/GafferUI/PlugLayout.py @@ -530,6 +530,9 @@ def __parentMetadataChanged( self, key ) : if re.match( self.__layoutName + ":section:.*:summary", key ) : self.__summariesDirty = True self.__updateLazily() + elif re.match( self.__layoutName + ":customWidget:.*", key ) : + self.__layoutDirty = True + self.__updateLazily() def __plugDirtied( self, plug ) : diff --git a/python/GafferUITest/PlugLayoutTest.py b/python/GafferUITest/PlugLayoutTest.py index 599fa4d1363..bcc6d83fad6 100644 --- a/python/GafferUITest/PlugLayoutTest.py +++ b/python/GafferUITest/PlugLayoutTest.py @@ -100,6 +100,9 @@ def testCustomWidgets( self ) : self.assertTrue( isinstance( p.customWidget( "test" ), self.CustomWidget ) ) self.assertTrue( p.customWidget( "test" ).node.isSame( n ) ) + Gaffer.Metadata.registerValue( n, "layout:customWidget:test:widgetType", "" ) + self.assertIsNone( p.customWidget( "test") ) + def testSectionQueries( self ) : n = Gaffer.Node()