diff --git a/Changes.md b/Changes.md index 71689e0a572..f4861375c5d 100644 --- a/Changes.md +++ b/Changes.md @@ -30,6 +30,7 @@ API - Added `RegistrationTypes` enum that allows the different types of registrations to be identified. - Added improved `registeredValues()` and `value()` overloads that provide finer-grained queries based on the type of registration. - Deprecated `instanceOnly` and `persistentOnly` arguments in favour of new `registrationTypes` arguments. + - Prevented `renameable` and `deletable` metadata from being copied during plug promotion. - MetadataAlgo : Added `deregisterRedundantValues()` method. 1.3.5.0 (relative to 1.3.4.0) diff --git a/python/GafferUI/NodeUI.py b/python/GafferUI/NodeUI.py index c1b3b7ca51e..25d08ceb0fc 100644 --- a/python/GafferUI/NodeUI.py +++ b/python/GafferUI/NodeUI.py @@ -95,6 +95,15 @@ def __documentationURL( node ) : ), + "..." : ( + + # Just because a plug is renameable and/or deletable on one node + # does not mean it should still be when promoted to another. + "renameable:promotable", False, + "deletable:promotable", False, + + ), + } ) diff --git a/python/GafferUITest/BoxIOUITest.py b/python/GafferUITest/BoxIOUITest.py new file mode 100644 index 00000000000..6b803868fdd --- /dev/null +++ b/python/GafferUITest/BoxIOUITest.py @@ -0,0 +1,61 @@ +########################################################################## +# +# Copyright (c) 2023, Cinesite VFX Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above +# copyright notice, this list of conditions and the following +# disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided with +# the distribution. +# +# * Neither the name of John Haddon nor the names of +# any other contributors to this software may be used to endorse or +# promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +########################################################################## + +import unittest + +import Gaffer +import GafferTest +import GafferUI +import GafferUITest + +class BoxIOUITest( GafferUITest.TestCase ) : + + def testNoRedundantMetadata( self ) : + + box = Gaffer.Box() + + box["add"] = GafferTest.AddNode() + + box["switch"] = Gaffer.Switch() + box["switch"].setup( box["add"]["sum"] ) + box["switch"]["in"][0].setInput( box["add"]["sum"] ) + + Gaffer.PlugAlgo.promote( box["switch"]["in"][1] ) + Gaffer.BoxIO.insert( box ) + self.assertEqual( Gaffer.Metadata.registeredValues( box["BoxIn"]["__in"], Gaffer.Metadata.RegistrationTypes.Instance ), [] ) + +if __name__ == "__main__": + unittest.main() diff --git a/python/GafferUITest/__init__.py b/python/GafferUITest/__init__.py index 3ccc688e451..b57c06f8f1e 100644 --- a/python/GafferUITest/__init__.py +++ b/python/GafferUITest/__init__.py @@ -130,6 +130,7 @@ from .StandardNodeToolbarTest import StandardNodeToolbarTest from .LabelPlugValueWidgetTest import LabelPlugValueWidgetTest from .PythonEditorTest import PythonEditorTest +from .BoxIOUITest import BoxIOUITest if __name__ == "__main__": unittest.main()