24 #ifndef PXR_USD_USD_GEOM_PRIMVAR_H
25 #define PXR_USD_USD_GEOM_PRIMVAR_H
387 TfToken *interpolation,
int *elementSize)
const;
418 explicit operator bool()
const {
419 return IsDefined() ? &UsdGeomPrimvar::_attr : 0;
459 template <
typename T>
465 template <
typename T>
488 std::vector<double>* times)
const;
598 template <
typename ScalarType>
625 const VtIntArray &indices,
687 return !(lhs == rhs);
698 template <
typename HashState>
726 static TfToken const &_GetNamespacePrefix();
756 template<
typename ScalarType>
758 const VtIntArray &indices,
764 template <
typename ArrayType>
765 static bool _ComputeFlattenedArray(
const VtValue &attrVal,
766 const VtIntArray &indices,
778 bool _ComputeIdTargetPossibility()
const;
780 enum _IdTargetStatus {
781 IdTargetUninitialized,
782 IdTargetInitializing,
786 mutable TfToken _idTargetRelName;
787 mutable std::atomic<_IdTargetStatus> _idTargetStatus;
801 template <
typename ScalarType>
806 if (!
Get(&authored, time))
816 TF_WARN(
"No indices authored for indexed primvar <%s>.",
822 if (authored.empty())
826 bool res = _ComputeFlattenedHelper(authored, indices, value, &errString);
827 if (!errString.empty()) {
834 template<
typename ScalarType>
837 const VtIntArray &indices,
841 value->resize(indices.size());
844 std::vector<size_t> invalidIndexPositions;
845 for (
size_t i=0; i < indices.size(); i++) {
846 int index = indices[i];
847 if (index >= 0 && (
size_t)index < authored.size()) {
848 (*value)[i] = authored[
index];
850 invalidIndexPositions.push_back(i);
855 if (!invalidIndexPositions.empty()) {
856 std::vector<std::string> invalidPositionsStrVec;
858 size_t numElementsToPrint =
std::min(invalidIndexPositions.size(),
860 invalidPositionsStrVec.reserve(numElementsToPrint);
861 for (
size_t i = 0; i < numElementsToPrint ; ++i) {
862 invalidPositionsStrVec.push_back(
868 "Found %ld invalid indices at positions [%s%s] that are out of "
869 "range [0,%ld).", invalidIndexPositions.size(),
871 invalidIndexPositions.size() > 5 ?
", ..." :
"",
882 #endif // USD_PRIMVAR_H
SDF_API const char * GetText() const
TF_API std::string TfStringPrintf(const char *fmt,...)
bool Get(T *value, UsdTimeCode time=UsdTimeCode::Default()) const
static USDGEOM_API TfToken StripPrimvarsName(const TfToken &name)
GLsizei GLenum const void * indices
static USDGEOM_API bool IsValidPrimvarName(const TfToken &name)
static constexpr UsdTimeCode Default()
bool Get(T *value, UsdTimeCode time=UsdTimeCode::Default()) const
USDGEOM_API UsdAttribute GetIndicesAttr() const
USD_API TfToken GetBaseName() const
friend bool operator!=(const UsdGeomPrimvar &lhs, const UsdGeomPrimvar &rhs)
GT_API const UT_StringHolder time
USDGEOM_API bool ValueMightBeTimeVarying() const
GLsizei const GLchar *const * string
GLsizei const GLchar *const * path
static USDGEOM_API bool IsPrimvar(const UsdAttribute &attr)
USDGEOM_API TfToken GetPrimvarName() const
USDGEOM_API bool GetIndices(VtIntArray *indices, UsdTimeCode time=UsdTimeCode::Default()) const
USD_API SdfValueTypeName GetTypeName() const
Return the "scene description" value type name for this attribute.
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
TfToken GetNamespace() const
USD_API bool HasAuthoredValue() const
TfToken GetBaseName() const
USDGEOM_API bool NameContainsNamespaces() const
bool ComputeFlattened(VtArray< ScalarType > *value, UsdTimeCode time=UsdTimeCode::Default()) const
USDGEOM_API int GetUnauthoredValuesIndex() const
USDGEOM_API bool SetIdTarget(const SdfPath &path) const
USD_API std::vector< std::string > SplitName() const
USDGEOM_API bool SetInterpolation(const TfToken &interpolation)
std::vector< std::string > SplitName() const
USD_API bool HasValue() const
USD_API std::string UsdDescribe(const UsdObject &)
Return a human-readable description.
bool Set(const T &value, UsdTimeCode time=UsdTimeCode::Default()) const
Set the attribute value of the Primvar at time.
USDGEOM_API UsdAttribute CreateIndicesAttr() const
TfToken const & GetName() const
bool HasAuthoredValue() const
USDGEOM_API bool IsIndexed() const
GLuint const GLchar * name
USD_API TfToken GetNamespace() const
bool Set(const T &value, UsdTimeCode time=UsdTimeCode::Default()) const
const TfToken & GetName() const
static USDGEOM_API bool IsValidInterpolation(const TfToken &interpolation)
std::string TfStringJoin(ForwardIterator begin, ForwardIterator end, const char *separator=" ")
GLfloat GLfloat GLfloat GLfloat h
SdfValueTypeName GetTypeName() const
friend size_t hash_value(const UsdGeomPrimvar &obj)
USDGEOM_API bool IsIdTarget() const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
USDGEOM_API bool HasAuthoredElementSize() const
UsdAttribute const & GetAttr() const
Explicit UsdAttribute extractor.
friend void TfHashAppend(HashState &h, const UsdGeomPrimvar &obj)
#define PXR_NAMESPACE_CLOSE_SCOPE
USDGEOM_API bool GetTimeSamples(std::vector< double > *times) const
USDGEOM_API bool SetIndices(const VtIntArray &indices, UsdTimeCode time=UsdTimeCode::Default()) const
USDGEOM_API bool HasAuthoredInterpolation() const
std::enable_if<!std::is_enum< T >::value, std::string >::type TfStringify(const T &v)
friend bool operator==(const UsdGeomPrimvar &lhs, const UsdGeomPrimvar &rhs)
USDGEOM_API bool SetUnauthoredValuesIndex(int unauthoredValuesIndex) const
USDGEOM_API int GetElementSize() const
USDGEOM_API void GetDeclarationInfo(TfToken *name, SdfValueTypeName *typeName, TfToken *interpolation, int *elementSize) const
friend bool operator<(const UsdGeomPrimvar &lhs, const UsdGeomPrimvar &rhs)
USDGEOM_API TfToken GetInterpolation() const
USDGEOM_API bool GetTimeSamplesInInterval(const GfInterval &interval, std::vector< double > *times) const
USDGEOM_API UsdGeomPrimvar & operator=(const UsdGeomPrimvar &other)
Copy assign.
USDGEOM_API bool SetElementSize(int eltSize)
USDGEOM_API void BlockIndices() const