Blender V4.3
BKE_gpencil_update_cache_legacy.h File Reference
#include "BLI_sys_types.h"

Go to the source code of this file.

Classes

struct  GPencilUpdateCache
 
struct  GPencilUpdateCacheNode
 
struct  GPencilUpdateCacheTraverseSettings
 

Typedefs

typedef enum eGPUpdateCacheNodeFlag eGPUpdateCacheNodeFlag
 
typedef struct GPencilUpdateCache GPencilUpdateCache
 
typedef struct GPencilUpdateCacheNode GPencilUpdateCacheNode
 
typedef bool(* GPencilUpdateCacheIter_Cb) (GPencilUpdateCache *cache, void *user_data)
 
typedef struct GPencilUpdateCacheTraverseSettings GPencilUpdateCacheTraverseSettings
 

Enumerations

enum  eGPUpdateCacheNodeFlag { GP_UPDATE_NODE_NO_COPY = 0 , GP_UPDATE_NODE_LIGHT_COPY = 1 , GP_UPDATE_NODE_FULL_COPY = 2 }
 

Functions

GPencilUpdateCacheBKE_gpencil_create_update_cache (void *data, bool full_copy)
 
void BKE_gpencil_traverse_update_cache (GPencilUpdateCache *cache, GPencilUpdateCacheTraverseSettings *ts, void *user_data)
 
void BKE_gpencil_free_update_cache (struct bGPdata *gpd)
 

Typedef Documentation

◆ eGPUpdateCacheNodeFlag

◆ GPencilUpdateCache

typedef struct GPencilUpdateCache GPencilUpdateCache

Cache for what needs to be updated after bGPdata was modified.

Every node holds information about one element that was changed:

  • The index of where that element is in the linked-list.
  • The pointer to the original element in bGPdata.

Additionally, nodes also hold other nodes that are one "level" below them. E.g. a node that represents a change on a bGPDframe could contain a set of nodes that represent a change on bGPDstrokes. These nodes are stored in a red-black tree so that they are sorted by their index to make sure they can be processed in the correct order.

◆ GPencilUpdateCacheIter_Cb

typedef bool(* GPencilUpdateCacheIter_Cb) (GPencilUpdateCache *cache, void *user_data)

Callback that is called in BKE_gpencil_traverse_update_cache at each level. If the callback returns true, then the children will not be iterated over and instead continue.

Parameters
cacheThe cache at this level.
user_dataPointer to the user_data passed to BKE_gpencil_traverse_update_cache.
Returns
true, if iterating over the children of cache should be skipped, false if not.

Definition at line 78 of file BKE_gpencil_update_cache_legacy.h.

◆ GPencilUpdateCacheNode

typedef struct GPencilUpdateCacheNode GPencilUpdateCacheNode

◆ GPencilUpdateCacheTraverseSettings

typedef struct GPencilUpdateCacheTraverseSettings GPencilUpdateCacheTraverseSettings

Enumeration Type Documentation

◆ eGPUpdateCacheNodeFlag

GPencilUpdateCache.flag

Enumerator
GP_UPDATE_NODE_NO_COPY 
GP_UPDATE_NODE_LIGHT_COPY 
GP_UPDATE_NODE_FULL_COPY 

Definition at line 25 of file BKE_gpencil_update_cache_legacy.h.

Function Documentation

◆ BKE_gpencil_create_update_cache()

GPencilUpdateCache * BKE_gpencil_create_update_cache ( void * data,
bool full_copy )

Allocates a new GPencilUpdateCache and populates it.

Parameters
dataA data pointer to populate the initial cache with.
full_copyIf true, will mark this update cache as a full copy (GP_UPDATE_NODE_FULL_COPY). If false, it will be marked as a struct copy (GP_UPDATE_NODE_LIGHT_COPY).

Definition at line 79 of file gpencil_update_cache_legacy.cc.

References data, GP_UPDATE_NODE_FULL_COPY, GP_UPDATE_NODE_LIGHT_COPY, and update_cache_alloc().

◆ BKE_gpencil_free_update_cache()

void BKE_gpencil_free_update_cache ( struct bGPdata * gpd)

Frees the GPencilUpdateCache on the gpd->runtime. This will not free the data that the cache node might point to. It assumes that the cache does not own the data.

Definition at line 92 of file gpencil_update_cache_legacy.cc.

References bGPdata::runtime, bGPdata_Runtime::update_cache, and update_cache_free().

Referenced by BKE_gpencil_free_data().

◆ BKE_gpencil_traverse_update_cache()

void BKE_gpencil_traverse_update_cache ( GPencilUpdateCache * cache,
GPencilUpdateCacheTraverseSettings * ts,
void * user_data )

Traverses an update cache and executes callbacks at each level.

Parameters
cacheThe update cache to traverse.
tsThe traversal settings. This stores the callbacks that are called at each level.
user_dataCustom data passed to each callback.

Definition at line 85 of file gpencil_update_cache_legacy.cc.

References gpencil_traverse_update_cache_ex().