All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
introspection.h File Reference

Collection of module-scoped utilities for introspecting a given USD stage. More...

+ Include dependency graph for introspection.h:

Go to the source code of this file.

Macros

#define USDUTILS_USDSTAGE_STATS
 

Functions

 SDF_DECLARE_HANDLES (SdfLayer)
 
 TF_DECLARE_PUBLIC_TOKENS (UsdUtilsUsdStageStatsKeys, USDUTILS_API, USDUTILS_USDSTAGE_STATS)
 
USDUTILS_API UsdStageRefPtr UsdUtilsComputeUsdStageStats (const std::string &rootLayerPath, VtDictionary *stats)
 Opens the given layer on a USD stage and collects various stats. More...
 
USDUTILS_API size_t UsdUtilsComputeUsdStageStats (const UsdStageWeakPtr &stage, VtDictionary *stats)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Computes stats on an already opened USD stage. More...
 

Detailed Description

Collection of module-scoped utilities for introspecting a given USD stage.

Future additions might include full-on dependency extraction, queries like "Does this stage contain this asset?", "usd grep" functionality, etc.

Definition in file introspection.h.

Macro Definition Documentation

#define USDUTILS_USDSTAGE_STATS
Value:
(approxMemoryInMb) \
(totalPrimCount) \
(modelCount) \
(instancedModelCount) \
(assetCount) \
(masterCount) \
(totalInstanceCount) \
(usedLayerCount) \
(primary) \
(masters) \
(primCounts) \
/*(totalPrimCount)*/ \
(activePrimCount) \
(inactivePrimCount) \
(pureOverCount) \
(instanceCount) \
(primCountsByType) \
(untyped)

Definition at line 48 of file introspection.h.

Function Documentation

USDUTILS_API UsdStageRefPtr UsdUtilsComputeUsdStageStats ( const std::string &  rootLayerPath,
VtDictionary stats 
)

Opens the given layer on a USD stage and collects various stats.

The stats are populated in the dictionary-valued output param stats.

The set of stats include:

  • approxMemoryInMb - approximate memory allocated when opening the stage with all the models loaded.
  • totalPrimCount - total number of prims
  • modelCount - number of models
  • instancedModelCount - number of instanced models
  • assetCount - number of assets
  • masterCount - number of masters
  • totalInstanceCount - total number of instances (including nested instances)
  • two sub-dictionaries, 'primary' and 'masters' for the "primary" prim tree and for all the master subtrees respectively, containing the following stats:
  • primCounts - a sub-dictionary containing the following
    • totalPrimCount - number of prims
    • activePrimCount - number of active prims
    • inactivePrimCount - number of inactive prims
    • pureOverCount - number of pure overs
    • instanceCount - number of instances
  • primCountsByType - a sub-dictionary containing prim counts keyed by the prim type.

Returns the stage that was opened.

The "masters" subdictionary is populated only if the stage has one ore more instanced models.

Note
The approximate memory allocated when opening the stage is computed and reported only if the TfMallocTag system has already been initialized by the client, and the number will represent only additional consumed memory, so if some of the layers the stage uses are already open, the true memory consumption for the stage may be higher than reported.
See Also
TfMallocTag::IsInitialized()
Note
Only component models are included in 'modelCount' and 'instancedModelCount'.
USDUTILS_API size_t UsdUtilsComputeUsdStageStats ( const UsdStageWeakPtr &  stage,
VtDictionary stats 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Computes stats on an already opened USD stage.

Returns the total number of prims on the stage, including active, inactive. pure overs, prims inside masters etc.