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


C++ UT_String::toStdString方法代码示例

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


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

示例1: cookMySop

OP_ERROR SOP_SceneCacheSource::cookMySop( OP_Context &context )
{
	flags().setTimeDep( true );
	
	std::string file;
	if ( !ensureFile( file ) )
	{
		addError( SOP_ATTRIBUTE_INVALID, ( file + " is not a valid .scc" ).c_str() );
		gdp->clearAndDestroy();
		return error();
	}
	
	std::string path = getPath();
	Space space = getSpace();
	
	UT_String shapeFilterStr;
	evalString( shapeFilterStr, pShapeFilter.getToken(), 0, 0 );
	UT_StringMMPattern shapeFilter;
	shapeFilter.compile( shapeFilterStr );
	
	UT_String p( "P" );
	UT_String attributeFilter;
	evalString( attributeFilter, pAttributeFilter.getToken(), 0, 0 );
	if ( !p.match( attributeFilter ) )
	{
		attributeFilter += " P";
	}
	
	ConstSceneInterfacePtr scene = this->scene( file, path );
	if ( !scene )
	{
		addError( SOP_ATTRIBUTE_INVALID, ( path + " is not a valid location in " + file ).c_str() );
		gdp->clearAndDestroy();
		return error();
	}
	
	MurmurHash hash;
	hash.append( file );
	hash.append( path );
	hash.append( space );
	hash.append( shapeFilterStr );
	hash.append( attributeFilter );
	
	if ( !m_loaded || m_hash != hash )
	{
		gdp->clearAndDestroy();
	}
	
	Imath::M44d transform = ( space == World ) ? worldTransform( file, path, context.getTime() ) : Imath::M44d();
	
	SceneInterface::Path rootPath;
	scene->path( rootPath );
	
	loadObjects( scene, transform, context.getTime(), space, shapeFilter, attributeFilter.toStdString(), rootPath.size() );
	
	m_loaded = true;
	m_hash = hash;
	
	return error();
}
开发者ID:Alwnikrotikz,项目名称:cortex-vfx,代码行数:60,代码来源:SOP_SceneCacheSource.cpp

示例2: startRender

int ROP_SceneCacheWriter::startRender( int nframes, fpreal s, fpreal e )
{
	UT_String value;
	evalString( value, pRootObject.getToken(), 0, 0 );
	
	try
	{
		SceneInterface::Path emptyPath;
		m_liveScene = new IECoreHoudini::HoudiniScene( value, emptyPath, emptyPath );
	}
	catch ( IECore::Exception &e )
	{		
		addError( ROP_MESSAGE, e.what() );
		return false;
	}
	
	evalString( value, pFile.getToken(), 0, 0 );
	std::string file = value.toStdString();
	
	try
	{
		m_outScene = SceneInterface::create( file, IndexedIO::Write );
	}
	catch ( IECore::Exception &e )
	{
		addError( ROP_MESSAGE, ( "Could not create a writable IECore::SceneInterface at \"" + file + "\"" ).c_str() );
		return false;
	}
	
	return true;
}
开发者ID:Alwnikrotikz,项目名称:cortex-vfx,代码行数:31,代码来源:ROP_SceneCacheWriter.cpp

示例3: getStringParam

std::string getStringParam(OP_Parameters& node, OP_Context &context,
	const std::string& label, bool trimspace)
{
	UT_String s;
	node.evalString(s, label.c_str(), 0, context.getTime());
	if(trimspace)
		s.trimSpace();

	return s.toStdString();
}
开发者ID:Kthulhu,项目名称:vfxgal,代码行数:10,代码来源:OP_Params.cpp

示例4:

std::string
GusdGetErrors(UT_ErrorManager* mgr, UT_ErrorSeverity sev)
{
    std::string err;
    if(mgr && mgr->getSeverity() >= SYSmin(sev, UT_ERROR_MESSAGE)) {
        UT_String msg;
        mgr->getErrorMessages(msg, sev, /*headerflag*/ 0);
        err = msg.toStdString();
    }
    return err;
}
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:11,代码来源:error.cpp

