Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValuePlug : Disconnection no longer emits plugSet signal #6223

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Breaking Changes
----------------

- StandardNodule : Removed deprecated `setCompatibleLabelsVisible()`.
- ValuePlug : Disconnection no longer emits plugSet signal.

1.5.x.x (relative to 1.5.3.0)
=======
Expand Down
2 changes: 0 additions & 2 deletions include/Gaffer/ValuePlug.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ class GAFFER_API ValuePlug : public Plug
/// derive from ValuePlug too, and they can deal with them
/// in setFrom().
bool acceptsInput( const Plug *input ) const override;
/// Reimplemented so that values can be propagated from inputs.
void setInput( PlugPtr input ) override;

PlugPtr createCounterpart( const std::string &name, Direction direction ) const override;

Expand Down
7 changes: 3 additions & 4 deletions python/GafferTest/DependencyNodeTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,17 @@ def testDirtyOnDisconnect( self ) :
n1["op2"].setValue( 3 )

dirtied = GafferTest.CapturingSlot( n2.plugDirtiedSignal() )
set = GafferTest.CapturingSlot( n2.plugSetSignal() )
plugSet = GafferTest.CapturingSlot( n2.plugSetSignal() )
n2["op1"].setInput( n1["sum"] )

self.assertEqual( len( set ), 0 )
self.assertEqual( len( plugSet ), 0 )
self.assertEqual( len( dirtied ), 2 )
self.assertTrue( dirtied[0][0].isSame( n2["op1"] ) )
self.assertTrue( dirtied[1][0].isSame( n2["sum"] ) )

n2["op1"].setInput( None )

self.assertEqual( len( set ), 1 )
self.assertTrue( set[0][0].isSame( n2["op1"] ) )
self.assertEqual( len( plugSet ), 0 )
self.assertEqual( len( dirtied ), 4 )
self.assertTrue( dirtied[2][0].isSame( n2["op1"] ) )
self.assertTrue( dirtied[3][0].isSame( n2["sum"] ) )
Expand Down
14 changes: 0 additions & 14 deletions python/GafferTest/NumericPlugTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,20 +167,6 @@ def testDisconnectRevertsToPreviousValue( self ) :
self.assertEqual( n2["op1"].getInput(), None )
self.assertEqual( n2["op1"].getValue(), 1010 )

def testDisconnectEmitsPlugSet( self ) :

n1 = GafferTest.AddNode()
n2 = GafferTest.AddNode()

n2["op1"].setInput( n1["sum"] )

set = GafferTest.CapturingSlot( n2.plugSetSignal() )

n2["op1"].setInput( None )

self.assertEqual( len( set ), 1 )
self.assertTrue( set[0][0].isSame( n2["op1"] ) )

def testDefaultValue( self ) :

p = Gaffer.IntPlug(
Expand Down
18 changes: 0 additions & 18 deletions src/Gaffer/ValuePlug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,24 +839,6 @@ bool ValuePlug::acceptsInput( const Plug *input ) const
return true;
}

void ValuePlug::setInput( PlugPtr input )
{
// set value back to what it was before
// we received a connection. we do that
// before calling Plug::setInput, so that
// we've got our new state set correctly before
// the dirty signal is emitted. we don't emit
// in the setValueInternal call, because we don't
// want to double up on the signals that the Plug
// is emitting for us in Plug::setInput().
if( getInput() && !input )
{
setValueInternal( m_staticValue, false );
}

Plug::setInput( input );
}

PlugPtr ValuePlug::createCounterpart( const std::string &name, Direction direction ) const
{
PlugPtr result = new ValuePlug( name, direction, getFlags() );
Expand Down