Blender  V2.93
Macros | Typedefs | Enumerations | Functions | Variables
BKE_gpencil.h File Reference

Go to the source code of this file.

Macros

#define GPENCIL_SIMPLIFY(scene)   ((scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ENABLE))
 
#define GPENCIL_SIMPLIFY_ONPLAY(playing)
 
#define GPENCIL_SIMPLIFY_FILL(scene, playing)
 
#define GPENCIL_SIMPLIFY_MODIF(scene)    ((GPENCIL_SIMPLIFY(scene) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_MODIFIER)))
 
#define GPENCIL_SIMPLIFY_FX(scene, playing)
 
#define GPENCIL_SIMPLIFY_TINT(scene)    ((GPENCIL_SIMPLIFY(scene)) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_TINT))
 
#define GPENCIL_SIMPLIFY_AA(scene)    ((GPENCIL_SIMPLIFY(scene)) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_AA))
 
#define GPENCIL_USE_VERTEX_COLOR(toolsettings)    (((toolsettings)->gp_paint->mode == GPPAINT_FLAG_USE_VERTEXCOLOR))
 
#define GPENCIL_USE_VERTEX_COLOR_STROKE(toolsettings, brush)
 
#define GPENCIL_USE_VERTEX_COLOR_FILL(toolsettings, brush)
 
#define GPENCIL_TINT_VERTEX_COLOR_STROKE(brush)
 
#define GPENCIL_TINT_VERTEX_COLOR_FILL(brush)
 
#define GP_PRIM_DATABUF_SIZE   5
 
#define GPENCIL_ALPHA_OPACITY_THRESH   0.001f
 
#define GPENCIL_STRENGTH_MIN   0.003f
 

Typedefs

typedef enum eGP_GetFrame_Mode eGP_GetFrame_Mode
 
typedef void(* gpIterCb) (struct bGPDlayer *layer, struct bGPDframe *frame, struct bGPDstroke *stroke, void *thunk)
 

Enumerations

enum  eGP_GetFrame_Mode { GP_GETFRAME_USE_PREV = 0 , GP_GETFRAME_ADD_NEW = 1 , GP_GETFRAME_ADD_COPY = 2 }
 

Functions

void BKE_gpencil_free_point_weights (struct MDeformVert *dvert)
 
void BKE_gpencil_free_stroke_weights (struct bGPDstroke *gps)
 
void BKE_gpencil_free_stroke_editcurve (struct bGPDstroke *gps)
 
void BKE_gpencil_free_stroke (struct bGPDstroke *gps)
 
bool BKE_gpencil_free_strokes (struct bGPDframe *gpf)
 
void BKE_gpencil_free_frames (struct bGPDlayer *gpl)
 
void BKE_gpencil_free_layers (struct ListBase *list)
 
void BKE_gpencil_free (struct bGPdata *gpd, bool free_all)
 
void BKE_gpencil_eval_delete (struct bGPdata *gpd_eval)
 
void BKE_gpencil_free_layer_masks (struct bGPDlayer *gpl)
 
void BKE_gpencil_tag (struct bGPdata *gpd)
 
void BKE_gpencil_batch_cache_dirty_tag (struct bGPdata *gpd)
 
void BKE_gpencil_batch_cache_free (struct bGPdata *gpd)
 
void BKE_gpencil_stroke_sync_selection (struct bGPdata *gpd, struct bGPDstroke *gps)
 
void BKE_gpencil_curve_sync_selection (struct bGPdata *gpd, struct bGPDstroke *gps)
 
void BKE_gpencil_stroke_select_index_set (struct bGPdata *gpd, struct bGPDstroke *gps)
 
void BKE_gpencil_stroke_select_index_reset (struct bGPDstroke *gps)
 
struct bGPDframe * BKE_gpencil_frame_addnew (struct bGPDlayer *gpl, int cframe)
 
struct bGPDframe * BKE_gpencil_frame_addcopy (struct bGPDlayer *gpl, int cframe)
 
struct bGPDlayer * BKE_gpencil_layer_addnew (struct bGPdata *gpd, const char *name, bool setactive)
 
struct bGPdata * BKE_gpencil_data_addnew (struct Main *bmain, const char name[])
 
struct bGPDframe * BKE_gpencil_frame_duplicate (const struct bGPDframe *gpf_src, const bool dup_strokes)
 
struct bGPDlayer * BKE_gpencil_layer_duplicate (const struct bGPDlayer *gpl_src, const bool dup_frames, const bool dup_strokes)
 
void BKE_gpencil_frame_copy_strokes (struct bGPDframe *gpf_src, struct bGPDframe *gpf_dst)
 
void BKE_gpencil_frame_selected_hash (struct bGPdata *gpd, struct GHash *r_list)
 
struct bGPDcurve * BKE_gpencil_stroke_curve_duplicate (struct bGPDcurve *gpc_src)
 
struct bGPDstroke * BKE_gpencil_stroke_duplicate (struct bGPDstroke *gps_src, const bool dup_points, const bool dup_curve)
 
struct bGPdata * BKE_gpencil_data_duplicate (struct Main *bmain, const struct bGPdata *gpd, bool internal_copy)
 
void BKE_gpencil_frame_delete_laststroke (struct bGPDlayer *gpl, struct bGPDframe *gpf)
 
void BKE_gpencil_material_index_reassign (struct bGPdata *gpd, int totcol, int index)
 
bool BKE_gpencil_material_index_used (struct bGPdata *gpd, int index)
 
void BKE_gpencil_material_remap (struct bGPdata *gpd, const unsigned int *remap, unsigned int remap_len)
 
bool BKE_gpencil_merge_materials_table_get (struct Object *ob, const float hue_threshold, const float sat_threshold, const float val_threshold, struct GHash *r_mat_table)
 
bool BKE_gpencil_merge_materials (struct Object *ob, const float hue_threshold, const float sat_threshold, const float val_threshold, int *r_removed)
 
void BKE_gpencil_stats_update (struct bGPdata *gpd)
 
void BKE_gpencil_stroke_add_points (struct bGPDstroke *gps, const float *array, const int totpoints, const float mat[4][4])
 
struct bGPDstroke * BKE_gpencil_stroke_new (int mat_idx, int totpoints, short thickness)
 
struct bGPDstroke * BKE_gpencil_stroke_add (struct bGPDframe *gpf, int mat_idx, int totpoints, short thickness, const bool insert_at_head)
 
struct bGPDstroke * BKE_gpencil_stroke_add_existing_style (struct bGPDframe *gpf, struct bGPDstroke *existing, int mat_idx, int totpoints, short thickness)
 
struct bGPDcurve * BKE_gpencil_stroke_editcurve_new (const int tot_curve_points)
 
bool BKE_gpencil_layer_is_editable (const struct bGPDlayer *gpl)
 
struct bGPDframe * BKE_gpencil_layer_frame_get (struct bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode addnew)
 
struct bGPDframe * BKE_gpencil_layer_frame_find (struct bGPDlayer *gpl, int cframe)
 
bool BKE_gpencil_layer_frame_delete (struct bGPDlayer *gpl, struct bGPDframe *gpf)
 
struct bGPDlayer * BKE_gpencil_layer_named_get (struct bGPdata *gpd, const char *name)
 
struct bGPDlayer * BKE_gpencil_layer_active_get (struct bGPdata *gpd)
 
