void GusdGU_PackedUSD::getIntrinsicPurposes( UT_StringArray& purposes ) const { purposes.clear(); if( m_purposes & GUSD_PURPOSE_PROXY ) purposes.append( UT_StringHolder( UT_StringHolder::REFERENCE, "proxy" )); if( m_purposes & GUSD_PURPOSE_RENDER ) purposes.append( UT_StringHolder( UT_StringHolder::REFERENCE, "render" )); if( m_purposes & GUSD_PURPOSE_GUIDE ) purposes.append( UT_StringHolder( UT_StringHolder::REFERENCE, "guide" )); }
void SOP_PrimGroupCentroid::buildGroupData(UT_String &pattern, const GU_Detail *input_geo, UT_Array<GA_Range> &range_array, UT_StringArray &string_values) { GA_Range pr_range; const GA_PrimitiveGroup *group; GA_ElementGroupTable::ordered_iterator group_it; UT_String group_name; UT_WorkArgs tokens; // Tokenize the pattern. pattern.tokenize(tokens); // Get all the primitive groups. const GA_ElementGroupTable &prim_groups = input_geo->primitiveGroups(); // For each primitive group in order. for (group_it=prim_groups.obegin(); !group_it.atEnd(); ++group_it) { // Get the group. group = static_cast<GA_PrimitiveGroup *>(*group_it); // Ensure the group is valid. if (!group) continue; // Skip internal groups. if (group->getInternal()) continue; // Check to see if this group name matches the pattern. group_name = group->getName(); if (!group_name.matchPattern(tokens)) continue; // Get a range for the primitives in the group. pr_range = input_geo->getPrimitiveRange(group); // Add the primitive range and the group name to the arrays. range_array.append(pr_range); string_values.append(group_name); } }
void HoudiniScene::calculatePath( const Path &contentPath, const Path &rootPath ) { OP_Node *node = retrieveNode(); if ( node->isManager() ) { return; } UT_String tmp( m_nodePath ); UT_WorkArgs workArgs; tmp.tokenize( workArgs, "/" ); OP_Node *current = dynamic_cast<MOT_Director *>( OPgetDirector() )->getObjectManager(); // skipping the token for the OBJ manager for ( int i = 1; i < workArgs.getArgc(); ++i ) { current = current->getChild( workArgs[i] ); /// recursively collect all input connections OP_Node *parent = current->getInput( 0 ); UT_StringArray parentNames; while ( parent ) { parentNames.append( parent->getName() ); parent = parent->getInput( 0 ); } // add them in reverse order for ( int j = parentNames.entries() - 1; j >= 0; --j ) { m_path.push_back( Name( parentNames( j ) ) ); } if ( ( i < workArgs.getArgc() - 1 ) || Name( workArgs[i] ) != contentName ) { m_path.push_back( Name( workArgs[i] ) ); } } if ( !contentPath.empty() ) { m_contentIndex = m_path.size(); m_path.resize( m_path.size() + contentPath.size() ); std::copy( contentPath.begin(), contentPath.end(), m_path.begin() + m_contentIndex ); } if ( m_path.size() < rootPath.size() ) { std::string pStr, rStr; pathToString( m_path, pStr ); pathToString( rootPath, rStr ); throw Exception( "IECoreHoudini::HoudiniScene: Path \"" + pStr + "\" is not a valid child of root \"" + rStr + "\"." ); } for ( size_t i = 0; i < rootPath.size(); ++i ) { if ( rootPath[i] != m_path[i] ) { std::string pStr, rStr; pathToString( m_path, pStr ); pathToString( rootPath, rStr ); throw Exception( "IECoreHoudini::HoudiniScene: Path \"" + pStr + "\" is not a valid child of root \"" + rStr + "\"." ); } } m_rootIndex = rootPath.size(); }
int SOP_PrimGroupCentroid::buildAttribData(int mode, const GU_Detail *input_geo, UT_Array<GA_Range> &range_array, UT_StringArray &string_values, UT_IntArray &int_values) { int unique_count; exint int_value; GA_Range pr_range; GA_ROAttributeRef source_gah; UT_String attr_name, str_value; // Determine the attribute name to use. attr_name = (mode == 1) ? "name": "class"; // Find the attribute. source_gah = input_geo->findPrimitiveAttribute(attr_name); // If there is no attribute, add an error message and quit. if (source_gah.isInvalid()) { addError(SOP_ATTRIBUTE_INVALID, attr_name); return 1; } // If the 'name' attribute isn't a string, add an error and quit. if (mode == 1 && !source_gah.isString()) { addError(SOP_ATTRIBUTE_INVALID, "'name' must be a string."); return 1; } // If the 'class' attribute isn't an int, add an error and quit. else if (mode == 2 && !source_gah.isInt()) { addError(SOP_ATTRIBUTE_INVALID, "'class' must be an integer."); return 1; } // The number of unique values for the attribute. unique_count = input_geo->getUniqueValueCount(source_gah); // Add all the ranges and unique values to the appropriate arrays. if (mode == 1) { for (int idx=0; idx<unique_count; ++idx) { // Get the unique string value. str_value = input_geo->getUniqueStringValue(source_gah, idx); // Get the primitive range corresponding to that value. pr_range = input_geo->getRangeByValue(source_gah, str_value); // Add the range to the array. range_array.append(pr_range); // Add the string value to the string value list. string_values.append(str_value); } } else { for (int idx=0; idx<unique_count; ++idx) { // Get the unique integer value. int_value = input_geo->getUniqueIntegerValue(source_gah, idx); // Get the primitive range corresponding to that value. pr_range = input_geo->getRangeByValue(source_gah, int_value); // Add the range to the array. range_array.append(pr_range); // Add the integer value to the integer value list. int_values.append(int_value); } } // Return 0 for success. return 0; }