示例5: cookMySop

OP_ERROR SOP_CortexConverter::cookMySop( OP_Context &context )
{
	if( lockInputs( context ) >= UT_ERROR_ABORT )
	{
		return error();
	}
	
	UT_Interrupt *boss = UTgetInterrupt();
	boss->opStart("Building CortexConverter Geometry...");
	gdp->clearAndDestroy();
	
	UT_String nameFilterStr;
	evalString( nameFilterStr, pNameFilter.getToken(), 0, 0 );
	UT_StringMMPattern nameFilter;
	nameFilter.compile( nameFilterStr );
	
	UT_String p( "P" );
	UT_String attributeFilter;
	evalString( attributeFilter, pAttributeFilter.getToken(), 0, 0 );
	if ( !p.match( attributeFilter ) )
	{
		attributeFilter += " P";
	}
	const std::string attributeFilterStr = attributeFilter.toStdString();
	
	ResultType type = (ResultType)this->evalInt( pResultType.getToken(), 0, 0 );
	bool convertStandardAttributes = evalInt( pConvertStandardAttributes.getToken(), 0, 0 );
	
	DetailSplitterPtr splitter = new DetailSplitter( inputGeoHandle( 0 ) );
	std::vector<std::string> names;
	splitter->values( names );
	for ( std::vector<std::string>::const_iterator it = names.begin(); it != names.end(); ++it )
	{
		const std::string &name = *it;
		
		// we want match all to also match no-name
		if ( UT_String( name ).multiMatch( nameFilter ) || ( name == "" && UT_String( "*" ).multiMatch( nameFilter ) ) )
		{
			doConvert( splitter->split( name ), name, type, attributeFilterStr, convertStandardAttributes );
		}
		else
		{
			doPassThrough( splitter->split( name ), name );
		}
	}
	
	boss->opEnd();
	unlockInputs();
	return error();
}
开发者ID:AtomicFiction,项目名称:cortex,代码行数:50,代码来源:SOP_CortexConverter.cpp

示例6: cookMySop

OP_ERROR SOP_SceneCacheSource::cookMySop( OP_Context &context )
{
	// make sure the state is valid
	if ( boost::indeterminate( m_static ) )
	{
		sceneChanged();
	}
	
	flags().setTimeDep( bool( !m_static ) );
	
	std::string file;
	if ( !ensureFile( file ) )
	{
		addError( SOP_ATTRIBUTE_INVALID, ( file + " is not a valid .scc" ).c_str() );
		gdp->clearAndDestroy();
		return error();
	}
	
	std::string path = getPath();
	Space space = getSpace();
	GeometryType geometryType = (GeometryType)this->evalInt( pGeometryType.getToken(), 0, 0 );
	
	UT_String shapeFilterStr;
	evalString( shapeFilterStr, pShapeFilter.getToken(), 0, 0 );
	UT_StringMMPattern shapeFilter;
	shapeFilter.compile( shapeFilterStr );
	
	UT_String p( "P" );
	UT_String attributeFilter;
	evalString( attributeFilter, pAttributeFilter.getToken(), 0, 0 );
	if ( !p.match( attributeFilter ) )
	{
		attributeFilter += " P";
	}
	
	ConstSceneInterfacePtr scene = this->scene( file, path );
	if ( !scene )
	{
		addError( SOP_ATTRIBUTE_INVALID, ( path + " is not a valid location in " + file ).c_str() );
		gdp->clearAndDestroy();
		return error();
	}
	
	MurmurHash hash;
	hash.append( file );
	hash.append( path );
	hash.append( space );
	hash.append( shapeFilterStr );
	hash.append( attributeFilter );
	hash.append( geometryType );
	hash.append( getObjectOnly() );
	
	if ( !m_loaded || m_hash != hash )
	{
		gdp->clearAndDestroy();
	}
	
	Imath::M44d transform = ( space == World ) ? worldTransform( file, path, context.getTime() ) : Imath::M44d();
	
	SceneInterface::Path rootPath;
	scene->path( rootPath );
	
	UT_Interrupt *progress = UTgetInterrupt();
	if ( !progress->opStart( ( "Cooking objects for " + getPath() ).c_str() ) )
	{
		addError( SOP_ATTRIBUTE_INVALID, "Cooking interrupted before it started" );
		gdp->clearAndDestroy();
		return error();
	}
	
	loadObjects( scene, transform, context.getTime(), space, shapeFilter, attributeFilter.toStdString(), geometryType, rootPath.size() );
	
	if ( progress->opInterrupt( 100 ) )
	{
		addError( SOP_ATTRIBUTE_INVALID, "Cooking interrupted" );
		gdp->clearAndDestroy();		
		m_loaded = false;
		m_hash = MurmurHash();
	}
	else
	{
		m_loaded = true;
		m_hash = hash;
	}
	
	progress->opEnd();
	
	return error();
}
开发者ID:richardmonette,项目名称:cortex,代码行数:89,代码来源:SOP_SceneCacheSource.cpp