void BKE_gpencil_layer_active_set (struct bGPdata *gpd, struct bGPDlayer *active)
 
void BKE_gpencil_layer_delete (struct bGPdata *gpd, struct bGPDlayer *gpl)
 
void BKE_gpencil_layer_autolock_set (struct bGPdata *gpd, const bool unlock)
 
struct bGPDlayer_Mask * BKE_gpencil_layer_mask_add (struct bGPDlayer *gpl, const char *name)
 
void BKE_gpencil_layer_mask_remove (struct bGPDlayer *gpl, struct bGPDlayer_Mask *mask)
 
void BKE_gpencil_layer_mask_remove_ref (struct bGPdata *gpd, const char *name)
 
struct bGPDlayer_Mask * BKE_gpencil_layer_mask_named_get (struct bGPDlayer *gpl, const char *name)
 
void BKE_gpencil_layer_mask_sort (struct bGPdata *gpd, struct bGPDlayer *gpl)
 
void BKE_gpencil_layer_mask_sort_all (struct bGPdata *gpd)
 
void BKE_gpencil_layer_frames_sort (struct bGPDlayer *gpl, bool *r_has_duplicate_frames)
 
struct bGPDlayer * BKE_gpencil_layer_get_by_name (struct bGPdata *gpd, char *name, int first_if_not_found)
 
struct Material * BKE_gpencil_brush_material_get (struct Brush *brush)
 
void BKE_gpencil_brush_material_set (struct Brush *brush, struct Material *material)
 
struct Material * BKE_gpencil_object_material_ensure_active (struct Object *ob)
 
struct Material * BKE_gpencil_object_material_ensure_from_brush (struct Main *bmain, struct Object *ob, struct Brush *brush)
 
int BKE_gpencil_object_material_ensure (struct Main *bmain, struct Object *ob, struct Material *material)
 
struct Material * BKE_gpencil_object_material_ensure_by_name (struct Main *bmain, struct Object *ob, const char *name, int *r_index)
 
struct Material * BKE_gpencil_object_material_new (struct Main *bmain, struct Object *ob, const char *name, int *r_index)
 
int BKE_gpencil_object_material_index_get (struct Object *ob, struct Material *ma)
 
int BKE_gpencil_object_material_index_get_by_name (struct Object *ob, const char *name)
 
struct Material * BKE_gpencil_object_material_from_brush_get (struct Object *ob, struct Brush *brush)
 
int BKE_gpencil_object_material_get_index_from_brush (struct Object *ob, struct Brush *brush)
 
struct Material * BKE_gpencil_object_material_ensure_from_active_input_toolsettings (struct Main *bmain, struct Object *ob, struct ToolSettings *ts)
 
struct Material * BKE_gpencil_object_material_ensure_from_active_input_brush (struct Main *bmain, struct Object *ob, struct Brush *brush)
 
struct Material * BKE_gpencil_object_material_ensure_from_active_input_material (struct Object *ob)
 
bool BKE_gpencil_stroke_select_check (const struct bGPDstroke *gps)
 
void BKE_gpencil_dvert_ensure (struct bGPDstroke *gps)
 
void BKE_gpencil_vgroup_remove (struct Object *ob, struct bDeformGroup *defgroup)
 
void BKE_gpencil_stroke_weights_duplicate (struct bGPDstroke *gps_src, struct bGPDstroke *gps_dst)
 
void BKE_gpencil_frame_active_set (struct Depsgraph *depsgraph, struct bGPdata *gpd)
 
void BKE_gpencil_frame_range_selected (struct bGPDlayer *gpl, int *r_initframe, int *r_endframe)
 
float BKE_gpencil_multiframe_falloff_calc (struct bGPDframe *gpf, int actnum, int f_init, int f_end, struct CurveMapping *cur_falloff)
 
void BKE_gpencil_palette_ensure (struct Main *bmain, struct Scene *scene)
 
bool BKE_gpencil_from_image (struct SpaceImage *sima, struct bGPdata *gpd, struct bGPDframe *gpf, const float size, const bool mask)
 
void BKE_gpencil_visible_stroke_iter (struct ViewLayer *view_layer, struct Object *ob, gpIterCb layer_cb, gpIterCb stroke_cb, void *thunk, bool do_onion, int cfra)
 
void BKE_gpencil_frame_original_pointers_update (const struct bGPDframe *gpf_orig, const struct bGPDframe *gpf_eval)
 
void BKE_gpencil_update_orig_pointers (const struct Object *ob_orig, const struct Object *ob_eval)
 
void BKE_gpencil_layer_transform_matrix_get (const struct Depsgraph *depsgraph, struct Object *obact, struct bGPDlayer *gpl, float diff_mat[4][4])
 
void BKE_gpencil_update_layer_transforms (const struct Depsgraph *depsgraph, struct Object *ob)
 
int BKE_gpencil_material_find_index_by_name_prefix (struct Object *ob, const char *name_prefix)
 
void BKE_gpencil_blend_read_data (struct BlendDataReader *reader, struct bGPdata *gpd)
 

Variables

void(* BKE_gpencil_batch_cache_dirty_tag_cb )(struct bGPdata *gpd)
 
void(* BKE_gpencil_batch_cache_free_cb )(struct bGPdata *gpd)
 

Macro Definition Documentation

◆ GP_PRIM_DATABUF_SIZE

#define GP_PRIM_DATABUF_SIZE   5

Definition at line 157 of file BKE_gpencil.h.

◆ GPENCIL_ALPHA_OPACITY_THRESH

#define GPENCIL_ALPHA_OPACITY_THRESH   0.001f

Definition at line 177 of file BKE_gpencil.h.

◆ GPENCIL_SIMPLIFY

#define GPENCIL_SIMPLIFY (   scene)    ((scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ENABLE))

Definition at line 52 of file BKE_gpencil.h.

◆ GPENCIL_SIMPLIFY_AA

#define GPENCIL_SIMPLIFY_AA (   scene)     ((GPENCIL_SIMPLIFY(scene)) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_AA))

Definition at line 66 of file BKE_gpencil.h.

◆ GPENCIL_SIMPLIFY_FILL

#define GPENCIL_SIMPLIFY_FILL (   scene,
  playing 
)
Value:
#define GPENCIL_SIMPLIFY(scene)
Definition: BKE_gpencil.h:52
#define GPENCIL_SIMPLIFY_ONPLAY(playing)
Definition: BKE_gpencil.h:53
@ SIMPLIFY_GPENCIL_FILL
Scene scene
short simplify_gpencil
struct RenderData r

Definition at line 56 of file BKE_gpencil.h.

◆ GPENCIL_SIMPLIFY_FX

#define GPENCIL_SIMPLIFY_FX (   scene,
  playing 
)
Value:

Definition at line 61 of file BKE_gpencil.h.

◆ GPENCIL_SIMPLIFY_MODIF

#define GPENCIL_SIMPLIFY_MODIF (   scene)     ((GPENCIL_SIMPLIFY(scene) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_MODIFIER)))

Definition at line 59 of file BKE_gpencil.h.

◆ GPENCIL_SIMPLIFY_ONPLAY

#define GPENCIL_SIMPLIFY_ONPLAY (   playing)
Value:
(((playing == true) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ON_PLAY)) || \
@ SIMPLIFY_GPENCIL_ON_PLAY

