Functions#
- std::shared_ptr< MeshTools::Stage > usd_optimize::GetStage(const PXR_NS::UsdStageRefPtr &usdStage, const std::vector< PXR_NS::UsdPrim > &prims, bool checkTransparency=false)
- void usd_optimize::GetStageMeshDescriptors(std::vector< MeshTools::ClashMeshDescriptor > &meshDescriptors, PXR_NS::SdfPathVector &paths, const PXR_NS::UsdStageRefPtr &usdStage, const std::vector< PXR_NS::UsdPrim > &prims)
- bool usd_optimize::_addMaterialBindingAPIToSchemas(PXR_NS::SdfListOp< PXR_NS::TfToken > &apiSchemas)
- void usd_optimize::_batchedSplitIntoXformAndChild(const PXR_NS::UsdStageWeakPtr &stage, const std::vector< PXR_NS::SdfPath > &primPaths)
- float usd_optimize::_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 usd_optimize::_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 usd_optimize::_collectSceneStats(const PXR_NS::UsdStageWeakPtr &usdStage, const StatArgs &args=StatArgs())
Calculate various statistics based on the specified stage.
- PXR_NS::GfVec3f usd_optimize::_computeCentroid(const PXR_NS::VtVec3fArray &points)
- size_t usd_optimize::_computeExtents(const std::vector< PXR_NS::UsdPrim > &prims)
Returns the number of prims that have had their extents computed by this function.
- size_t usd_optimize::_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 usd_optimize::_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 usd_optimize::_computePseudoMaxVec3f(const PXR_NS::GfVec3f &ref_point, const PXR_NS::GfVec3f &ref_vec, const PXR_NS::VtVec3fArray &points)
- PXR_NS::GfVec3f usd_optimize::_computePseudoMaxVec3f(const PXR_NS::GfVec3f &ref_point, const PXR_NS::VtVec3fArray &points)
- bool usd_optimize::_containsOrderedXformOpsSuffix(const PXR_NS::UsdPrim &prim, const PXR_NS::TfToken &suffix)
- PXR_NS::SdfPathVector usd_optimize::_convertToSdfPaths(const std::vector< PXR_NS::UsdPrim > &prims)
- PXR_NS::UsdPrim usd_optimize::_copyPrim(const PXR_NS::UsdPrim &prim, const PXR_NS::SdfLayerHandle &targetLayer, const PXR_NS::SdfPath &targetPath)
Create a copy of
primattargetPath.- void usd_optimize::_deactivatePrims(const std::vector< PXR_NS::UsdPrim > &prims)
Deactivate the specified prims.
- void usd_optimize::_deletePrims(const PXR_NS::UsdStageWeakPtr &usdStage, const std::vector< PXR_NS::UsdPrim > &prims, bool deactivate=true, bool deleteOvers=false)
- void usd_optimize::_deletePrims(const PXR_NS::UsdStageWeakPtr &usdStage, const std::vector< std::string > &primPaths)
Delete the specified prims.
- void usd_optimize::_findInstancedPrims(const PXR_NS::UsdStageWeakPtr &stage, std::set< PXR_NS::UsdPrim > &instancedPrims)
Find any instanced prims in the scene.
- std::vector< std::string > usd_optimize::_findPrimsMissingExtents(const PXR_NS::UsdStageWeakPtr &usdStage, const std::vector< std::string > &meshPrimPaths)
- std::vector< std::string > usd_optimize::_findPrimsMissingExtents(const std::vector< PXR_NS::UsdPrim > &prims)
Find boundable prims that are missing an authored
extentattribute.- bool usd_optimize::_flattenInstance(const PXR_NS::UsdPrim &prim)
Completely remove instancing from a prim.
- void usd_optimize::_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 usd_optimize::_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 usd_optimize::_getDefaultLinearUnitsPresets()
Returns the default list of float presets for the
UsdGeomLinearUnitsdefinitions.- PXR_NS::VtValue usd_optimize::_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 * usd_optimize::_getExecutionContextFromPyWrapper(pybind11::object context)
Returns the ExecutionContext C struct from the Python wrapper class.
- std::string usd_optimize::_getFormattedBytes(double bytes)
Given a number of bytes, format a human-readable string.
- bool usd_optimize::_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 > usd_optimize::_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 > usd_optimize::_getPivotXformOps(const std::vector< PXR_NS::UsdGeomXformOp > &orderedXformOps, bool includeInverseOps)
- size_t usd_optimize::_getSizeFromSdfValueType(const PXR_NS::SdfValueTypeName &value)
Get the underlying datatype size of an SdfValueType.
- std::string usd_optimize::_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 usd_optimize::_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 usd_optimize::_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 usd_optimize::_hasAuthoredTimeSamples(const PXR_NS::UsdPrim &prim)
Return true if an attribute of the prim has any authored time samples.
- size_t usd_optimize::_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 usd_optimize::_hashPrim(const PXR_NS::UsdStageWeakPtr &usdStage, const PXR_NS::UsdPrim &prim, HashCache *cache, const IncludeAttrValueFn &includeFn)
Calculate a hash for a prim.
- size_t usd_optimize::_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 usd_optimize::_hidePrims(const std::vector< PXR_NS::UsdPrim > &prims)
Hide the specified prims.
- PXR_NS::GfVec3f usd_optimize::_hsvToRgb(float hue, float saturation, float value)
Convert HSV values to an RGB color.
- bool usd_optimize::_isInheritableProperty(const PXR_NS::UsdProperty &property)
- pybind11::list usd_optimize::_jsonArrayToPybindList(const PXR_NS::JsArray &array)
Creates and returns a Pybind List from a JsArray.
- pybind11::dict usd_optimize::_jsonObjectToPybindDict(const PXR_NS::JsObject &object)
Creates and returns a Pybind Dict from a JsObject.
- pybind11::object usd_optimize::_jsonValueToPybindObject(const PXR_NS::JsValue &value)
Creates and returns a Pybind Object for the given JsValue.
- bool usd_optimize::_mightBeTimeVarying(const PXR_NS::UsdPrim &prim)
Return true if an attribute of the prim ValueMightBeTimeVarying.
- pybind11::tuple usd_optimize::_operationResultToPybindTuple(OperationResult &result)
- bool usd_optimize::_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 usd_optimize::_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 usd_optimize::_primHasAuthoredUVsWithValues(const PXR_NS::UsdPrim &prim)
Returns true if the prim has authored UVs with values.
- bool usd_optimize::_pyAsBool(PyObject *pyObject)
Attempts to return the given python object as a boolean.
- int usd_optimize::_pyAsInt(PyObject *pyObject)
Attempts to return the given python object as an int.
- std::string usd_optimize::_pyAsString(PyObject *pyObject)
Attempts to return the given python object as a std::string.
- bool usd_optimize::_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 usd_optimize::_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 usd_optimize::_pyGetObjectAttribute(PyObject *pyObject, const std::string &attributeName)
Attempts to get named attribute from a Python object.
- void usd_optimize::_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 usd_optimize::_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 > usd_optimize::_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 > usd_optimize::_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 > usd_optimize::_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 > usd_optimize::_resolvePathsToPrims(const PXR_NS::UsdStageWeakPtr &usdStage, const std::vector< std::string > &paths, bool considerHierarchy, bool meshesOnly=false, bool reverse=true)
- bool usd_optimize::_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 usd_optimize::_resolveSdfPaths(const PXR_NS::UsdStageWeakPtr &usdStage, const std::vector< std::string > &paths)
- PXR_NS::SdfPathVector usd_optimize::_resolveSdfPaths(const PXR_NS::UsdStageWeakPtr &usdStage, const std::vector< std::string > &paths, bool considerHierarchy)
- void usd_optimize::_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 usd_optimize::_setAttributeOnPrims(const std::vector< PXR_NS::UsdPrim > &prims, bool hidden=true)
Set the custom hidden attribute on the specified prims.
- PXR_NS::VtValue usd_optimize::_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 usd_optimize::_toJson(const PXR_NS::UsdPrim &data)
Specialization for UsdPrim to extract the path as a string and use that.
- PXR_NS::JsValue usd_optimize::_toJson(const T &data)
Convenience function to convert arbitrary types to JSON.
- PXR_NS::JsValue usd_optimize::_toJson(const std::map< std::string, T > &data)
Overload to allow a map keyed by string, to a supported JSON value.
- PXR_NS::JsValue usd_optimize::_toJson(const PXR_NS::SdfPath &data)
Specialization for SdfPath to extract as a string and use that.
- PXR_NS::JsValue usd_optimize::_toJson(const PXR_NS::UsdAttribute &data)
Specialization for UsdAttribute to extract path as a string.
- char * usd_optimize::_toJsonStr(const T &data)
Convenience function to convert arbitrary data types to a JSON string. The caller owns the returned memory.
- bool usd_optimize::arePointsFinite(const PXR_NS::VtVec3fArray &points)
Returns true if every vector coordinate is finite (no NaN/Inf).
- int32_t usd_optimize::carbLevelFromLogLevel(const LogLevel level)
Convert Usd Optimize log level enum to a carb int.
- char * usd_optimize::getCStr(const std::string &name)
Get a new char* from a std::string.
- bool usd_optimize::isClose(const double &a, const double &b, double epsilon)
- bool usd_optimize::isClose(const T &a, const T &b, double epsilon)
- bool usd_optimize::isClose(const float &a, const float &b, double epsilon)
- bool usd_optimize::isClose(const PXR_NS::VtArray< T > &a, const PXR_NS::VtArray< T > &b, double epsilon)
- bool usd_optimize::isClose(const PXR_NS::GfHalf &a, const PXR_NS::GfHalf &b, double epsilon)
- bool usd_optimize::isCudaAvailable()
Check if a CUDA-capable GPU is available.
- bool usd_optimize::isTransformFinite(const PXR_NS::GfMatrix4d &transform)
Returns true if every component of the matrix is finite (no NaN/Inf).
- void usd_optimize::tbbcompat::parallelForEach(Iterator first, Iterator last, const Function &function)
- void usd_optimize::usdOptimizeLog(int32_t level, const char *fmt,…)
Free function entry point for the USD_OPTIMIZE_LOG_X macros.
- Operation * usd_optimize::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 usd_optimize::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.
- void usd_optimize_execution_context_copy(ExecutionContext *a, ExecutionContext *b)
Copies the data from ExecutionContext b onto a.
- void usd_optimize_execution_context_free(ExecutionContext *context)
Cleanup function for execution context.
- void usd_optimize_operation_result_free(OperationResult *result)
Cleanup function for result.