当前位置: 首页>>代码示例>>C++>>正文


C++ GraphComponent::getName方法代码示例

本文整理汇总了C++中GraphComponent::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphComponent::getName方法的具体用法?C++ GraphComponent::getName怎么用?C++ GraphComponent::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GraphComponent的用法示例。


在下文中一共展示了GraphComponent::getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: loadShaderParameters

static void loadShaderParameters( const OSLQuery &query, Gaffer::CompoundPlug *parametersPlug, bool keepExistingValues )
{	
	
	// 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 )
	{
		parametersPlug->clearChildren();
	}
	
	// make sure we have a plug to represent each parameter, reusing plugs wherever possible.
	
	set<string> validPlugNames;
	for( size_t i = 0; i < query.nparams(); ++i )
	{
		const OSLQuery::Parameter *parameter = query.getparam( i );
		const Plug::Direction direction = parameter->isoutput ? Plug::Out : Plug::In;
		if( direction != parametersPlug->direction() )
		{
			continue;
		} 
		
		if( parameter->name.find( "." ) != string::npos )
		{
			// member of a struct - will be loaded when the struct is loaded
			continue;
		}
		
		const Plug *plug = loadShaderParameter( query, parameter, parametersPlug, keepExistingValues );

		if( plug )
		{
			validPlugNames.insert( parameter->name );
		}
	}
	
	// remove any old plugs which it turned out we didn't need
	
	if( keepExistingValues )
	{
		for( int i = parametersPlug->children().size() - 1; i >= 0; --i )
		{
			GraphComponent *child = parametersPlug->getChild<GraphComponent>( i );
			if( validPlugNames.find( child->getName().string() ) == validPlugNames.end() )
			{
				parametersPlug->removeChild( child );
			}
		}
	}
	
}
开发者ID:JohanAberg,项目名称:gaffer,代码行数:52,代码来源:OSLShader.cpp

示例2: plugName

static Plug *loadStructParameter( const OSLQuery &query, const OSLQuery::Parameter *parameter, Gaffer::CompoundPlug *parent, bool keepExistingValues )
{
	CompoundPlug *result = NULL;

	const string name = plugName( parameter );
	CompoundPlug *existingPlug = parent->getChild<CompoundPlug>( name );
	if( existingPlug )
	{
		if( !keepExistingValues )
		{
			existingPlug->clearChildren();
		}
		result = existingPlug;
	}
	else
	{
		result = new CompoundPlug( name, parent->direction(), Plug::Default | Plug::Dynamic );
	}
	
	for( vector<string>::const_iterator it = parameter->fields.begin(), eIt = parameter->fields.end(); it != eIt; ++it )
	{
		std::string fieldName = parameter->name + "." + *it;
		loadShaderParameter( query, query.getparam( fieldName ), result, keepExistingValues );
	}
	
	// remove any old plugs which it turned out we didn't need
	
	if( keepExistingValues )
	{
		for( int i = result->children().size() - 1; i >= 0; --i )
		{
			GraphComponent *child = result->getChild<GraphComponent>( i );
			if( std::find( parameter->fields.begin(), parameter->fields.end(), child->getName().string() ) == parameter->fields.end() )
			{
				result->removeChild( child );
			}
		}
	}
	
	parent->setChild( name, result );
	
	return result;
}
开发者ID:JohanAberg,项目名称:gaffer,代码行数:43,代码来源:OSLShader.cpp

示例3: loadShaderParameters


//.........这里部分代码省略.........
						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, values );
						break;
					case Color3fVectorDataTypeId :
						loadSplineParameter<SplinefColor3fPlug>( parametersPlug, plugName, positions, values );
						break;
					default :
						msg(
							Msg::Warning, "RenderManShader::loadShaderParameters",
							boost::format( "Spline \"%s\" has unsupported value type \"%s\"" ) % plugName % values->typeName()
						);
				}
				validPlugNames.insert( plugName );
				continue;
			}
			
		}
	
		// the other parameter types map more simply to a single plug each.
	
		const StringData *typeHint = typeHints->member<StringData>( *it, false );
		const Data *defaultValue = shader->parametersData()->member<Data>( *it );
		switch( defaultValue->typeId() )
		{
			case StringDataTypeId :
				if( typeHint && typeHint->readable() == "shader" )
				{
					loadCoshaderParameter( parametersPlug, *it );
				}
				else
				{
					loadParameter<StringPlug>( parametersPlug, *it, static_cast<const StringData *>( defaultValue )->readable() );
				}
				break;
			case FloatDataTypeId :
				loadNumericParameter( parametersPlug, *it, static_cast<const FloatData *>( defaultValue )->readable(), annotations );
				break;
			case Color3fDataTypeId :
				loadCompoundNumericParameter<Color3fPlug>( parametersPlug, *it, static_cast<const Color3fData *>( defaultValue )->readable(), annotations );
				break;
			case V3fDataTypeId :
				loadCompoundNumericParameter<V3fPlug>( parametersPlug, *it, static_cast<const V3fData *>( defaultValue )->readable(), annotations );
				break;
			case StringVectorDataTypeId :
				if( typeHint && typeHint->readable() == "shader" )
				{
					loadCoshaderArrayParameter( parametersPlug, *it, static_cast<const StringVectorData *>( defaultValue ) );
				}
				else
				{
					loadArrayParameter<StringVectorDataPlug>( parametersPlug, *it, defaultValue, annotations );
				}
				break;
			case FloatVectorDataTypeId :
				loadArrayParameter<FloatVectorDataPlug>( parametersPlug, *it, defaultValue, annotations );
				break;
			case Color3fVectorDataTypeId :
				loadArrayParameter<Color3fVectorDataPlug>( parametersPlug, *it, defaultValue, annotations );
				break;
			case V3fVectorDataTypeId :
				loadArrayParameter<V3fVectorDataPlug>( parametersPlug, *it, defaultValue, annotations );
				break;		
			default :
				msg(
					Msg::Warning, "RenderManShader::loadShaderParameters",
					boost::format( "Parameter \"%s\" has unsupported type \"%s\"" ) % *it % defaultValue->typeName()
				);
		}
		
		validPlugNames.insert( *it );
	}
	
	// remove any old plugs which it turned out we didn't need
	
	if( keepExistingValues )
	{
		for( int i = parametersPlug->children().size() - 1; i >= 0; --i )
		{
			GraphComponent *child = parametersPlug->getChild<GraphComponent>( i );
			if( validPlugNames.find( child->getName().string() ) == validPlugNames.end() )
			{
				parametersPlug->removeChild( child );
			}
		}
	}
	
}
开发者ID:danieldresser,项目名称:gaffer,代码行数:101,代码来源:RenderManShader.cpp


注:本文中的GraphComponent::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。