void IECoreArnold::RendererImplementation::setOption( const std::string &name, IECore::ConstDataPtr value ) { if( 0 == name.compare( 0, 3, "ai:" ) ) { AtNode *options = AiUniverseGetOptions(); const AtParamEntry *parameter = AiNodeEntryLookUpParameter( AiNodeGetNodeEntry( options ), name.c_str() + 3 ); if( parameter ) { ParameterAlgo::setParameter( options, name.c_str() + 3, value.get() ); return; } } else if( 0 == name.compare( 0, 5, "user:"******":" )!=string::npos ) { // ignore options prefixed for some other renderer return; } msg( Msg::Warning, "IECoreArnold::RendererImplementation::setOption", format( "Unknown option \"%s\"." ) % name ); }
void IECoreRI::SXRendererImplementation::setOption( const std::string &name, IECore::ConstDataPtr value ) { if( name.compare( 0, 3, "ri:" )==0 || name.compare( 0, 3, "sx:" )==0 ) { switch( value->typeId() ) { case IntDataTypeId : SxSetOption( m_stateStack.top().context.get(), name.c_str() + 3, SxInt, (void *)&(static_cast<const IntData *>( value.get() )->readable() ) ); break; case FloatDataTypeId : SxSetOption( m_stateStack.top().context.get(), name.c_str() + 3, SxFloat, (void *)&(static_cast<const FloatData *>( value.get() )->readable() ) ); break; case StringDataTypeId : { const char *s = static_cast<const StringData *>( value.get() )->readable().c_str(); SxSetOption( m_stateStack.top().context.get(), name.c_str() + 3, SxString, &s ); break; } default : msg( Msg::Warning, "IECoreRI::SXRendererImplementation::setOption", format( "Unsupport type \"%s\"." ) % value->typeName() ); } } else if( name.compare( 0, 5, "user:"******"IECoreRI::SXRendererImplementation::setOption", format( "Unsupport type \"%s\"." ) % value->typeName() ); } } else if( name.find_first_of( ":" )!=string::npos ) { // ignore options prefixed for some other renderer } else { msg( Msg::Warning, "IECoreRI::SXRendererImplementation::setOption", format( "Unknown option \"%s\"." ) % name ); } }
void Shader::Setup::addUniformParameter( const std::string &name, IECore::ConstDataPtr value ) { const Parameter *p = m_memberData->shader->uniformParameter( name ); if( !p ) { return; } if( p->size > 1 ) { IECore::msg( IECore::Msg::Warning, "Shader::Setup::addUniformParameter", format( "Array parameter \"%s\" is currently unsupported." ) % name ); return; } if( p->type == GL_BOOL || p->type == GL_INT || p->type == GL_INT_VEC2 || p->type == GL_INT_VEC3 ) { // integer value vector<GLint> integers; if( value->isInstanceOf( IECore::BoolDataTypeId ) ) { integers.push_back( static_cast<const IECore::BoolData *>( value.get() )->readable() ); } else { UniformDataConverter<vector<GLint> > converter( integers ); IECore::despatchTypedData< UniformDataConverter<vector<GLint> >, IECore::TypeTraits::IsNumericBasedTypedData, DespatchTypedDataIgnoreError>( IECore::constPointerCast<IECore::Data>( value ), converter ); } if( !integers.size() ) { IECore::msg( IECore::Msg::Warning, "Shader::Setup::addUniformParameter", format( "Uniform parameter \"%s\" has unsuitable data type \%s\"" ) % name % value->typeName() ); }
void OSLRenderer::setOption( const std::string &name, IECore::ConstDataPtr value ) { if( boost::starts_with( name, "osl:" ) ) { const void *data = 0; TypeDesc typeDesc = typeDescFromData( value.get(), data ); if( data ) { m_shadingSystem->attribute( name.c_str() + 4, typeDesc, data ); } else { msg( Msg::Warning, "OSLRenderer::setOption", boost::format( "Option \"%s\" has unsupported type \"%s\"" ) % name % value->typeName() ); } } else if( boost::starts_with( name, "user:"******"OSLRenderer::setOption", boost::format( "Unsupported option \"%s\"" ) % name ); } else { // option is for another renderer and can be ignored. } }