void ValuePlug::setObjectValue( IECore::ConstObjectPtr value ) { bool haveInput = getInput<Plug>(); if( direction()==In && !haveInput ) { // input plug with no input connection. there can only ever be a single value, // which we store directly on the plug. when setting this we need to take care // of undo, and also of triggering the plugValueSet signal and propagating the // plugDirtiedSignal. if( getFlags( ReadOnly ) ) { // We don't allow static values to be set on read only plugs, so we throw. // Note that it is perfectly acceptable to call setValue() on a read only // plug during a computation because the result is not written onto the // plug itself, so we don't make the check in the case that we call // receiveResult() below. This allows plugs which have inputs to be made // read only after having their input set. throw IECore::Exception( boost::str( boost::format( "Cannot set value for read only plug \"%s\"" ) % fullName() ) ); } if( value->isNotEqualTo( m_staticValue.get() ) ) { Action::enact( new SetValueAction( this, value ) ); } return; } // An input plug with an input connection or an output plug. We must be currently in a computation // triggered by getObjectValue() for a setObjectValue() call to be valid (receiveResult will check this). // We never trigger plugValueSet or plugDirtiedSignals during computation. ComputeProcess::receiveResult( this, value ); }