Exemplo n.º 1
0
ObjectPtr ModifyOp::doOperation( const CompoundObject *operands )
{
	ObjectPtr object = m_inputParameter->getValue();
	if( m_copyParameter->getTypedValue() )
	{
		object = object->copy();
	}
	if( m_enableParameter->getTypedValue() )
	{
		modify( object, operands );
	}
	return object;
}
Exemplo n.º 2
0
Parameter::Parameter( const std::string &name, const std::string &description, ObjectPtr defaultValue,
                      const PresetsContainer &presets, bool presetsOnly, ConstCompoundObjectPtr userData )
    :	m_name( name ), m_description( description ), m_defaultValue( defaultValue ), m_presetsOnly( presetsOnly ),
      m_userData( userData ? userData->copy() : 0 )
{
    if ( !defaultValue )
    {
        throw Exception( "Invalid NULL default value!" );
    }

    for( PresetsContainer::const_iterator it=presets.begin(); it!=presets.end(); it++ )
    {
        m_presets.push_back( PresetsContainer::value_type( it->first, it->second->copy() ) );
    }

    /// \todo If presetsOnly is true, doesn't this allow us to set a defaultValue that isn't in the presets list?
    setValue( defaultValue->copy() );
}