Blender  V3.3
Functions
gpencil_update_cache.c File Reference
#include <stdio.h>
#include "BKE_gpencil_update_cache.h"
#include "BLI_dlrbTree.h"
#include "BLI_listbase.h"
#include "BKE_gpencil.h"
#include "DNA_gpencil_types.h"
#include "DNA_userdef_types.h"
#include "MEM_guardedalloc.h"

Go to the source code of this file.

Functions

static GPencilUpdateCacheupdate_cache_alloc (int index, int flag, void *data)
 
static short cache_node_compare (void *node, void *data)
 
static DLRBT_Nodecache_node_alloc (void *data)
 
static void cache_node_free (void *node)
 
static void update_cache_free (GPencilUpdateCache *cache)
 
static void cache_node_update (void *node, void *data)
 
static void update_cache_node_create_ex (GPencilUpdateCache *root_cache, void *data, int gpl_index, int gpf_index, int gps_index, bool full_copy)
 
static void update_cache_node_create (bGPdata *gpd, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps, bool full_copy)
 
static void gpencil_traverse_update_cache_ex (GPencilUpdateCache *parent_cache, GPencilUpdateCacheTraverseSettings *ts, int depth, void *user_data)
 
Update Cache API
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 (bGPdata *gpd, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps)
 
void BKE_gpencil_tag_light_update (bGPdata *gpd, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps)
 
void BKE_gpencil_free_update_cache (bGPdata *gpd)
 

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

◆ cache_node_alloc()

static DLRBT_Node* cache_node_alloc ( void data)
static

Definition at line 43 of file gpencil_update_cache.c.

References GPencilUpdateCacheNode::cache, data, and MEM_callocN.

Referenced by update_cache_node_create_ex().

◆ cache_node_compare()

static short cache_node_compare ( void node,
void data 
)
static

Definition at line 33 of file gpencil_update_cache.c.

References data, and node.

Referenced by update_cache_node_create_ex().

◆ cache_node_free()

static void cache_node_free ( void node)
static

◆ cache_node_update()

static void cache_node_update ( void node,
void data 
)
static

◆ gpencil_traverse_update_cache_ex()

static void gpencil_traverse_update_cache_ex ( GPencilUpdateCache parent_cache,
GPencilUpdateCacheTraverseSettings ts,
int  depth,
void user_data 
)
static

◆ update_cache_alloc()

static GPencilUpdateCache* update_cache_alloc ( int  index,
int  flag,
void data 
)
static

◆ update_cache_free()

static void update_cache_free ( GPencilUpdateCache cache)
static

◆ update_cache_node_create()

static void update_cache_node_create ( bGPdata gpd,
bGPDlayer gpl,
bGPDframe gpf,
bGPDstroke gps,
bool  full_copy 
)
static

◆ update_cache_node_create_ex()

static void update_cache_node_create_ex ( GPencilUpdateCache root_cache,
void data,
int  gpl_index,
int  gpf_index,
int  gps_index,
bool  full_copy 
)
static