Definition at line 53 of file BKE_gpencil.h.

◆ GPENCIL_SIMPLIFY_TINT

#define GPENCIL_SIMPLIFY_TINT (   scene)     ((GPENCIL_SIMPLIFY(scene)) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_TINT))

Definition at line 64 of file BKE_gpencil.h.

◆ GPENCIL_STRENGTH_MIN

#define GPENCIL_STRENGTH_MIN   0.003f

Definition at line 178 of file BKE_gpencil.h.

◆ GPENCIL_TINT_VERTEX_COLOR_FILL

#define GPENCIL_TINT_VERTEX_COLOR_FILL (   brush)
Value:
(((brush)->gpencil_settings->vertex_mode == GPPAINT_MODE_FILL) || \
((brush)->gpencil_settings->vertex_mode == GPPAINT_MODE_BOTH))
@ GPPAINT_MODE_FILL
@ GPPAINT_MODE_BOTH

Definition at line 83 of file BKE_gpencil.h.

◆ GPENCIL_TINT_VERTEX_COLOR_STROKE

#define GPENCIL_TINT_VERTEX_COLOR_STROKE (   brush)
Value:
(((brush)->gpencil_settings->vertex_mode == GPPAINT_MODE_STROKE) || \
((brush)->gpencil_settings->vertex_mode == GPPAINT_MODE_BOTH))
@ GPPAINT_MODE_STROKE

Definition at line 80 of file BKE_gpencil.h.

◆ GPENCIL_USE_VERTEX_COLOR

#define GPENCIL_USE_VERTEX_COLOR (   toolsettings)     (((toolsettings)->gp_paint->mode == GPPAINT_FLAG_USE_VERTEXCOLOR))

Definition at line 70 of file BKE_gpencil.h.

◆ GPENCIL_USE_VERTEX_COLOR_FILL

#define GPENCIL_USE_VERTEX_COLOR_FILL (   toolsettings,
  brush 
)
Value:
((GPENCIL_USE_VERTEX_COLOR(toolsettings) && \
(((brush)->gpencil_settings->vertex_mode == GPPAINT_MODE_FILL) || \
((brush)->gpencil_settings->vertex_mode == GPPAINT_MODE_BOTH))))
#define GPENCIL_USE_VERTEX_COLOR(toolsettings)
Definition: BKE_gpencil.h:70

Definition at line 76 of file BKE_gpencil.h.

◆ GPENCIL_USE_VERTEX_COLOR_STROKE

#define GPENCIL_USE_VERTEX_COLOR_STROKE (   toolsettings,
  brush 
)
Value:
((GPENCIL_USE_VERTEX_COLOR(toolsettings) && \
(((brush)->gpencil_settings->vertex_mode == GPPAINT_MODE_STROKE) || \
((brush)->gpencil_settings->vertex_mode == GPPAINT_MODE_BOTH))))

Definition at line 72 of file BKE_gpencil.h.

Typedef Documentation

◆ eGP_GetFrame_Mode

◆ gpIterCb

typedef void(* gpIterCb) (struct bGPDlayer *layer, struct bGPDframe *frame, struct bGPDstroke *stroke, void *thunk)

Definition at line 279 of file BKE_gpencil.h.

Enumeration Type Documentation

◆ eGP_GetFrame_Mode

Enumerator
GP_GETFRAME_USE_PREV 
GP_GETFRAME_ADD_NEW 
GP_GETFRAME_ADD_COPY 

Definition at line 185 of file BKE_gpencil.h.

Function Documentation

◆ BKE_gpencil_batch_cache_dirty_tag()

void BKE_gpencil_batch_cache_dirty_tag ( struct bGPdata *  gpd)

◆ BKE_gpencil_batch_cache_free()

void BKE_gpencil_batch_cache_free ( struct bGPdata *  gpd)

Definition at line 351 of file gpencil.c.

References BKE_gpencil_batch_cache_free_cb.

Referenced by BKE_gpencil_free().

◆ BKE_gpencil_blend_read_data()

void BKE_gpencil_blend_read_data ( struct BlendDataReader *  reader,
struct bGPdata *  gpd 
)

◆ BKE_gpencil_brush_material_get()

struct Material* BKE_gpencil_brush_material_get ( Brush *  brush)

Get grease pencil material from brush.

Parameters
brushBrush
Returns
Pointer to material

Definition at line 1787 of file gpencil.c.

References Brush::gpencil_settings, BrushGpencilSettings::material, and NULL.

Referenced by BKE_gpencil_object_material_ensure_from_brush(), and BKE_gpencil_object_material_from_brush_get().

◆ BKE_gpencil_brush_material_set()

void BKE_gpencil_brush_material_set ( Brush *  brush,
Material *  ma 
)

Set grease pencil brush material.

Parameters
brushBrush
maMaterial

Definition at line 1804 of file gpencil.c.

References BLI_assert, Brush::gpencil_settings, Material::id, id_us_min(), id_us_plus(), and BrushGpencilSettings::material.

Referenced by BKE_gpencil_brush_preset_set().

◆ BKE_gpencil_curve_sync_selection()

void BKE_gpencil_curve_sync_selection ( struct bGPdata *  gpd,
struct bGPDstroke *  gps 
)

◆ BKE_gpencil_data_addnew()

struct bGPdata* BKE_gpencil_data_addnew ( Main *  bmain,
const char  name[] 
)

◆ BKE_gpencil_data_duplicate()

struct bGPdata* BKE_gpencil_data_duplicate ( struct Main *  bmain,
const struct bGPdata *  gpd,
bool  internal_copy 
)

Referenced by gpencil_undo_push().

◆ BKE_gpencil_dvert_ensure()

void BKE_gpencil_dvert_ensure ( bGPDstroke *  gps)

◆ BKE_gpencil_eval_delete()

void BKE_gpencil_eval_delete ( bGPdata *  gpd_eval)

Delete grease pencil evaluated data

Parameters
gpd_evalGrease pencil data-block

Definition at line 512 of file gpencil.c.

References BKE_gpencil_free(), BKE_libblock_free_data(), BLI_assert, bGPdata::id, MEM_freeN, and ID::py_instance.

Referenced by BKE_gpencil_prepare_eval_data(), and BKE_object_free_derived_caches().

◆ BKE_gpencil_frame_active_set()

void BKE_gpencil_frame_active_set ( Depsgraph *  depsgraph,
bGPdata *  gpd 
)

Set current grease pencil active frame.

Parameters
depsgraphCurrent depsgraph
gpdGrease pencil data-block.

Definition at line 240 of file gpencil_modifier.c.

References BKE_gpencil_layer_frame_get(), DEG_debug_print_eval(), DEG_get_ctime(), DEG_get_original_id(), DEG_is_active(), depsgraph, GP_GETFRAME_USE_PREV, bGPdata::id, bGPdata::layers, LISTBASE_FOREACH, and ID::name.

Referenced by blender::deg::DepsgraphNodeBuilder::build_object_data_geometry_datablock(), and generateStrokes().

◆ BKE_gpencil_frame_addcopy()

struct bGPDframe* BKE_gpencil_frame_addcopy ( bGPDlayer *  gpl,
int  cframe 
)

◆ BKE_gpencil_frame_addnew()

