MStatus ClassParameterHandler::doSetValue( const MPlug &plug, IECore::ParameterPtr parameter ) const { if( !parameter || !parameter->isInstanceOf( IECore::ClassParameterTypeId ) ) { return MS::kFailure; } return MS::kSuccess; }
bool ParameterisedHolder<B>::setParameterisedValuesWalk( bool lazy, IECore::ParameterPtr parameter, MStatus &status ) { MFnDependencyNode fnDN( B::thisMObject() ); // traverse child parameters if we have them bool childParametersWereSet = false; if( parameter->isInstanceOf( CompoundParameter::staticTypeId() ) ) { CompoundParameterPtr compoundParameter = boost::static_pointer_cast<CompoundParameter>( parameter ); const CompoundParameter::ParameterVector &childParameters = compoundParameter->orderedParameters(); for( CompoundParameter::ParameterVector::const_iterator cIt=childParameters.begin(); cIt!=childParameters.end(); cIt++ ) { bool b = setParameterisedValuesWalk( lazy, *cIt, status ); childParametersWereSet = childParametersWereSet || b; } } // then set this parameter if necessary bool thisParameterWasSet = false; if( parameter->name()!="" && (!lazy || m_dirtyParameters.find( parameter )!=m_dirtyParameters.end()) ) { ParameterToAttributeNameMap::const_iterator nIt = m_parametersToAttributeNames.find( parameter ); if( nIt==m_parametersToAttributeNames.end() ) { msg( Msg::Error, "ParameterisedHolder::setParameterisedValues", boost::format( "Unable to find plug name for parameter %s" ) % parameter->name() ); status = MS::kFailure; } else { MPlug p = fnDN.findPlug( nIt->second ); if( p.isNull() ) { msg( Msg::Error, "ParameterisedHolder::setParameterisedValues", boost::format( "Unable to find plug for parameter %s" ) % parameter->name() ); status = MS::kFailure; } else { try { MStatus s = ParameterHandler::setValue( p, parameter ); if( !s ) { msg( Msg::Error, "ParameterisedHolder::setParameterisedValues", boost::format( "Failed to set parameter value from %s" ) % p.name().asChar() ); status = s; } else { m_dirtyParameters.erase( parameter ); thisParameterWasSet = true; } } catch( std::exception &e ) { msg( Msg::Error, "ParameterisedHolder::setParameterisedValues", boost::format( "Caught exception while setting parameter value from %s : %s" ) % p.name().asChar() % e.what()); status = MS::kFailure; } catch( ... ) { msg( Msg::Error, "ParameterisedHolder::setParameterisedValues", boost::format( "Caught unknown exception while setting parameter value from %s" ) % p.name().asChar() ); status = MS::kFailure; } } } } // increment the updateCount if necessary if( thisParameterWasSet || childParametersWereSet ) { CompoundObjectPtr userData = parameter->userData(); IntDataPtr updateCount = userData->member<IntData>( "updateCount" ); if( !updateCount ) { updateCount = new IntData( 0 ); userData->members()["updateCount"] = updateCount; } else { updateCount->writable()++; } } return childParametersWereSet || thisParameterWasSet; }