示例7: cookMySop

OP_ERROR SOP_AddEdges::cookMySop(OP_Context &context)
{
	typedef dgal::simple_mesh<Imath::V3f>					simple_mesh;
	typedef dgal::EdgeIntersection<unsigned int, float> 	edge_intersection;
	typedef std::pair<unsigned int, unsigned int>			edge_type;

	hdk_utils::ScopedCook scc(*this, context, "Performing edges add");
	if(!scc.good())
		return error();

	double now = context.getTime();

	// inputs
	const GU_Detail* gdp0 = inputGeo(0);
	if (!gdp0 ) {
		SOP_ADD_FATAL(SOP_MESSAGE, "Not enough sources specified.");
	}

	unsigned int npoints0 = gdp0->points().entries();

	UT_String edgesAttrib;
	evalString(edgesAttrib, "edges_string", 0, now);
	std::string edgesAttribStr = edgesAttrib.toStdString();

	std::vector<std::string> toks;
	pystring::split(edgesAttribStr, toks);
	if(toks.empty())
	{
		duplicateSource(0, context);
		return error();
	}

	simple_mesh m, m2;
	simple_mesh* pm = NULL;
	std::vector<int> points_remap;
	std::vector<int> polys_remap;
	dgal::MeshRemapSettings<int> remap_settings(true, true, true, 0, 0, &points_remap, &polys_remap);
	std::map<std::string, unsigned int> new_points;

	// create new points
	{
		std::vector<edge_intersection> edgeints;

		std::string s = pystring::replace(edgesAttribStr, ",", " ");
		std::vector<std::string> toks;
		pystring::split(s, toks);

		for(unsigned int i=0; i<toks.size(); ++i)
		{
			// new point will be in form 'X-Y:f'
			if(toks[i].find('-') != std::string::npos)
			{
				s = pystring::replace(toks[i], "-", " ");
				s = pystring::replace(s, ":", " ");

				std::istringstream strm(s);
				edge_intersection ei;
				try {
					strm >> ei.m_point1 >> ei.m_point2 >> ei.m_u;
				}
				catch(const std::exception&) {
					continue;
				}

				new_points[toks[i]] = npoints0 + edgeints.size();
				edgeints.push_back(ei);
			}
		}

		if(new_points.empty())
		{
			// no new points means no point remapping
			remap_settings.m_genPointRemapping = false;
			remap_settings.m_identity_point_mapping = true;
		}
		else
		{
			dgal::addMeshPoints<GEO_Detail, std::vector<edge_intersection>::const_iterator>(
				*gdp0, m, edgeints.begin(), edgeints.end(), &points_remap, &polys_remap);
			pm = &m;
		}
	}
开发者ID:achayan,项目名称:anim-studio-tools,代码行数:82,代码来源:SOP_AddEdges.cpp

示例8: cookMySop

OP_ERROR SOP_SceneCacheSource::cookMySop( OP_Context &context )
{
	// make sure the state is valid
	if ( boost::indeterminate( m_static ) )
	{
		sceneChanged();
	}
	
	flags().setTimeDep( bool( !m_static ) );
	
	std::string file;
	if ( !ensureFile( file ) )
	{
		addError( SOP_ATTRIBUTE_INVALID, ( file + " is not a valid .scc" ).c_str() );
		gdp->clearAndDestroy();
		return error();
	}
	
	std::string path = getPath();
	Space space = getSpace();
	GeometryType geometryType = (GeometryType)this->evalInt( pGeometryType.getToken(), 0, 0 );
	
	UT_String tagFilterStr;
	getTagFilter( tagFilterStr );
	UT_StringMMPattern tagFilter;
	tagFilter.compile( tagFilterStr );
	
	UT_String shapeFilterStr;
	getShapeFilter( shapeFilterStr );
	UT_StringMMPattern shapeFilter;
	shapeFilter.compile( shapeFilterStr );
	
	UT_String p( "P" );
	UT_String attributeFilter;
	getAttributeFilter( attributeFilter );
	if ( !p.match( attributeFilter ) )
	{
		attributeFilter += " P";
	}
	
	UT_String attributeCopy;
	getAttributeCopy( attributeCopy );
	
	UT_String fullPathName;
	getFullPathName( fullPathName );
	
	ConstSceneInterfacePtr scene = this->scene( file, path );
	if ( !scene )
	{
		addError( SOP_ATTRIBUTE_INVALID, ( path + " is not a valid location in " + file ).c_str() );
		gdp->clearAndDestroy();
		return error();
	}
	
	MurmurHash hash;
	hash.append( file );
	hash.append( path );
	hash.append( space );
	hash.append( tagFilterStr );
	hash.append( shapeFilterStr );
	hash.append( attributeFilter );
	hash.append( attributeCopy );
	hash.append( fullPathName );
	hash.append( geometryType );
	hash.append( getObjectOnly() );
	
	if ( !m_loaded || m_hash != hash )
	{
		gdp->clearAndDestroy();
	}
	
	double readTime = time( context );
	Imath::M44d transform = ( space == World ) ? worldTransform( file, path, readTime ) : Imath::M44d();
	
	SceneInterface::Path rootPath;
	scene->path( rootPath );
	
	UT_Interrupt *progress = UTgetInterrupt();
	if ( !progress->opStart( ( "Cooking objects for " + getPath() ).c_str() ) )
	{
		addError( SOP_ATTRIBUTE_INVALID, "Cooking interrupted before it started" );
		gdp->clearAndDestroy();
		return error();
	}
	
	Parameters params;
	UT_String attribFilter;
	getAttributeFilter( attribFilter );
	params.attributeFilter = attribFilter.toStdString();
	params.attributeCopy = attributeCopy.toStdString();
	params.fullPathName = fullPathName.toStdString();
	params.geometryType = getGeometryType();
	getShapeFilter( params.shapeFilter );
	getTagFilter( params.tagFilter );
	
	// Building a map from shape name to primitive range, which will be used during
	// convertObject() to do a lazy update of animated primvars where possible, and
	// to destroy changing topology shapes when necessary.
	GA_ROAttributeRef nameAttrRef = gdp->findStringTuple( GA_ATTRIB_PRIMITIVE, "name" );
	if ( nameAttrRef.isValid() )
//.........这里部分代码省略.........
开发者ID:mattigruener,项目名称:cortex,代码行数:101,代码来源:SOP_SceneCacheSource.cpp

示例9:

std::string SceneCacheNode<BaseType>::getPath() const
{
	UT_String value;
	this->evalString( value, pRoot.getToken(), 0, 0 );
	return ( value == "" ) ? "/" : value.toStdString();
}
开发者ID:pombredanne,项目名称:cortex,代码行数:6,代码来源:SceneCacheNode.cpp

示例10: cookMySop

OP_ERROR SOP_InterpolatedCacheReader::cookMySop( OP_Context &context )
{
	flags().setTimeDep( true );
	
	if ( lockInputs( context ) >= UT_ERROR_ABORT )
	{
		return error();
	}
	
	gdp->stashAll();
	
	float time = context.getTime();
	float frame = context.getFloatFrame();
	
	UT_String paramVal;
	
	evalString( paramVal, "cacheSequence", 0, time );
	std::string cacheFileName = paramVal.toStdString();
	
	evalString( paramVal, "objectFixes", 0, time );
	std::string objectPrefix = paramVal.toStdString();
	evalString( paramVal, "objectFixes", 1, time );
	std::string objectSuffix = paramVal.toStdString();
	
	evalString( paramVal, "attributeFixes", 0, time );
	std::string attributePrefix = paramVal.toStdString();
	evalString( paramVal, "attributeFixes", 1, time );
	std::string attributeSuffix = paramVal.toStdString();
	
	evalString( paramVal, "transformAttribute", 0, time );
	std::string transformAttribute = paramVal.toStdString();
	
	int samplesPerFrame = evalInt( "samplesPerFrame", 0, time );
	InterpolatedCache::Interpolation interpolation = (InterpolatedCache::Interpolation)evalInt( "interpolation", 0, time );
	GroupingMode groupingMode = (GroupingMode)evalInt( "groupingMode", 0, time );
	
	// create the InterpolatedCache
	if ( cacheFileName.compare( m_cacheFileName ) != 0 || samplesPerFrame != m_samplesPerFrame || interpolation != m_interpolation )
	{
		try
		{
			float fps = OPgetDirector()->getChannelManager()->getSamplesPerSec();
			OversamplesCalculator calc( fps, samplesPerFrame );
			m_cache = new InterpolatedCache( cacheFileName, interpolation, calc );
		}
		catch ( IECore::InvalidArgumentException e )
		{
			addWarning( SOP_ATTRIBUTE_INVALID, e.what() );
			unlockInputs();
			return error();
		}
		
		m_cacheFileName = cacheFileName;
		m_samplesPerFrame = samplesPerFrame;
		m_interpolation = interpolation;
	}
	
	if ( !m_cache )
	{
		addWarning( SOP_MESSAGE, "SOP_InterpolatedCacheReader: Cache Sequence not found" );
		unlockInputs();
		return error();
	}
	
	std::vector<InterpolatedCache::ObjectHandle> objects;
	std::vector<InterpolatedCache::AttributeHandle> attrs;
	
	try
	{
		m_cache->objects( frame, objects );
	}
	catch ( IECore::Exception e )
	{
		addWarning( SOP_ATTRIBUTE_INVALID, e.what() );
		unlockInputs();
		return error();
	}
	
	duplicatePointSource( 0, context );
	
	GA_ElementGroupTable *groups = 0;
	if ( groupingMode == PointGroup )
	{
		groups = &gdp->pointGroups();
	}
	else if ( groupingMode == PrimitiveGroup )
	{
		groups = &gdp->primitiveGroups();
	}
	
	for ( GA_GroupTable::iterator<GA_ElementGroup> it=groups->beginTraverse(); !it.atEnd(); ++it )
	{
		GA_ElementGroup *group = it.group();
		if ( group->getInternal() || group->isEmpty() )
		{
			continue;
		}
		
		// match GA_ElementGroup name to InterpolatedCache::ObjectHandle
		std::string searchName = objectPrefix + group->getName().toStdString() + objectSuffix;
//.........这里部分代码省略.........
开发者ID:Alwnikrotikz,项目名称:cortex-vfx,代码行数:101,代码来源:SOP_InterpolatedCacheReader.cpp


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