struct bGPDframe* BKE_gpencil_frame_addnew ( bGPDlayer *  gpl,
int  cframe 
)

◆ BKE_gpencil_frame_copy_strokes()

void BKE_gpencil_frame_copy_strokes ( bGPDframe *  gpf_src,
struct bGPDframe *  gpf_dst 
)

Make a copy of strokes between gpencil frames.

Parameters
gpf_srcSource grease pencil frame
gpf_dstDestination grease pencil frame

Definition at line 1032 of file gpencil.c.

References BKE_gpencil_stroke_duplicate(), BLI_addtail(), BLI_listbase_clear(), LISTBASE_FOREACH, NULL, and bGPDframe::strokes.

Referenced by gpencil_copy_activeframe_to_eval().

◆ BKE_gpencil_frame_delete_laststroke()

void BKE_gpencil_frame_delete_laststroke ( bGPDlayer *  gpl,
bGPDframe *  gpf 
)

◆ BKE_gpencil_frame_duplicate()

struct bGPDframe* BKE_gpencil_frame_duplicate ( const struct bGPDframe *  gpf_src,
const bool  dup_strokes 
)

◆ BKE_gpencil_frame_original_pointers_update()

void BKE_gpencil_frame_original_pointers_update ( const struct bGPDframe *  gpf_orig,
const struct bGPDframe *  gpf_eval 
)

Update original pointers in evaluated frame.

Parameters
gpf_origOriginal grease-pencil frame.
gpf_evalEvaluated grease pencil frame.

Definition at line 2839 of file gpencil.c.

References ListBase::first, bGPDstroke_Runtime::gps_orig, bGPDspoint_Runtime::idx_orig, LISTBASE_FOREACH, bGPDstroke::next, NULL, bGPDstroke::points, bGPDspoint_Runtime::pt_orig, bGPDspoint::runtime, bGPDstroke::runtime, bGPDframe::strokes, and bGPDstroke::totpoints.

Referenced by BKE_gpencil_update_orig_pointers(), and gpencil_copy_activeframe_to_eval().

◆ BKE_gpencil_frame_range_selected()

void BKE_gpencil_frame_range_selected ( bGPDlayer *  gpl,
int *  r_initframe,
int *  r_endframe 
)

Get range of selected frames in layer. Always the active frame is considered as selected, so if no more selected the range will be equal to the current active frame.

Parameters
gplLayer.
r_initframeNumber of first selected frame.
r_endframeNumber of last selected frame.

Definition at line 2084 of file gpencil.c.

References bGPDlayer::actframe, bGPDframe::framenum, bGPDlayer::frames, GP_FRAME_SELECT, and LISTBASE_FOREACH.

Referenced by createTransGPencil_curves(), createTransGPencil_strokes(), gpencil_sculpt_brush_apply_standard(), gpencil_vertexpaint_brush_apply_to_layers(), and gpencil_weightpaint_brush_apply_to_layers().

◆ BKE_gpencil_frame_selected_hash()

void BKE_gpencil_frame_selected_hash ( struct bGPdata *  gpd,
struct GHash *  r_list 
)

◆ BKE_gpencil_free()

void BKE_gpencil_free ( bGPdata *  gpd,
bool  free_all 
)

Free (or release) any data used by this grease pencil (does not free the gpencil itself).

Definition at line 493 of file gpencil.c.

References BKE_gpencil_batch_cache_free(), BKE_gpencil_free_layers(), bGPdata::layers, bGPdata::mat, and MEM_SAFE_FREE.

Referenced by BKE_gpencil_eval_delete(), gpencil_undo_free_node(), and greasepencil_free_data().

◆ BKE_gpencil_free_frames()

void BKE_gpencil_free_frames ( struct bGPDlayer *  gpl)

◆ BKE_gpencil_free_layer_masks()

void BKE_gpencil_free_layer_masks ( struct bGPDlayer *  gpl)

◆ BKE_gpencil_free_layers()

void BKE_gpencil_free_layers ( struct ListBase *  list)

◆ BKE_gpencil_free_point_weights()

void BKE_gpencil_free_point_weights ( struct MDeformVert *  dvert)

◆ BKE_gpencil_free_stroke()

void BKE_gpencil_free_stroke ( struct bGPDstroke *  gps)

◆ BKE_gpencil_free_stroke_editcurve()

void BKE_gpencil_free_stroke_editcurve ( struct bGPDstroke *  gps)

◆ BKE_gpencil_free_stroke_weights()

void BKE_gpencil_free_stroke_weights ( struct bGPDstroke *  gps)

◆ BKE_gpencil_free_strokes()

bool BKE_gpencil_free_strokes ( struct bGPDframe *  gpf)

◆ BKE_gpencil_from_image()

bool BKE_gpencil_from_image ( SpaceImage *  sima,
bGPdata *  gpd,
bGPDframe *  gpf,
const float  size,
const bool  mask 
)

◆ BKE_gpencil_layer_active_get()

struct bGPDlayer* BKE_gpencil_layer_active_get ( bGPdata *  gpd)

Get the active grease pencil layer for editing.

Parameters
gpdGrease pencil data-block
Returns
Pointer to layer

Definition at line 1650 of file gpencil.c.

References ELEM, ListBase::first, GP_LAYER_ACTIVE, bGPdata::layers, LISTBASE_FOREACH, and NULL.

Referenced by annotation_actframe_delete_poll(), annotation_paint_initstroke(), BKE_gpencil_convert_curve(), BKE_gpencil_frame_selected_hash(), BKE_gpencil_layer_addnew(), BKE_gpencil_layer_autolock_set(), ED_gpencil_drawing_reference_get(), ED_gpencil_has_keyframe_v3d(), gpencil_actframe_delete_exec(), gpencil_actframe_delete_poll(), gpencil_active_layer_annotation_poll(), gpencil_active_layer_poll(), gpencil_blank_frame_add_exec(), GPENCIL_cache_init(), gpencil_convert_layer_exec(), gpencil_convert_poll(), gpencil_create_extensions(), gpencil_curve_edit_mode_poll(), gpencil_draw_datablock(), gpencil_fill_init(), gpencil_frame_duplicate_exec(), gpencil_hide_exec(), gpencil_interpolate_reverse_poll(), gpencil_isolate_layer_exec(), gpencil_layer_copy_exec(), gpencil_layer_duplicate_object_exec(), gpencil_layer_duplicate_object_poll(), gpencil_layer_mask_add_exec(), gpencil_layer_mask_remove_exec(), gpencil_layer_move_exec(), gpencil_layer_remove_exec(), gpencil_merge_by_distance_poll(), gpencil_merge_layer_exec(), gpencil_paint_initstroke(), gpencil_primitive_add_poll(), gpencil_primitive_invoke(), gpencil_session_init_fill(), gpencil_stroke_apply_thickness_exec(), gpencil_stroke_arrange_exec(), gpencil_stroke_join_exec(), gpencil_stroke_not_in_curve_edit_mode(), gpencil_stroke_separate_exec(), gpencil_strokes_paste_exec(), gpencil_transform_fill_poll(), gpencil_zoom_level_set(), mouse_action_keys(), OVERLAY_gpencil_cache_init(), screen_ctx_active_annotation_layer(), screen_ctx_active_gpencil_frame(), screen_ctx_active_gpencil_layer(), and trace_initialize_job_data().

