All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GusdStageCache Class Reference

#include <stageCache.h>

Public Member Functions

 GusdStageCache ()
 ~GusdStageCache ()
 GusdStageCache (const GusdStageCache &)=delete
GusdStageCacheoperator= (const GusdStageCache &)=delete
void AddDataCache (GusdUSD_DataCache &cache)
void RemoveDataCache (GusdUSD_DataCache &cache)

Static Public Member Functions

static GusdStageCacheGetInstance ()
 Get the singleton GusdStageCache object. More...
static void SetLopStageResolver (GusdLopStageResolver resolver)
static void SetStageCacheReaderTracker (GusdStageCacheReaderTracker tracker)
static UT_StringHolder CreateLopStageIdentifier (OP_Node *lop, bool strip_layers, fpreal t)
static bool SplitLopStageIdentifier (const UT_StringRef &identifier, OP_Node *&lop, bool &strip_layers, fpreal &t)
static void ReloadStages (const UT_Set< UsdStagePtr > &stages)
 Mark a set of stages for reload on the event queue. More...
static void ReloadLayers (const UT_Set< SdfLayerHandle > &layers)
 Mark a set of layers for reload on the event queue. More...


class GusdStageCacheReader
class GusdStageCacheWriter

Detailed Description

Cache for USD stages. Clients interact with the cache via the GusdStageCacheReader and GusdStageCacheWriter classes.

Definition at line 57 of file stageCache.h.

Constructor & Destructor Documentation

GusdStageCache::GusdStageCache ( )
GusdStageCache::~GusdStageCache ( )
GusdStageCache::GusdStageCache ( const GusdStageCache )

Member Function Documentation

void GusdStageCache::AddDataCache ( GusdUSD_DataCache cache)

Add/remove auxiliary data caches. Auxiliary data caches are cleared in response to changes to stages on this cache.

static UT_StringHolder GusdStageCache::CreateLopStageIdentifier ( OP_Node lop,
bool  strip_layers,
fpreal  t 

Utility function to create a LOP stage identifier from a path to a LOP node, and the other bits of data required to generated a locked stage from a LOP node in the HUSD library.

static GusdStageCache& GusdStageCache::GetInstance ( )

Get the singleton GusdStageCache object.

GusdStageCache& GusdStageCache::operator= ( const GusdStageCache )
static void GusdStageCache::ReloadLayers ( const UT_Set< SdfLayerHandle > &  layers)

Mark a set of layers for reload on the event queue.

static void GusdStageCache::ReloadStages ( const UT_Set< UsdStagePtr > &  stages)

Mark a set of stages for reload on the event queue.


Stages and layers may be reloaded during an active session, but it's important to understand the full implications of doing so. When a layer is reloaded, change notifications are sent to any stages referencing that layer, causing those stages to recompose, if necessary. This operation is not thread-safe, and may result in a crash if another thread is attempting to read from an affected stage at the same time. Further, it must be noted that simply loading stages within separate GusdStageCache instances also does not mean that that change propopagation will be isolated only to stages of the stage cache instance: Although it is possible to isolate the effect of changes on the root layers of stages to some extent, secondary layers – such as sublayers and reference arcs – are shared on a global cache. The effect of reloading layers is global and immediate.

Rather than attempting to solve this problem with intrusive and expensive locking – which would only solve the problem for stages held internally in a GusdStageCache, not for stages referenced from other caches – we prefer to address the problem by requiring that reloading only be performed at certain points of Houdini's main event loop, where it is known to be safe. An example of a 'safe' way to exec stage reloads is via a callback triggered by a button in a node's GUI. Users should never attempt to reload stages or layers during node cook methods.

void GusdStageCache::RemoveDataCache ( GusdUSD_DataCache cache)

Add/remove auxiliary data caches. Auxiliary data caches are cleared in response to changes to stages on this cache.

static void GusdStageCache::SetLopStageResolver ( GusdLopStageResolver  resolver)

Set the callback function that should be used to interpret stage file paths that specify a LOP node.

static void GusdStageCache::SetStageCacheReaderTracker ( GusdStageCacheReaderTracker  tracker)

Set a callback used to track the construction and destruction of stage cache readers/writers. This is used by the Lop Stage Resolver to know when it is safe to clean up after itself.

static bool GusdStageCache::SplitLopStageIdentifier ( const UT_StringRef identifier,
OP_Node *&  lop,
bool &  strip_layers,
fpreal t 

Utility function to split a stage file path specifying a LOP node into a part that specifies the LOP node and any additional arguments that may appear after the LOP node path. Returns true if the path is a LOP node path (starts with "op:"), otherwise returns false.

Friends And Related Function Documentation

friend class GusdStageCacheReader

Definition at line 144 of file stageCache.h.

friend class GusdStageCacheWriter

Definition at line 145 of file stageCache.h.

The documentation for this class was generated from the following file: