本文整理汇总了C++中ConstFloatVectorDataPtr::get方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstFloatVectorDataPtr::get方法的具体用法?C++ ConstFloatVectorDataPtr::get怎么用?C++ ConstFloatVectorDataPtr::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConstFloatVectorDataPtr
的用法示例。
在下文中一共展示了ConstFloatVectorDataPtr::get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadShaderParameters
void RenderManShader::loadShaderParameters( const IECore::Shader *shader, Gaffer::CompoundPlug *parametersPlug, bool keepExistingValues )
{
const CompoundData *typeHints = shader->blindData()->member<CompoundData>( "ri:parameterTypeHints", true );
const StringVectorData *orderedParameterNamesData = shader->blindData()->member<StringVectorData>( "ri:orderedParameterNames", true );
const vector<string> &orderedParameterNames = orderedParameterNamesData->readable();
const StringVectorData *outputParameterNamesData = shader->blindData()->member<StringVectorData>( "ri:outputParameterNames", true );
const vector<string> &outputParameterNames = outputParameterNamesData->readable();
const CompoundData *annotations = shader->blindData()->member<CompoundData>( "ri:annotations", true );
// if we're not preserving existing values then remove all existing parameter plugs - the various
// plug creators above know that if a plug exists then they should preserve its values.
if( !keepExistingValues )
{
for( int i = parametersPlug->children().size() - 1; i >= 0; --i )
{
parametersPlug->removeChild( parametersPlug->getChild<GraphComponent>( i ) );
}
}
// make sure we have a plug to represent each parameter, reusing plugs wherever possible.
set<string> validPlugNames;
for( vector<string>::const_iterator it = orderedParameterNames.begin(), eIt = orderedParameterNames.end(); it != eIt; it++ )
{
if( std::find( outputParameterNames.begin(), outputParameterNames.end(), *it ) != outputParameterNames.end() )
{
continue;
}
// splines are represented by two parameters matched by a naming convention, and we map
// those two parameters to a single SplinePlug.
const bool endsWithValues = ends_with( *it, "Values" );
const bool endsWithPositions = ends_with( *it, "Positions" );
if( endsWithPositions || endsWithValues )
{
string plugName( *it, 0, it->size() - ( endsWithValues ? 6 : 9 ) );
if( validPlugNames.find( plugName ) != validPlugNames.end() )
{
continue;
}
// must use a smart pointers here because we may assign the data the parser creates (and which we therefore own)
ConstFloatVectorDataPtr positions = shader->parametersData()->member<FloatVectorData>( plugName + "Positions" );
ConstDataPtr values = shader->parametersData()->member<Data>( plugName + "Values" );
if( positions && values )
{
const StringData *defaultValuesAnnotation = annotations->member<StringData>( plugName + "Values.defaultValue" );
const StringData *defaultPositionsAnnotation = annotations->member<StringData>( plugName + "Positions.defaultValue" );
if( defaultValuesAnnotation )
{
DataPtr parsedValues;
if( values->isInstanceOf( Color3fVectorData::staticTypeId() ) )
{
parsedValues = parseColors( defaultValuesAnnotation->readable() );
}
else
{
parsedValues = parseFloats( defaultValuesAnnotation->readable() );
}
if( parsedValues )
{
values = parsedValues;
}
else
{
msg(
Msg::Warning, "RenderManShader::loadShaderParameters",
boost::format( "Unable to parse default value \"%s\" for parameter \"%s\"" ) % defaultValuesAnnotation->readable() % ( plugName + "Values" )
);
}
}
if( defaultPositionsAnnotation )
{
FloatVectorDataPtr parsedPositions = parseFloats( defaultPositionsAnnotation->readable() );
if( parsedPositions )
{
positions = parsedPositions;
}
else
{
msg(
Msg::Warning, "RenderManShader::loadShaderParameters",
boost::format( "Unable to parse default value \"%s\" for parameter \"%s\"" ) % defaultPositionsAnnotation->readable() % ( plugName + "Positions" )
);
}
}
switch( values->typeId() )
{
case FloatVectorDataTypeId :
loadSplineParameter<SplineffPlug>( parametersPlug, plugName, positions.get(), values.get() );
//.........这里部分代码省略.........