◆ BKE_gpencil_layer_active_set()

void BKE_gpencil_layer_active_set ( bGPdata *  gpd,
bGPDlayer *  active 
)

◆ BKE_gpencil_layer_addnew()

struct bGPDlayer* BKE_gpencil_layer_addnew ( bGPdata *  gpd,
const char *  name,
bool  setactive 
)

◆ BKE_gpencil_layer_autolock_set()

void BKE_gpencil_layer_autolock_set ( bGPdata *  gpd,
const bool  unlock 
)

Set locked layers for autolock mode.

Parameters
gpdGrease pencil data-block
unlockUnlock flag

Definition at line 1725 of file gpencil.c.

References BKE_gpencil_layer_active_get(), BLI_assert, bGPdata::flag, GP_DATA_AUTOLOCK_LAYERS, GP_LAYER_LOCKED, bGPdata::layers, LISTBASE_FOREACH, and NULL.

Referenced by click_select_channel_gplayer(), and mouse_action_keys().

◆ BKE_gpencil_layer_delete()

void BKE_gpencil_layer_delete ( bGPdata *  gpd,
bGPDlayer *  gpl 
)

◆ BKE_gpencil_layer_duplicate()

struct bGPDlayer* BKE_gpencil_layer_duplicate ( const struct bGPDlayer *  gpl_src,
const bool  dup_frames,
const bool  dup_strokes 
)

◆ BKE_gpencil_layer_frame_delete()

bool BKE_gpencil_layer_frame_delete ( bGPDlayer *  gpl,
bGPDframe *  gpf 
)

◆ BKE_gpencil_layer_frame_find()

struct bGPDframe* BKE_gpencil_layer_frame_find ( bGPDlayer *  gpl,
int  cframe 
)

Look up the gp-frame on the requested frame number, but don't add a new one.

Parameters
gplGrease pencil layer
cframeFrame number
Returns
Pointer to frame

Definition at line 1281 of file gpencil.c.

References bGPDframe::framenum, bGPDlayer::frames, ListBase::last, NULL, and bGPDframe::prev.

Referenced by bake_strokes(), BKE_gpencil_stroke_copy_to_keyframes(), clear_strokes(), ED_gpencil_select_frame(), and gpencil_blank_frame_add_exec().

◆ BKE_gpencil_layer_frame_get()

struct bGPDframe* BKE_gpencil_layer_frame_get ( bGPDlayer *  gpl,
int  cframe,
eGP_GetFrame_Mode  addnew 
)

Get the appropriate gp-frame from a given layer

  • this sets the layer's actframe var (if allowed to)
  • extension beyond range (if first gp-frame is after all frame in interest and cannot add)
Parameters
gplGrease pencil layer
cframeFrame number
addnewAdd option
Returns
Pointer to new frame

Definition at line 1307 of file gpencil.c.

References abs(), bGPDlayer::actframe, BKE_gpencil_frame_addcopy(), BKE_gpencil_frame_addnew(), CLOG_STR_ERROR, ListBase::first, bGPDframe::flag, bGPDlayer::flag, bGPDframe::framenum, bGPDlayer::frames, GP_FRAME_PAINT, GP_GETFRAME_ADD_COPY, GP_LAYER_FRAMELOCK, ListBase::last, LOG, bGPDframe::next, NULL, and bGPDframe::prev.

Referenced by annotation_draw_data_layers(), annotation_paint_initstroke(), bake_strokes(), BKE_gpencil_convert_curve(), BKE_gpencil_convert_mesh(), BKE_gpencil_frame_active_set(), BKE_gpencil_frame_delete_laststroke(), BKE_gpencil_frame_retime_get(), ED_gpencil_anim_copybuf_paste(), gpencil_actframe_delete_all_exec(), gpencil_actframe_delete_exec(), gpencil_blank_frame_add_exec(), gpencil_brush_clone_add(), GPENCIL_cache_populate(), gpencil_convert_check_has_valid_timing(), gpencil_convert_poll(), gpencil_copy_activeframe_to_eval(), gpencil_create_extensions(), gpencil_delete_temp_stroke_extension(), gpencil_draw_datablock(), gpencil_fill_modal(), gpencil_interpolate_modal(), gpencil_interpolate_seq_exec(), gpencil_layer_add_exec(), gpencil_layer_to_curve(), gpencil_merge_layer_exec(), gpencil_move_to_layer_exec(), gpencil_paint_initstroke(), gpencil_prepare_stroke(), gpencil_primitive_interaction_end(), gpencil_select_same_layer(), gpencil_stroke_from_buffer(), gpencil_stroke_separate_exec(), gpencil_strokes_paste_exec(), gpencil_zoom_level_set(), insert_gpencil_keys(), blender::io::gpencil::GpencilImporterSVG::read(), trace_start_job(), view3d_ruler_from_gpencil(), and view3d_ruler_to_gpencil().

◆ BKE_gpencil_layer_frames_sort()

void BKE_gpencil_layer_frames_sort ( struct bGPDlayer *  gpl,
bool *  r_has_duplicate_frames 
)

Sort grease pencil frames.

Parameters
gplGrease pencil layer
r_has_duplicate_framesDuplicated frames flag

Definition at line 1640 of file gpencil.c.

References BLI_listbase_sort_r(), bGPDlayer::frames, and gpencil_cb_cmp_frame().

Referenced by ANIM_animdata_update(), and posttrans_gpd_clean().

◆ BKE_gpencil_layer_get_by_name()

struct bGPDlayer* BKE_gpencil_layer_get_by_name ( struct bGPdata *  gpd,
char *  name,
int  first_if_not_found 
)

◆ BKE_gpencil_layer_is_editable()

bool BKE_gpencil_layer_is_editable ( const struct bGPDlayer *  gpl)

◆ BKE_gpencil_layer_mask_add()

struct bGPDlayer_Mask* BKE_gpencil_layer_mask_add ( bGPDlayer *  gpl,
const char *  name 
)

Add grease pencil mask layer.

Parameters
gplGrease pencil layer
nameName of the mask
Returns
Pointer to new mask layer

Definition at line 1524 of file gpencil.c.

References bGPDlayer::act_mask, BLI_addtail(), BLI_strncpy(), mask(), bGPDlayer::mask_layers, and MEM_callocN.

Referenced by gpencil_layer_mask_add_exec().

◆ BKE_gpencil_layer_mask_named_get()

struct bGPDlayer_Mask* BKE_gpencil_layer_mask_named_get ( bGPDlayer *  gpl,
const char *  name 
)

Get mask layer by name.

Parameters
gplGrease pencil layer
nameMask name
Returns
Pointer to mask layer

Definition at line 1510 of file gpencil.c.

References BLI_findstring(), bGPDlayer::mask_layers, and NULL.

Referenced by gpencil_layer_mask_add_exec(), and gpencil_merge_layer_exec().

◆ BKE_gpencil_layer_mask_remove()

void BKE_gpencil_layer_mask_remove ( bGPDlayer *  gpl,
bGPDlayer_Mask *  mask 
)

Remove grease pencil mask layer.

Parameters
gplGrease pencil layer
maskGrease pencil mask layer

Definition at line 1540 of file gpencil.c.

References bGPDlayer::act_mask, BLI_freelinkN(), CLAMP_MIN, mask(), and bGPDlayer::mask_layers.

