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

Cache for USD stages. More...

Public Member Functions

 GusdStageCache (const GusdStageCache &)=delete
 
GusdStageCacheoperator= (const GusdStageCache &)=delete
 
void AddDataCache (GusdUSD_DataCache &cache)
 Add/remove auxiliary data caches. More...
 
void RemoveDataCache (GusdUSD_DataCache &cache)
 

Static Public Member Functions

static GusdStageCacheGetInstance ()
 
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...
 

Friends

class GusdStageCacheReader
 
class GusdStageCacheWriter
 

Detailed Description

Cache for USD stages.

Clients interact with the cache via the GusdStageCacheReader and GusdStageCacheWriter classes.

Definition at line 54 of file stageCache.h.

Member Function Documentation

void AddDataCache ( GusdUSD_DataCache &  cache)

Add/remove auxiliary data caches.

Auxiliary data caches are cleared in response to changes to stages on this cache.

static void ReloadLayers ( const UT_Set< SdfLayerHandle > &  layers)
static

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

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

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

Reloading

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.


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