usd_optimize#
-
namespace usd_optimize#
Classes Summary#
- Argument
Generic argument class.
- Coalescer
Class to coalesce events.
- ConcurrentVectorMemoryPool
Manages a pool of vectors of type T that can be accessed concurrently. If there are no free vectors available, a new one is allocated. Note: this does not garbage collect, the destructor or clear must be called to release memory.
- FuzzyTransformSolver
Computes the fuzzy (OBB-based) transform from one fixed source mesh onto many target meshes, caching the source mesh's oriented bounding box so it is built once rather than once per target. This is the dominant cost when matching a single prototype against a whole set of duplicates, so hoisting it out of the per-target loop is a meaningful win. The result for a given target matches _getTransformFromToFuzzy with the same source and target.
- Group
A group of arguments.
- OmniOperation
OmniMesh Operation .
- Operation
Base Operation Class.
- PrimInfo
Object to store info per prim type.
- PrimvarStats
- PythonOperation
Python Operation .
- RefCountedPyObject
A simple RAII wrapper for a PyObject* that increments the reference count when it is constructed and decrements the reference count when it goes out of scope.
- Report
Report Object.
- ScopedPyObject
A simple RAII wrapper for a PyObject* that decrements the reference count when it goes out of scope.
- ScopedTimer
Manual timer that can be started, paused, and stopped. Useful for accumulating time spent on a section of code.
- StatArgs
Toggles for what statistics to capture.
- StatCounters
Object to count stats.
- UsdOptimizeCore
Usd Optimize Plugin Manager.
Enumerations Summary#
- ArgumentArrayType
Describes the type of data an array-based argument is expected to hold.
- LogLevel
Log Level.
- RemoveMethod
The various methods that can be used to remove prims.
Functions Summary#
- std::shared_ptr< MeshTools::Stage > GetStage(const PXR_NS::UsdStageRefPtr &usdStage, const std::vector< PXR_NS::UsdPrim > &prims, bool checkTransparency=false)
- void GetStageMeshDescriptors(std::vector< MeshTools::ClashMeshDescriptor > &meshDescriptors, PXR_NS::SdfPathVector &paths, const PXR_NS::UsdStageRefPtr &usdStage, const std::vector< PXR_NS::UsdPrim > &prims)
- bool _addMaterialBindingAPIToSchemas(PXR_NS::SdfListOp< PXR_NS::TfToken > &apiSchemas)
- void _batchedSplitIntoXformAndChild(const PXR_NS::UsdStageWeakPtr &stage, const std::vector< PXR_NS::SdfPath > &primPaths)
- float _calculteUVScaleValue(const PXR_NS::UsdStageWeakPtr &stage, float scaleFactor, float scaleUnits)
Calculates the UV scaling value to apply for UV generation tasks. The scaling value is based on the
scaleFactormultiplied by the distancescaleUnitsin relation to the distance units of the Usd stage. WherescaleUnitsof 0.0 signify that distance units should not be applied to the calculated scaling value.- void _clearXformOps(const PXR_NS::UsdPrim &prim)
Reset a prims local transform to identity by removing all of its transform ops, clearing its xformOpOrder, and clearing the reset-xform-stack flag. Does nothing for prims that are not transformable.
- StatCountersUPtr _collectSceneStats(const PXR_NS::UsdStageWeakPtr &usdStage, const StatArgs &args=StatArgs())
Calculate various statistics based on the specified stage.
- PXR_NS::GfVec3f _computeCentroid(const PXR_NS::VtVec3fArray &points)
- size_t _computeExtents(const std::vector< PXR_NS::UsdPrim > &prims)
Returns the number of prims that have had their extents computed by this function.
- size_t _computeExtents(const PXR_NS::UsdStageWeakPtr &usdStage, const std::vector< std::string > &meshPrimPaths)
Returns the number of prims that have had their extents computed by this function.
- PXR_NS::GfVec3f _computePseudoMaxVec3f(const PXR_NS::GfVec3f &ref_point, const PXR_NS::GfVec3f &row_0, const PXR_NS::GfVec3f &row_1, const PXR_NS::VtVec3fArray &points)
- PXR_NS::GfVec3f _computePseudoMaxVec3f(const PXR_NS::GfVec3f &ref_point, const PXR_NS::GfVec3f &ref_vec, const PXR_NS::VtVec3fArray &points)
- PXR_NS::GfVec3f _computePseudoMaxVec3f(const PXR_NS::GfVec3f &ref_point, const PXR_NS::VtVec3fArray &points)
- bool _containsOrderedXformOpsSuffix(const PXR_NS::UsdPrim &prim, const PXR_NS::TfToken &suffix)
- PXR_NS::SdfPathVector _convertToSdfPaths(const std::vector< PXR_NS::UsdPrim > &prims)
- PXR_NS::UsdPrim _copyPrim(const PXR_NS::UsdPrim &prim, const PXR_NS::SdfLayerHandle &targetLayer, const PXR_NS::SdfPath &targetPath)
Create a copy of
primattargetPath.- void _deactivatePrims(const std::vector< PXR_NS::UsdPrim > &prims)
Deactivate the specified prims.
- void _deletePrims(const PXR_NS::UsdStageWeakPtr &usdStage, const std::vector< PXR_NS::UsdPrim > &prims, bool deactivate=true, bool deleteOvers=false)
- void _deletePrims(const PXR_NS::UsdStageWeakPtr &usdStage, const std::vector< std::string > &primPaths)
Delete the specified prims.
- void _findInstancedPrims(const PXR_NS::UsdStageWeakPtr &stage, std::set< PXR_NS::UsdPrim > &instancedPrims)
Find any instanced prims in the scene.
- std::vector< std::string > _findPrimsMissingExtents(const PXR_NS::UsdStageWeakPtr &usdStage, const std::vector< std::string > &meshPrimPaths)
- std::vector< std::string > _findPrimsMissingExtents(const std::vector< PXR_NS::UsdPrim > &prims)
Find boundable prims that are missing an authored
extentattribute.- bool _flattenInstance(const PXR_NS::UsdPrim &prim)
Completely remove instancing from a prim.
- void _flattenPropertyToPrimSpec(const PXR_NS::UsdProperty &property, const PXR_NS::SdfPrimSpecHandle &spec)
Flattens this property to a property spec with the same name beneath the given parent prim spec.
- void _flattenPropertyToPrimSpecWithValue(const PXR_NS::UsdProperty &property, const PXR_NS::SdfPrimSpecHandle &spec, const PXR_NS::VtValue &value)
Flattens a property to a property spec on a prim spec, with an optional custom value.
- FloatPresetsVector _getDefaultLinearUnitsPresets()
Returns the default list of float presets for the
UsdGeomLinearUnitsdefinitions.- PXR_NS::VtValue _getDefaultSingleVtValue(const PXR_NS::VtValue &value)
Given a VtValue, this function attempts to return a default single value of the same type, or the element type if the VtValue holds an array.
- ExecutionContext * _getExecutionContextFromPyWrapper(pybind11::object context)
Returns the ExecutionContext C struct from the Python wrapper class.
- std::string _getFormattedBytes(double bytes)
Given a number of bytes, format a human-readable string.
- bool _getMaterialAlbedo(const PXR_NS::UsdShadeMaterial &material, ColorValue &colorValue)
Determine a color value that can be used as display color instead of this material.
- std::vector< PXR_NS::UsdGeomXformOp > _getPivotXformOps(const std::vector< PXR_NS::UsdGeomXformOp > &orderedXformOps)
Given a list of ordered xform ops for a prim, returns a ordered list of any of the xforms ops that are pivots.
- std::vector< PXR_NS::UsdGeomXformOp > _getPivotXformOps(const std::vector< PXR_NS::UsdGeomXformOp > &orderedXformOps, bool includeInverseOps)
- size_t _getSizeFromSdfValueType(const PXR_NS::SdfValueTypeName &value)
Get the underlying datatype size of an SdfValueType.
- std::string _getTempFile(const std::string &prefix, const std::string &suffix)
Adapted from ArchMakeTmpFileName (pxr/base/arch). The original uses /var/tmp which is not automatically cleaned up; we override to /tmp to avoid accumulating stale files. Alternatives (tmpnam, mkstemp, boost::filesystem) are either unsafe, non-portable, or add an unwanted link dependency.
- PXR_NS::GfMatrix4d _getTransformFromToFuzzy(const PXR_NS::VtVec3fArray &sourcePoints, const PXR_NS::VtIntArray &sourceIndices, const PXR_NS::VtIntArray &sourceFaceSizes, const PXR_NS::VtVec3fArray &targetPoints, const PXR_NS::VtIntArray &targetIndices, const PXR_NS::VtIntArray &targetFaceSizes)
- PXR_NS::SdfPathVector _getUniqueChildPaths(const PXR_NS::UsdStageWeakPtr &usdStage, const PXR_NS::SdfPath &parentPath, const PXR_NS::TfTokenVector &preferredNames)
Construct a list of unique prim paths based on a parent and a list of preferred child names.
- bool _hasAuthoredTimeSamples(const PXR_NS::UsdPrim &prim)
Return true if an attribute of the prim has any authored time samples.
- size_t _hashPrim(const PXR_NS::UsdStageWeakPtr &usdStage, const PXR_NS::UsdPrim &prim, HashCache &cache)
This is an overload that just passes a null filter for
includeFn.- size_t _hashPrim(const PXR_NS::UsdStageWeakPtr &usdStage, const PXR_NS::UsdPrim &prim, HashCache *cache, const IncludeAttrValueFn &includeFn)
Calculate a hash for a prim.
- size_t _hashPrim(const PXR_NS::UsdStageWeakPtr &usdStage, const PXR_NS::UsdPrim &prim, HashCache &cache, const IncludeAttrValueFn &includeFn)
Kept for backwards compatibility, overload that requires a hash cache.
- void _hidePrims(const std::vector< PXR_NS::UsdPrim > &prims)
Hide the specified prims.
- PXR_NS::GfVec3f _hsvToRgb(float hue, float saturation, float value)
Convert HSV values to an RGB color.
- bool _isInheritableProperty(const PXR_NS::UsdProperty &property)
- pybind11::list _jsonArrayToPybindList(const PXR_NS::JsArray &array)
Creates and returns a Pybind List from a JsArray.
- pybind11::dict _jsonObjectToPybindDict(const PXR_NS::JsObject &object)
Creates and returns a Pybind Dict from a JsObject.
- pybind11::object _jsonValueToPybindObject(const PXR_NS::JsValue &value)
Creates and returns a Pybind Object for the given JsValue.
- bool _mightBeTimeVarying(const PXR_NS::UsdPrim &prim)
Return true if an attribute of the prim ValueMightBeTimeVarying.
- pybind11::tuple _operationResultToPybindTuple(OperationResult &result)
- bool _parseJson(const PXR_NS::UsdStageWeakPtr &usdStage, const PXR_NS::JsValue &document, ExecutionContext *context=nullptr)
Execute one or more operations on a stage based on the contents of a JSON document.
- bool _parseJson(const PXR_NS::UsdStageWeakPtr &usdStage, const std::string &str, ExecutionContext *context=nullptr)
Execute one or more operations on a stage based on a JSON configuration.
- bool _primHasAuthoredUVsWithValues(const PXR_NS::UsdPrim &prim)
Returns true if the prim has authored UVs with values.
- bool _pyAsBool(PyObject *pyObject)
Attempts to return the given python object as a boolean.
- int _pyAsInt(PyObject *pyObject)
Attempts to return the given python object as an int.
- std::string _pyAsString(PyObject *pyObject)
Attempts to return the given python object as a std::string.
- bool _pyCheckAndGetExceptionMessage(std::string &message)
Checks if a Python exception has been raised and, if so, returns the message and stacktrace of the python exception.
- void _pyCheckAndRaiseException()
Checks if a Python exception has been raised and, if so, raises a std::runtime_error with the message of the python exception.
- RefCountedPyObject _pyGetObjectAttribute(PyObject *pyObject, const std::string &attributeName)
Attempts to get named attribute from a Python object.
- void _removePrims(RemoveMethod method, const PXR_NS::UsdStageWeakPtr &usdStage, const std::vector< PXR_NS::UsdPrim > &removePrims, const std::vector< PXR_NS::UsdPrim > &visiblePrims={})
Uses the specified method to remove the prims from the stage.
- void _removePrimsWithAuthoredTimeSamples(std::vector< PXR_NS::UsdPrim > &prims)
Filter a list of prims, removing a prim if an attribute has any authored time samples.
- std::vector< PXR_NS::UsdPrim > _resolveExpressionsToPrims(const PXR_NS::UsdPrim &rootPrim, const std::vector< std::string > &paths, bool meshesOnly=false, bool reverse=true, const PXR_NS::Usd_PrimFlagsPredicate &predicate=PXR_NS::UsdPrimDefaultPredicate)
Resolve prim paths/expressions to UsdPrims.
- std::vector< PXR_NS::UsdPrim > _resolveExpressionsToPrims(const PXR_NS::UsdStageWeakPtr &usdStage, const std::vector< std::string > &paths, bool meshesOnly=false, bool reverse=true, PXR_NS::Usd_PrimFlagsPredicate predicate=PXR_NS::UsdPrimDefaultPredicate)
Resolve prim paths/expressions to UsdPrims.
- std::vector< PXR_NS::UsdPrim > _resolveExpressionsToPrims(const PXR_NS::UsdPrim &rootPrim, const std::vector< std::string > &paths, bool meshesOnly, bool reverse, const PXR_NS::Usd_PrimFlagsPredicate &predicate, const ResolveFilter &filter)
Resolve prim paths/expressions to UsdPrims.
- std::vector< PXR_NS::UsdPrim > _resolvePathsToPrims(const PXR_NS::UsdStageWeakPtr &usdStage, const std::vector< std::string > &paths, bool considerHierarchy, bool meshesOnly=false, bool reverse=true)
- bool _resolvePrim(const PXR_NS::UsdStageWeakPtr &usdStage, const PXR_NS::UsdPrim &prim, std::set< PXR_NS::UsdPrim > *primsSet, bool checkParents=true)
This is a helper function for _resolveExpressionsToPrims.
- PXR_NS::SdfPathVector _resolveSdfPaths(const PXR_NS::UsdStageWeakPtr &usdStage, const std::vector< std::string > &paths)
- PXR_NS::SdfPathVector _resolveSdfPaths(const PXR_NS::UsdStageWeakPtr &usdStage, const std::vector< std::string > &paths, bool considerHierarchy)
- void _safeCreatePrim(const PXR_NS::UsdStageWeakPtr &usdStage, const PXR_NS::SdfPath &primPath, const std::string &typeName, const std::string &parentTypeName, PXR_NS::SdfLayerHandle &editLayer)
Create a prim in the stage by defining it and any parents that do not currently exist in the stage.
- void _setAttributeOnPrims(const std::vector< PXR_NS::UsdPrim > &prims, bool hidden=true)
Set the custom hidden attribute on the specified prims.
- PXR_NS::VtValue _toArrayVtValue(const PXR_NS::VtValue &value)
Given a VtValue, this function either returns it as is, if its an array type or converts it to a single-element array of the same type.
- PXR_NS::JsValue _toJson(const PXR_NS::UsdPrim &data)
Specialization for UsdPrim to extract the path as a string and use that.
- PXR_NS::JsValue _toJson(const T &data)
Convenience function to convert arbitrary types to JSON.
- PXR_NS::JsValue _toJson(const std::map< std::string, T > &data)
Overload to allow a map keyed by string, to a supported JSON value.
- PXR_NS::JsValue _toJson(const PXR_NS::SdfPath &data)
Specialization for SdfPath to extract as a string and use that.
- PXR_NS::JsValue _toJson(const PXR_NS::UsdAttribute &data)
Specialization for UsdAttribute to extract path as a string.
- char * _toJsonStr(const T &data)
Convenience function to convert arbitrary data types to a JSON string. The caller owns the returned memory.
- bool arePointsFinite(const PXR_NS::VtVec3fArray &points)
Returns true if every vector coordinate is finite (no NaN/Inf).
- int32_t carbLevelFromLogLevel(const LogLevel level)
Convert Usd Optimize log level enum to a carb int.
- char * getCStr(const std::string &name)
Get a new char* from a std::string.
- bool isClose(const double &a, const double &b, double epsilon)
- bool isClose(const T &a, const T &b, double epsilon)
- bool isClose(const float &a, const float &b, double epsilon)
- bool isClose(const PXR_NS::VtArray< T > &a, const PXR_NS::VtArray< T > &b, double epsilon)
- bool isClose(const PXR_NS::GfHalf &a, const PXR_NS::GfHalf &b, double epsilon)
- bool isCudaAvailable()
Check if a CUDA-capable GPU is available.
- bool isTransformFinite(const PXR_NS::GfMatrix4d &transform)
Returns true if every component of the matrix is finite (no NaN/Inf).
- void usdOptimizeLog(int32_t level, const char *fmt,…)
Free function entry point for the USD_OPTIMIZE_LOG_X macros.
- Operation * usdOptimizeOperationCreate()
The usdOptimizeOperationCreate template functions will be instantiated via invocations of the USD_OPTIMIZE_PLUGIN_INIT macro but can also be used for manual Operation registration.
- void usdOptimizeOperationDelete(Operation *operation)
The usdOptimizeOperationDelete template functions will be instantiated via invocations of the USD_OPTIMIZE_PLUGIN_INIT macro but can also be used for manual Operation registration.
Namespaces Summary#
Structs Summary#
- ColorValue
Helper struct to store color information.
- MergedValues
Struct to hold the merged mesh values.
- MeshStats
Struct to track mesh counts.
- PrimData
Struct to track information about a prim that is part of a bucket.
- ProcessedData
Struct to contain OMO result data.
- ProcessedHostMesh
- ProcessedHostMeshData
- ProcessedHostPrim
- SdfValueTypeNameHashFunctor
Hash functor for using SdfValueTypeNames with hash-based containers.
- TotalStats
Before/After stats.
Typedefs Summary#
- CoalescerUPtr
Typedef.
- EnumMap
- FloatPreset
- FloatPresetsVector
- HashCache
Cache of prim to hash.
- IncludeAttrValueFn
Attribute filter for use when hashing.
- OperationUPtr
The OperationUPtr is a "managed" pointer, holding an Operation instance and a callback for deleting it correctly.
- ResolveFilter
Optional callback that can be further used to filter whether prims resolve.
- StatCountersUPtr
Typedefs.
- UsdOptimizeOperationCreate
Function objects for creating and destroying Operations inside the correct DLL.
- UsdOptimizeOperationDestroy
Variables Summary#
- constexpr const char * kDisplayTypeAttributeList
Argument Display Types.
- constexpr const char * kDisplayTypeBool
- constexpr const char * kDisplayTypeCode
- constexpr const char * kDisplayTypeEnum
- constexpr const char * kDisplayTypeFloat
- constexpr const char * kDisplayTypeFloatArray
- constexpr const char * kDisplayTypeFloatPresets
- constexpr const char * kDisplayTypeFloatSlider
- constexpr const char * kDisplayTypeInt
- constexpr const char * kDisplayTypeIntSlider
- constexpr const char * kDisplayTypePrimPath
- constexpr const char * kDisplayTypePrimPaths
- constexpr const char * kDisplayTypeText
- constexpr const char * kDisplayTypeTextList
- constexpr const char * s_categoryStatus
Constants.
- constexpr const char * s_displayGroupGeometry
- constexpr const char * s_displayGroupMaterials
- constexpr const char * s_displayGroupStage
- constexpr const char * s_displayGroupUtilities