Referenced by BKE_gpencil_layer_mask_remove_ref(), and gpencil_layer_mask_remove_exec().

◆ BKE_gpencil_layer_mask_remove_ref()

void BKE_gpencil_layer_mask_remove_ref ( bGPdata *  gpd,
const char *  name 
)

Remove any reference to mask layer.

Parameters
gpdGrease pencil data-block
nameName of the mask layer

Definition at line 1552 of file gpencil.c.

References BKE_gpencil_layer_mask_remove(), bGPdata::layers, LISTBASE_FOREACH, mask(), and STREQ.

Referenced by BKE_gpencil_layer_delete().

◆ BKE_gpencil_layer_mask_sort()

void BKE_gpencil_layer_mask_sort ( bGPdata *  gpd,
bGPDlayer *  gpl 
)

◆ BKE_gpencil_layer_mask_sort_all()

void BKE_gpencil_layer_mask_sort_all ( bGPdata *  gpd)

Sort all grease pencil mask layer.

Parameters
gpdGrease pencil data-block

Definition at line 1607 of file gpencil.c.

References BKE_gpencil_layer_mask_sort(), bGPdata::layers, and LISTBASE_FOREACH.

Referenced by gpencil_layer_move_exec(), and gpencil_layer_remove_exec().

◆ BKE_gpencil_layer_named_get()

struct bGPDlayer* BKE_gpencil_layer_named_get ( bGPdata *  gpd,
const char *  name 
)

Get layer by name

Parameters
gpdGrease pencil data-block
nameLayer name
Returns
Pointer to layer

Definition at line 1496 of file gpencil.c.

References BLI_findstring(), bGPdata::layers, and NULL.

Referenced by BKE_gpencil_convert_curve(), BKE_gpencil_convert_mesh(), BKE_gpencil_layer_mask_sort(), gpencil_brush_clone_add(), gpencil_layer_cache_add(), gpencil_layer_mask_add_exec(), and gpencil_merge_layer_exec().

◆ BKE_gpencil_layer_transform_matrix_get()

void BKE_gpencil_layer_transform_matrix_get ( const struct Depsgraph *  depsgraph,
struct Object *  obact,
struct bGPDlayer *  gpl,
float  diff_mat[4][4] 
)

◆ BKE_gpencil_material_find_index_by_name_prefix()

int BKE_gpencil_material_find_index_by_name_prefix ( Object *  ob,
const char *  name_prefix 
)

Find material by name prefix.

Parameters
obObject pointer
name_prefixPrefix name of the material
Returns
Index

Definition at line 3031 of file gpencil.c.

References BKE_object_material_get(), Material::gp_style, Material::id, ID::name, NULL, STREQLEN, and Object::totcol.

Referenced by BKE_gpencil_convert_mesh(), blender::io::gpencil::GpencilImporter::create_material(), and ED_gpencil_trace_data_to_strokes().

◆ BKE_gpencil_material_index_reassign()

void BKE_gpencil_material_index_reassign ( bGPdata *  gpd,
int  totcol,
int  index 
)

Reassign strokes using a material.

Parameters
gpdGrease pencil data-block
totcolTotal materials
indexIndex of the material

Definition at line 2146 of file gpencil.c.

References CLAMP_MIN, bGPdata::layers, and LISTBASE_FOREACH.

Referenced by BKE_object_material_slot_remove().

◆ BKE_gpencil_material_index_used()

bool BKE_gpencil_material_index_used ( bGPdata *  gpd,
int  index 
)

Remove strokes using a material.

Parameters
gpdGrease pencil data-block
indexIndex of the material
Returns
True if removed

Definition at line 2167 of file gpencil.c.

References bGPdata::layers, and LISTBASE_FOREACH.

Referenced by BKE_object_material_slot_used().

◆ BKE_gpencil_material_remap()

void BKE_gpencil_material_remap ( struct bGPdata *  gpd,
const unsigned int *  remap,
unsigned int  remap_len 
)

Remap material

Parameters
gpdGrease pencil data-block
remapRemap index
remap_lenRemap length

Definition at line 2188 of file gpencil.c.

References bGPdata::layers, LISTBASE_FOREACH, and MAT_NR_REMAP.

Referenced by BKE_object_material_remap().

◆ BKE_gpencil_merge_materials()

bool BKE_gpencil_merge_materials ( Object *  ob,
const float  hue_threshold,
const float  sat_threshold,
const float  val_threshold,
int *  r_removed 
)

Merge similar materials

Parameters
obGrease pencil object
hue_thresholdThreshold for Hue
sat_thresholdThreshold for Saturation
val_thresholdThreshold for Value
r_removedNumber of materials removed
Returns
True if done

Definition at line 2350 of file gpencil.c.

References BKE_gpencil_material_settings(), BKE_gpencil_merge_materials_table_get(), BKE_object_material_len_p(), BLI_ghash_free(), BLI_ghash_haskey(), BLI_ghash_int_new(), BLI_ghash_len(), BLI_ghash_lookup(), Object::data, MaterialGPencilStyle::flag, GP_LAYER_HIDE, GP_LAYER_UNLOCK_COLOR, GP_MATERIAL_HIDE, GP_MATERIAL_LOCKED, bGPdata::layers, LISTBASE_FOREACH, NULL, POINTER_AS_INT, and POINTER_FROM_INT.

Referenced by BKE_gpencil_convert_curve(), and gpencil_stroke_merge_material_exec().

◆ BKE_gpencil_merge_materials_table_get()

bool BKE_gpencil_merge_materials_table_get ( Object *  ob,
const float  hue_threshold,
const float  sat_threshold,
const float  val_threshold,
GHash *  r_mat_table 
)

Load a table with material conversion index for merged materials.

Parameters
obGrease pencil object.
hue_thresholdThreshold for Hue.
sat_thresholdThreshold for Saturation.
val_thresholdThreshold for Value.
r_mat_tablereturn material table.
Returns
True if done.

Definition at line 2222 of file gpencil.c.

References BKE_gpencil_material(), BKE_object_material_len_p(), BLI_ghash_free(), BLI_ghash_haskey(), BLI_ghash_insert(), BLI_ghash_int_new(), col, compare_ff(), copy_v3_v3(), MaterialGPencilStyle::fill_rgba, MaterialGPencilStyle::fill_style, MaterialGPencilStyle::flag, GP_MATERIAL_FILL_SHOW, GP_MATERIAL_LOCKED, GP_MATERIAL_STROKE_SHOW, Material::gp_style, MaterialGPencilStyle::mode, NULL, POINTER_FROM_INT, rgb_to_hsv_compat_v(), MaterialGPencilStyle::stroke_rgba, MaterialGPencilStyle::stroke_style, and zero_v3().

Referenced by BKE_gpencil_merge_materials().

◆ BKE_gpencil_multiframe_falloff_calc()

float BKE_gpencil_multiframe_falloff_calc ( bGPDframe *  gpf,
int  actnum,
int  f_init,
int  f_end,
CurveMapping *  cur_falloff 
)

Get Falloff factor base on frame range

Parameters
gpfFrame.
actnumNumber of active frame in layer.
f_initNumber of first selected frame.
f_endNumber of last selected frame.
cur_falloffCurve with falloff factors.

Definition at line 2109 of file gpencil.c.

References BKE_curvemapping_evaluateF(), float(), bGPDframe::framenum, and NULL.

