本文整理汇总了C++中UT_StringMMPattern::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ UT_StringMMPattern::isEmpty方法的具体用法?C++ UT_StringMMPattern::isEmpty怎么用?C++ UT_StringMMPattern::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UT_StringMMPattern
的用法示例。
在下文中一共展示了UT_StringMMPattern::isEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertObject
bool SOP_SceneCacheSource::convertObject( const IECore::Object *object, const std::string &name, const SceneInterface *scene, Parameters ¶ms )
{
ToHoudiniGeometryConverterPtr converter = nullptr;
if ( params.geometryType == Cortex )
{
converter = new ToHoudiniCortexObjectConverter( object );
}
else
{
const VisibleRenderable *renderable = IECore::runTimeCast<const VisibleRenderable>( object );
if ( !renderable )
{
return false;
}
converter = ToHoudiniGeometryConverter::create( renderable );
}
if ( !converter )
{
return false;
}
// we need to set the name regardless of whether
// we're reusing prims or doing the full conversion
// because this parameter can have an affect in
// transferAttribs() as well as convert()
converter->nameParameter()->setTypedValue( name );
// check the primitve range map to see if this shape exists already
std::map<std::string, GA_Range>::iterator rIt = params.namedRanges.find( name );
if ( rIt != params.namedRanges.end() && !rIt->second.isEmpty() )
{
GA_Range primRange = rIt->second;
const Primitive *primitive = IECore::runTimeCast<const Primitive>( object );
if ( primitive && !params.hasAnimatedTopology && params.hasAnimatedPrimVars )
{
// this means constant topology and primitive variables, even though multiple samples were written
if ( params.animatedPrimVars.empty() )
{
return true;
}
GA_Range pointRange( *gdp, primRange, GA_ATTRIB_POINT, GA_Range::primitiveref(), false );
// update the animated primitive variables only
std::string animatedPrimVarStr = "";
for ( std::vector<InternedString>::const_iterator it = params.animatedPrimVars.begin(); it != params.animatedPrimVars.end(); ++it )
{
animatedPrimVarStr += it->string() + " ";
}
converter->attributeFilterParameter()->setTypedValue( animatedPrimVarStr );
try
{
converter->transferAttribs( gdp, pointRange, primRange );
return true;
}
catch ( std::exception &e )
{
addWarning( SOP_MESSAGE, e.what() );
return false;
}
catch ( ... )
{
addWarning( SOP_MESSAGE, "Attribute transfer failed for unknown reasons" );
return false;
}
}
else
{
// topology is changing, so destroy the exisiting primitives
gdp->destroyPrimitives( primRange, true );
}
}
// fallback to full conversion
converter->attributeFilterParameter()->setTypedValue( params.attributeFilter );
try
{
GA_Offset firstNewPrim = gdp->getPrimitiveMap().lastOffset() + 1;
bool status = converter->convert( myGdpHandle );
// adds the full path in addition to the relative name
const GA_IndexMap &primMap = gdp->getPrimitiveMap();
GA_Range newPrims( primMap, firstNewPrim, primMap.lastOffset() + 1 );
if ( params.fullPathName != "" )
{
if ( newPrims.isValid() )
{
std::string fullName;
SceneInterface::Path path;
scene->path( path );
SceneInterface::pathToString( path, fullName );
GA_RWAttributeRef pathAttribRef = ToHoudiniStringVectorAttribConverter::convertString( params.fullPathName, fullName, gdp, newPrims );
//.........这里部分代码省略.........
示例2: primvarPatternStr
void
GusdPrimWrapper::loadPrimvars(
UsdTimeCode time,
const GT_RefineParms* rparms,
int minUniform,
int minPoint,
int minVertex,
const string& primPath,
GT_AttributeListHandle* vertex,
GT_AttributeListHandle* point,
GT_AttributeListHandle* primitive,
GT_AttributeListHandle* constant,
const GT_DataArrayHandle& remapIndicies ) const
{
// Primvars will be loaded if they match a provided pattern.
// By default, set the pattern to match only "Cd". Then write
// over this pattern if there is one provided in rparms.
const char* Cd = "Cd";
UT_String primvarPatternStr(Cd);
if (rparms) {
rparms->import("usd:primvarPattern", primvarPatternStr);
}
UT_StringMMPattern primvarPattern;
if (primvarPatternStr) {
primvarPattern.compile(primvarPatternStr);
}
std::vector<UsdGeomPrimvar> authoredPrimvars;
bool hasCdPrimvar = false;
{
UsdGeomImageable prim = getUsdPrim();
UsdGeomPrimvar colorPrimvar = prim.GetPrimvar(GusdTokens->Cd);
if (colorPrimvar && colorPrimvar.GetAttr().HasAuthoredValue()) {
hasCdPrimvar = true;
}
// It's common for "Cd" to be the only primvar to load.
// In this case, avoid getting all other authored primvars.
if (primvarPatternStr == Cd) {
if (hasCdPrimvar) {
authoredPrimvars.push_back(colorPrimvar);
} else {
// There is no authored "Cd" primvar.
// Try to find "displayColor" instead.
colorPrimvar = prim.GetPrimvar(UsdGeomTokens->primvarsDisplayColor);
if (colorPrimvar &&
colorPrimvar.GetAttr().HasAuthoredValue()) {
authoredPrimvars.push_back(colorPrimvar);
}
}
} else if (!primvarPattern.isEmpty()) {
authoredPrimvars = prim.GetAuthoredPrimvars();
}
}
// Is it better to sort the attributes and build the attributes all at once.
for( const UsdGeomPrimvar &primvar : authoredPrimvars )
{
DBG(cerr << "loadPrimvar " << primvar.GetPrimvarName() << "\t" << primvar.GetTypeName() << "\t" << primvar.GetInterpolation() << endl);
UT_String name(primvar.GetPrimvarName());
// One special case we always handle here is to change
// the name of the USD "displayColor" primvar to "Cd",
// as long as there is not already a "Cd" primvar.
if (!hasCdPrimvar &&
primvar.GetName() == UsdGeomTokens->primvarsDisplayColor) {
name = Cd;
}
// If the name of this primvar doesn't
// match the primvarPattern, skip it.
if (!name.multiMatch(primvarPattern)) {
continue;
}
GT_DataArrayHandle gtData = convertPrimvarData( primvar, time );
if( !gtData )
{
TF_WARN( "Failed to convert primvar %s:%s %s.",
primPath.c_str(),
primvar.GetPrimvarName().GetText(),
primvar.GetTypeName().GetAsToken().GetText() );
continue;
}
#if SYS_VERSION_FULL_INT >= 0x11050000
// Encode the USD primvar names into something safe for the Houdini
// geometry attribute name. This allows round tripping of namespaced
// primvars from USD -> Houdini -> USD.
UT_StringHolder attrname = UT_VarEncode::encode(name);
#else
UT_StringHolder attrname = name;
#endif
//.........这里部分代码省略.........