Blender  V3.3
Classes | Typedefs | Enumerations | Functions
BKE_gpencil_update_cache.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_tag_full_update (struct bGPdata *gpd, struct bGPDlayer *gpl, struct bGPDframe *gpf, struct bGPDstroke *gps)
 
void BKE_gpencil_tag_light_update (struct bGPdata *gpd, struct bGPDlayer *gpl, struct bGPDframe *gpf, struct bGPDstroke *gps)
 
void BKE_gpencil_free_update_cache (struct bGPdata *gpd)
 

Typedef Documentation

◆ eGPUpdateCacheNodeFlag

◆ 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 77 of file BKE_gpencil_update_cache.h.

◆ GPencilUpdateCacheNode

◆ 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 24 of file BKE_gpencil_update_cache.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 226 of file gpencil_update_cache.c.

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 249 of file gpencil_update_cache.c.

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

Referenced by BKE_gpencil_free_data(), BKE_gpencil_update_on_write(), and blender::deg::GPencilBackup::restore_to_gpencil().

◆ BKE_gpencil_tag_full_update()

void BKE_gpencil_tag_full_update ( struct bGPdata gpd,
struct bGPDlayer gpl,
struct bGPDframe gpf,
struct bGPDstroke gps 
)

Tags an element (bGPdata, bGPDlayer, bGPDframe, or bGPDstroke) and all of its containing data to be updated in the next update-on-write operation.

The function assumes that when a parameter is NULL all of the following parameters are NULL too. E.g. in order to tag a layer (gpl), the parameters would have to be (gpd, gpl, NULL, NULL).

Definition at line 239 of file gpencil_update_cache.c.

References update_cache_node_create().

Referenced by gpencil_paint_initstroke(), gpencil_sculpt_brush_do_frame(), gpencil_sculpt_brush_init_stroke(), gpencil_stroke_newfrombuffer(), and gpencil_update_geometry().

◆ BKE_gpencil_tag_light_update()

void BKE_gpencil_tag_light_update ( struct bGPdata gpd,
struct bGPDlayer gpl,
struct bGPDframe gpf,
struct bGPDstroke gps 
)

Tags an element (bGPdata, bGPDlayer, bGPDframe, or bGPDstroke) to be updated in the next update-on-write operation. This function will not update any of the containing data, only the struct itself.

The function assumes that when a parameter is NULL all of the following parameters are NULL too. E.g. in order to tag a layer (gpl), the parameters would have to be (gpd, gpl, NULL, NULL).

Definition at line 244 of file gpencil_update_cache.c.

References update_cache_node_create().

◆ 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 232 of file gpencil_update_cache.c.

References gpencil_traverse_update_cache_ex(), and user_data.

Referenced by BKE_gpencil_update_on_write().