Referenced by createTransGPencil_curves(), createTransGPencil_strokes(), gpencil_sculpt_brush_apply_standard(), gpencil_vertexpaint_brush_apply_to_layers(), and gpencil_weightpaint_brush_apply_to_layers().

◆ BKE_gpencil_object_material_ensure()

int BKE_gpencil_object_material_ensure ( Main *  bmain,
Object *  ob,
Material *  material 
)

Assigns the material to object (if not already present) and returns its index (mat_nr).

Parameters
bmainMain pointer
obGrease pencil object
materialMaterial
Returns
Index of the material

Definition at line 1851 of file gpencil.c.

References BKE_gpencil_object_material_index_get(), BKE_MAT_ASSIGN_USERPREF, BKE_object_material_assign(), BKE_object_material_slot_add(), material, and Object::totcol.

Referenced by ED_gpencil_join_objects_exec(), gpencil_copybuf_validate_colormap(), gpencil_layer_duplicate_object_exec(), and gpencil_stroke_separate_exec().

◆ BKE_gpencil_object_material_ensure_active()

struct Material* BKE_gpencil_object_material_ensure_active ( Object *  ob)

Get active color, and add all default settings if we don't find anything.

Parameters
obGrease pencil object
Returns
Material pointer

Definition at line 1982 of file gpencil.c.

References BKE_gpencil_material_attr_init(), BKE_gpencil_object_material_ensure_from_active_input_material(), Material::gp_style, and NULL.

◆ BKE_gpencil_object_material_ensure_by_name()

struct Material* BKE_gpencil_object_material_ensure_by_name ( struct Main *  bmain,
struct Object *  ob,
const char *  name,
int *  r_index 
)

◆ BKE_gpencil_object_material_ensure_from_active_input_brush()

struct Material* BKE_gpencil_object_material_ensure_from_active_input_brush ( Main *  bmain,
Object *  ob,
Brush *  brush 
)

Guaranteed to return a material assigned to object. Returns never NULL.

Parameters
bmainMain pointer
obGrease pencil object.
brushBrush
Returns
Material pointer

Definition at line 1944 of file gpencil.c.

References BKE_gpencil_object_material_ensure_from_active_input_material(), BKE_gpencil_object_material_ensure_from_brush(), BrushGpencilSettings::flag, GP_BRUSH_MATERIAL_PINNED, and Brush::gpencil_settings.

Referenced by BKE_gpencil_object_material_ensure_from_active_input_toolsettings(), gpencil_init_colors(), and gpencil_session_init_fill().

◆ BKE_gpencil_object_material_ensure_from_active_input_material()

struct Material* BKE_gpencil_object_material_ensure_from_active_input_material ( Object *  ob)

Guaranteed to return a material assigned to object. Returns never NULL. Only use this for materials unrelated to user input.

Parameters
obGrease pencil object
Returns
Material pointer

Definition at line 1967 of file gpencil.c.

References Object::actcol, BKE_material_default_gpencil(), and BKE_object_material_get().

Referenced by BKE_gpencil_object_material_ensure_active(), and BKE_gpencil_object_material_ensure_from_active_input_brush().

◆ BKE_gpencil_object_material_ensure_from_active_input_toolsettings()

struct Material* BKE_gpencil_object_material_ensure_from_active_input_toolsettings ( Main *  bmain,
Object *  ob,
ToolSettings *  ts 
)

Guaranteed to return a material assigned to object. Returns never NULL.

Parameters
bmainMain pointer
obGrease pencil object
Returns
Material pointer.

Definition at line 1925 of file gpencil.c.

References BKE_gpencil_object_material_ensure_from_active_input_brush(), Paint::brush, ToolSettings::gp_paint, NULL, and GpPaint::paint.

Referenced by ED_gpencil_add_defaults(), and gpencil_primitive_init().

◆ BKE_gpencil_object_material_ensure_from_brush()

struct Material* BKE_gpencil_object_material_ensure_from_brush ( Main *  bmain,
Object *  ob,
Brush *  brush 
)

◆ BKE_gpencil_object_material_from_brush_get()

struct Material* BKE_gpencil_object_material_from_brush_get ( Object *  ob,
Brush *  brush 
)

Returns the material for a brush with respect to its pinned state.

Parameters
obGrease pencil object
brushBrush
Returns
Material pointer

Definition at line 1893 of file gpencil.c.

References Object::actcol, BKE_gpencil_brush_material_get(), BKE_object_material_get(), BrushGpencilSettings::flag, GP_BRUSH_MATERIAL_PINNED, and Brush::gpencil_settings.

Referenced by gpencil_brush_cursor_draw().

◆ BKE_gpencil_object_material_get_index_from_brush()

int BKE_gpencil_object_material_get_index_from_brush ( Object *  ob,
Brush *  brush 
)

Returns the material index for a brush with respect to its pinned state.

Parameters
obGrease pencil object
brushBrush
Returns
Material index.

Definition at line 1910 of file gpencil.c.

References Object::actcol, BKE_gpencil_object_material_index_get(), BrushGpencilSettings::flag, GP_BRUSH_MATERIAL_PINNED, Brush::gpencil_settings, and BrushGpencilSettings::material.

Referenced by gpencil_primitive_set_initdata(), gpencil_stroke_from_buffer(), and gpencil_stroke_newfrombuffer().

◆ BKE_gpencil_object_material_index_get()

int BKE_gpencil_object_material_index_get ( Object *  ob,
Material *  ma 
)

◆ BKE_gpencil_object_material_index_get_by_name()

int BKE_gpencil_object_material_index_get_by_name ( struct Object *  ob,
const char *  name 
)

◆ BKE_gpencil_object_material_new()

struct Material* BKE_gpencil_object_material_new ( Main *  bmain,
Object *  ob,
const char *  name,
int *  r_index 
)

Creates a new grease-pencil material and assigns it to object.

Parameters
bmainMain pointer
obGrease pencil object
nameMaterial name
r_indexvalue is set to zero based index of the new material if r_index is not NULL.
Returns
Material pointer.

Definition at line 1873 of file gpencil.c.

References Object::actcol, BKE_gpencil_material_add(), BKE_MAT_ASSIGN_USERPREF, BKE_object_material_assign(), BKE_object_material_slot_add(), Material::id, id_us_min(), bGPDlayer_Mask::name, and Object::totcol.

Referenced by BKE_gpencil_object_material_ensure_by_name(), blender::io::gpencil::GpencilImporter::create_material(), ED_gpencil_trace_data_to_strokes(), eyedropper_add_material(), gpencil_add_from_curve_material(), gpencil_add_material(), gpencil_convert_old_files_exec(), and image_to_gpencil_exec().

◆ BKE_gpencil_palette_ensure()

void BKE_gpencil_palette_ensure ( Main *  bmain,
Scene *  scene 
)

◆ BKE_gpencil_stats_update()

void BKE_gpencil_stats_update ( bGPdata *  gpd)

Calc grease pencil statistics functions.

Parameters
gpdGrease pencil data-block

Definition at line 2412 of file gpencil.c.

References bGPdata::layers, LISTBASE_FOREACH, bGPdata::totframe, bGPdata::totlayer, bGPdata::totpoint, and bGPdata::totstroke.

Referenced by stats_object().

◆ BKE_gpencil_stroke_add()

struct bGPDstroke* BKE_gpencil_stroke_add ( bGPDframe *  gpf,
int  mat_idx,
int  totpoints,
short  thickness,
const bool  insert_at_head 
)

Create a new stroke and add to frame.

Parameters
gpfGrease pencil frame
mat_idxMaterial index
totpointsTotal points
thicknessStroke thickness
insert_at_headAdd to the head of the strokes list
Returns
Pointer to new stroke

Definition at line 871 of file gpencil.c.

References BKE_gpencil_stroke_new(), BLI_addhead(), BLI_addtail(), NULL, and bGPDframe::strokes.

Referenced by BKE_gpencil_convert_mesh(), BKE_gpencil_from_image(), BKE_gpencil_stroke_add_existing_style(), ED_gpencil_create_monkey(), ED_gpencil_create_stroke(), ED_gpencil_trace_data_to_strokes(), gpencil_generate_edgeloops(), and lineart_gpencil_generate().

◆ BKE_gpencil_stroke_add_existing_style()

struct bGPDstroke* BKE_gpencil_stroke_add_existing_style ( bGPDframe *  gpf,
bGPDstroke *  existing,
int  mat_idx,
int  totpoints,
short  thickness 
)

Add a stroke and copy the temporary drawing color value from one of the existing stroke.

Parameters
gpfGrease pencil frame
existingStroke with the style to copy
mat_idxMaterial index
totpointsTotal points
thicknessStroke thickness
Returns
Pointer to new stroke

Definition at line 899 of file gpencil.c.

References BKE_gpencil_stroke_add(), and bGPDstroke::runtime.

Referenced by BKE_gpencil_stroke_split().

◆ BKE_gpencil_stroke_add_points()

void BKE_gpencil_stroke_add_points ( bGPDstroke *  gps,
const float *  array,
const int  totpoints,
const float  mat[4][4] 
)

Populate stroke with point data from data buffers.

Parameters
gpsGrease pencil stroke
arrayFlat array of point data values. Each entry has GP_PRIM_DATABUF_SIZE values.
totpointsTotal of points
mat4x4 transform matrix to transform points into the right coordinate space.

Definition at line 800 of file gpencil.c.

References GP_PRIM_DATABUF_SIZE, mul_m4_v3(), bGPDstroke::points, bGPDspoint::pressure, bGPDspoint::strength, x, bGPDspoint::x, bGPDspoint::y, and bGPDspoint::z.

Referenced by ED_gpencil_create_monkey(), ED_gpencil_create_stroke(), and lineart_gpencil_generate().

◆ BKE_gpencil_stroke_curve_duplicate()

struct bGPDcurve* BKE_gpencil_stroke_curve_duplicate ( struct bGPDcurve *  gpc_src)

Definition at line 939 of file gpencil.c.

References bGPDcurve::curve_points, MEM_dupallocN, and NULL.

Referenced by BKE_gpencil_stroke_duplicate().

◆ BKE_gpencil_stroke_duplicate()

struct bGPDstroke* BKE_gpencil_stroke_duplicate ( bGPDstroke *  gps_src,
const bool  dup_points,
const bool  dup_curve 
)

◆ BKE_gpencil_stroke_editcurve_new()

struct bGPDcurve* BKE_gpencil_stroke_editcurve_new ( const int  tot_curve_points)

◆ BKE_gpencil_stroke_new()

struct bGPDstroke* BKE_gpencil_stroke_new ( int  mat_idx,
int  totpoints,
short  thickness 
)

◆ BKE_gpencil_stroke_select_check()

bool BKE_gpencil_stroke_select_check ( const struct bGPDstroke *  gps)

◆ BKE_gpencil_stroke_select_index_reset()

void BKE_gpencil_stroke_select_index_reset ( struct bGPDstroke *  gps)

◆ BKE_gpencil_stroke_select_index_set()

void BKE_gpencil_stroke_select_index_set ( struct bGPdata *  gpd,
struct bGPDstroke *  gps 
)

◆ BKE_gpencil_stroke_sync_selection()

void BKE_gpencil_stroke_sync_selection ( bGPdata *  gpd,
bGPDstroke *  gps 
)

Ensure selection status of stroke is in sync with its points.

Parameters
gpsGrease pencil stroke

Definition at line 1139 of file gpencil.c.

References BKE_gpencil_stroke_select_index_reset(), BKE_gpencil_stroke_select_index_set(), bGPDspoint::flag, bGPDstroke::flag, GP_SPOINT_SELECT, GP_STROKE_SELECT, NULL, and bGPDstroke::points.

Referenced by gpencil_generic_stroke_select(), gpencil_select_exec(), and gpencil_stroke_do_circle_sel().

◆ BKE_gpencil_stroke_weights_duplicate()

void BKE_gpencil_stroke_weights_duplicate ( bGPDstroke *  gps_src,
bGPDstroke *  gps_dst 
)

Make a copy of a given gpencil weights.

Parameters
gps_srcSource grease pencil stroke
gps_dstDestination grease pencil stroke

Definition at line 928 of file gpencil.c.

References BKE_defvert_array_copy(), BLI_assert, bGPDstroke::dvert, NULL, and bGPDstroke::totpoints.

Referenced by BKE_gpencil_stroke_duplicate(), and gpencil_strokes_copy_exec().

◆ BKE_gpencil_tag()

void BKE_gpencil_tag ( bGPdata *  gpd)

Tag data-block for depsgraph update. Wrapper to avoid include Depsgraph tag functions in other modules.

Parameters
gpdGrease pencil data-block.

Definition at line 525 of file gpencil.c.

References DEG_id_tag_update(), bGPdata::id, ID_RECALC_GEOMETRY, and ID_RECALC_TRANSFORM.

Referenced by insert_gpencil_keys().

◆ BKE_gpencil_update_layer_transforms()

void BKE_gpencil_update_layer_transforms ( const struct Depsgraph *  depsgraph,
struct Object *  ob 
)

◆ BKE_gpencil_update_orig_pointers()

void BKE_gpencil_update_orig_pointers ( const struct Object *  ob_orig,
const struct Object *  ob_eval 
)

◆ BKE_gpencil_vgroup_remove()

void BKE_gpencil_vgroup_remove ( Object *  ob,
bDeformGroup *  defgroup 
)

◆ BKE_gpencil_visible_stroke_iter()

void BKE_gpencil_visible_stroke_iter ( struct ViewLayer *  view_layer,
struct Object *  ob,
gpIterCb  layer_cb,
gpIterCb  stroke_cb,
void *  thunk,
bool  do_onion,
int  cfra 
)

Variable Documentation

◆ BKE_gpencil_batch_cache_dirty_tag_cb

void(* BKE_gpencil_batch_cache_dirty_tag_cb) (struct bGPdata *gpd) ( struct bGPdata *  gpd)
extern

Definition at line 340 of file gpencil.c.

Referenced by BKE_gpencil_batch_cache_dirty_tag(), and DRW_engines_register().

◆ BKE_gpencil_batch_cache_free_cb

void(* BKE_gpencil_batch_cache_free_cb) (struct bGPdata *gpd) ( struct bGPdata *  gpd)
extern

Definition at line 341 of file gpencil.c.

Referenced by BKE_gpencil_batch_cache_free(), and DRW_engines_register().