Blender  V3.3
Classes | Macros | Typedefs | Enumerations | Functions | Variables
gpencil_intern.h File Reference
#include "DNA_vec_types.h"
#include "ED_numinput.h"

Go to the source code of this file.

Classes

struct  GpRandomSettings
 
struct  tGPDdraw
 
struct  GP_SpaceConversion
 
struct  tGPDprimitive
 
struct  GP_EditableStrokes_Iter
 

Macros

#define DEPTH_INVALID   1.0f
 
#define GP_STROKE_BUFFER_CHUNK   2048
 
#define GP_EDITABLE_STROKES_BEGIN(gpstroke_iter, C, gpl, gps)
 
#define GP_EDITABLE_STROKES_END(gpstroke_iter)
 
#define GP_EDITABLE_CURVES_BEGIN(gpstroke_iter, C, gpl, gps, gpc)
 
#define GP_EDITABLE_CURVES_END(gpstroke_iter)
 
#define GP_EVALUATED_STROKES_BEGIN(gpstroke_iter, C, gpl, gps)
 
#define GP_EVALUATED_STROKES_END(gpstroke_iter)
 

Typedefs

typedef struct GpRandomSettings GpRandomSettings
 
typedef struct tGPDdraw tGPDdraw
 
typedef struct GP_SpaceConversion GP_SpaceConversion
 
typedef struct tGPDprimitive tGPDprimitive
 
typedef enum eGPencil_PaintModes eGPencil_PaintModes
 

Enumerations

enum  eGPencil_PaintModes {
  GP_PAINTMODE_DRAW = 0 , GP_PAINTMODE_ERASER , GP_PAINTMODE_DRAW_STRAIGHT , GP_PAINTMODE_DRAW_POLY ,
  GP_PAINTMODE_SET_CP
}
 
enum  { GP_STROKE_JOIN = -1 , GP_STROKE_JOINCOPY = 1 }
 
enum  {
  GP_STROKE_BOX = -1 , GP_STROKE_LINE = 1 , GP_STROKE_CIRCLE = 2 , GP_STROKE_ARC = 3 ,
  GP_STROKE_CURVE = 4 , GP_STROKE_POLYLINE = 5
}
 
enum  { GP_MERGE_STROKE = -1 , GP_MERGE_POINT = 1 }
 

Functions

void ED_gpencil_draw_fill (struct tGPDdraw *tgpw)
 
bool gpencil_stroke_inside_circle (const float mval[2], int rad, int x0, int y0, int x1, int y1)
 
void gpencil_point_conversion_init (struct bContext *C, GP_SpaceConversion *r_gsc)
 
void gpencil_point_to_xy (const GP_SpaceConversion *gsc, const struct bGPDstroke *gps, const struct bGPDspoint *pt, int *r_x, int *r_y)
 
void gpencil_point_to_xy_fl (const GP_SpaceConversion *gsc, const bGPDstroke *gps, const bGPDspoint *pt, float *r_x, float *r_y)
 
void gpencil_point_to_parent_space (const bGPDspoint *pt, const float diff_mat[4][4], bGPDspoint *r_pt)
 
void gpencil_apply_parent (struct Depsgraph *depsgraph, struct Object *obact, bGPDlayer *gpl, bGPDstroke *gps)
 
void gpencil_apply_parent_point (struct Depsgraph *depsgraph, struct Object *obact, bGPDlayer *gpl, bGPDspoint *pt)
 
void gpencil_point_3d_to_xy (const GP_SpaceConversion *gsc, short flag, const float pt[3], float xy[2])
 
bool gpencil_point_xy_to_3d (const GP_SpaceConversion *gsc, struct Scene *scene, const float screen_co[2], float r_out[3])
 
void gpencil_stroke_convertcoords_tpoint (struct Scene *scene, struct ARegion *region, struct Object *ob, const struct tGPspoint *point2D, float *depth, float r_out[3])
 
bool gpencil_add_poll (struct bContext *C)
 
bool gpencil_active_layer_poll (struct bContext *C)
 
bool gpencil_active_brush_poll (struct bContext *C)
 
bool gpencil_brush_create_presets_poll (bContext *C)
 
struct GHashgpencil_copybuf_validate_colormap (struct bContext *C)
 
int gpencil_delete_selected_point_wrap (bContext *C)
 
void gpencil_subdivide_stroke (bGPdata *gpd, bGPDstroke *gps, int subdivide)
 
const struct EnumPropertyItemED_gpencil_layers_enum_itemf (struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free)
 
const struct EnumPropertyItemED_gpencil_layers_with_new_enum_itemf (struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free)
 
const struct EnumPropertyItemED_gpencil_material_enum_itemf (struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free)
 
void GPENCIL_OT_annotate (struct wmOperatorType *ot)
 
void GPENCIL_OT_draw (struct wmOperatorType *ot)
 
void GPENCIL_OT_fill (struct wmOperatorType *ot)
 
void GPENCIL_OT_vertex_paint (struct wmOperatorType *ot)
 
void GPENCIL_OT_vertex_color_brightness_contrast (struct wmOperatorType *ot)
 
void GPENCIL_OT_vertex_color_hsv (struct wmOperatorType *ot)
 
void GPENCIL_OT_vertex_color_invert (struct wmOperatorType *ot)
 
void GPENCIL_OT_vertex_color_levels (struct wmOperatorType *ot)
 
void GPENCIL_OT_vertex_color_set (struct wmOperatorType *ot)
 
void GPENCIL_OT_guide_rotate (struct wmOperatorType *ot)
 
void GPENCIL_OT_editmode_toggle (struct wmOperatorType *ot)
 
void GPENCIL_OT_selectmode_toggle (struct wmOperatorType *ot)
 
void GPENCIL_OT_paintmode_toggle (struct wmOperatorType *ot)
 
void GPENCIL_OT_sculptmode_toggle (struct wmOperatorType *ot)
 
void GPENCIL_OT_weightmode_toggle (struct wmOperatorType *ot)
 
void GPENCIL_OT_vertexmode_toggle (struct wmOperatorType *ot)
 
void GPENCIL_OT_selection_opacity_toggle (struct wmOperatorType *ot)
 
void GPENCIL_OT_select (struct wmOperatorType *ot)
 
void GPENCIL_OT_select_all (struct wmOperatorType *ot)
 
void GPENCIL_OT_select_circle (struct wmOperatorType *ot)
 
void GPENCIL_OT_select_box (struct wmOperatorType *ot)
 
void GPENCIL_OT_select_lasso (struct wmOperatorType *ot)
 
void GPENCIL_OT_select_linked (struct wmOperatorType *ot)
 
void GPENCIL_OT_select_grouped (struct wmOperatorType *ot)
 
void GPENCIL_OT_select_more (struct wmOperatorType *ot)
 
void GPENCIL_OT_select_less (struct wmOperatorType *ot)
 
void GPENCIL_OT_select_first (struct wmOperatorType *ot)
 
void GPENCIL_OT_select_last (struct wmOperatorType *ot)
 
void GPENCIL_OT_select_alternate (struct wmOperatorType *ot)
 
void GPENCIL_OT_select_random (struct wmOperatorType *ot)
 
void GPENCIL_OT_select_vertex_color (struct wmOperatorType *ot)
 
void GPENCIL_OT_duplicate (struct wmOperatorType *ot)
 
void GPENCIL_OT_delete (struct wmOperatorType *ot)
 
void GPENCIL_OT_dissolve (struct wmOperatorType *ot)
 
void GPENCIL_OT_copy (struct wmOperatorType *ot)
 
void GPENCIL_OT_paste (struct wmOperatorType *ot)
 
void GPENCIL_OT_extrude (struct wmOperatorType *ot)
 
void GPENCIL_OT_move_to_layer (struct wmOperatorType *ot)
 
void GPENCIL_OT_layer_change (struct wmOperatorType *ot)
 
void GPENCIL_OT_layer_active (struct wmOperatorType *ot)
 
void GPENCIL_OT_snap_to_grid (struct wmOperatorType *ot)
 
void GPENCIL_OT_snap_to_cursor (struct wmOperatorType *ot)
 
void GPENCIL_OT_snap_cursor_to_selected (struct wmOperatorType *ot)
 
void GPENCIL_OT_reproject (struct wmOperatorType *ot)
 
void GPENCIL_OT_recalc_geometry (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_enter_editcurve_mode (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_editcurve_set_handle_type (struct wmOperatorType *ot)
 
void GPENCIL_OT_sculpt_paint (struct wmOperatorType *ot)
 
void GPENCIL_OT_weight_paint (struct wmOperatorType *ot)
 
void GPENCIL_OT_annotation_add (struct wmOperatorType *ot)
 
void GPENCIL_OT_data_unlink (struct wmOperatorType *ot)
 
void GPENCIL_OT_layer_add (struct wmOperatorType *ot)
 
void GPENCIL_OT_layer_remove (struct wmOperatorType *ot)
 
void GPENCIL_OT_layer_move (struct wmOperatorType *ot)
 
void GPENCIL_OT_layer_annotation_add (struct wmOperatorType *ot)
 
void GPENCIL_OT_layer_annotation_remove (struct wmOperatorType *ot)
 
void GPENCIL_OT_layer_annotation_move (struct wmOperatorType *ot)
 
void GPENCIL_OT_layer_duplicate (struct wmOperatorType *ot)
 
void GPENCIL_OT_layer_duplicate_object (struct wmOperatorType *ot)
 
void GPENCIL_OT_layer_mask_add (struct wmOperatorType *ot)
 
void GPENCIL_OT_layer_mask_remove (struct wmOperatorType *ot)
 
void GPENCIL_OT_layer_mask_move (struct wmOperatorType *ot)
 
void GPENCIL_OT_hide (struct wmOperatorType *ot)
 
void GPENCIL_OT_reveal (struct wmOperatorType *ot)
 
void GPENCIL_OT_lock_all (struct wmOperatorType *ot)
 
void GPENCIL_OT_unlock_all (struct wmOperatorType *ot)
 
void GPENCIL_OT_layer_isolate (struct wmOperatorType *ot)
 
void GPENCIL_OT_layer_merge (struct wmOperatorType *ot)
 
void GPENCIL_OT_blank_frame_add (struct wmOperatorType *ot)
 
void GPENCIL_OT_active_frame_delete (struct wmOperatorType *ot)
 
void GPENCIL_OT_annotation_active_frame_delete (struct wmOperatorType *ot)
 
void GPENCIL_OT_active_frames_delete_all (struct wmOperatorType *ot)
 
void GPENCIL_OT_frame_duplicate (struct wmOperatorType *ot)
 
void GPENCIL_OT_frame_clean_fill (struct wmOperatorType *ot)
 
void GPENCIL_OT_frame_clean_loose (struct wmOperatorType *ot)
 
void GPENCIL_OT_frame_clean_duplicate (struct wmOperatorType *ot)
 
void GPENCIL_OT_convert (struct wmOperatorType *ot)
 
void GPENCIL_OT_bake_mesh_animation (struct wmOperatorType *ot)
 
void GPENCIL_OT_bake_grease_pencil_animation (struct wmOperatorType *ot)
 
void GPENCIL_OT_image_to_grease_pencil (struct wmOperatorType *ot)
 
void GPENCIL_OT_trace_image (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_arrange (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_change_color (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_apply_thickness (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_cyclical_set (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_caps_set (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_join (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_flip (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_subdivide (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_simplify (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_simplify_fixed (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_separate (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_split (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_smooth (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_sample (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_merge (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_cutter (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_trim (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_merge_by_distance (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_merge_material (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_reset_vertex_color (struct wmOperatorType *ot)
 
void GPENCIL_OT_stroke_normalize (struct wmOperatorType *ot)
 
void GPENCIL_OT_material_to_vertex_color (struct wmOperatorType *ot)
 
void GPENCIL_OT_extract_palette_vertex (struct wmOperatorType *ot)
 
void GPENCIL_OT_transform_fill (struct wmOperatorType *ot)
 
void GPENCIL_OT_reset_transform_fill (struct wmOperatorType *ot)
 
void GPENCIL_OT_brush_reset (struct wmOperatorType *ot)
 
void GPENCIL_OT_brush_reset_all (struct wmOperatorType *ot)
 
void gpencil_undo_init (struct bGPdata *gpd)
 
void gpencil_undo_push (struct bGPdata *gpd)
 
void gpencil_undo_finish (void)
 
void GPENCIL_OT_interpolate (struct wmOperatorType *ot)
 
void GPENCIL_OT_interpolate_sequence (struct wmOperatorType *ot)
 
void GPENCIL_OT_interpolate_reverse (struct wmOperatorType *ot)
 
void GPENCIL_OT_primitive_box (struct wmOperatorType *ot)
 
void GPENCIL_OT_primitive_line (struct wmOperatorType *ot)
 
void GPENCIL_OT_primitive_polyline (struct wmOperatorType *ot)
 
void GPENCIL_OT_primitive_circle (struct wmOperatorType *ot)
 
void GPENCIL_OT_primitive_curve (struct wmOperatorType *ot)
 
void GPENCIL_OT_vertex_group_assign (struct wmOperatorType *ot)
 
void GPENCIL_OT_vertex_group_remove_from (struct wmOperatorType *ot)
 
void GPENCIL_OT_vertex_group_select (struct wmOperatorType *ot)
 
void GPENCIL_OT_vertex_group_deselect (struct wmOperatorType *ot)
 
void GPENCIL_OT_vertex_group_invert (struct wmOperatorType *ot)
 
void GPENCIL_OT_vertex_group_smooth (struct wmOperatorType *ot)
 
void GPENCIL_OT_vertex_group_normalize (struct wmOperatorType *ot)
 
void GPENCIL_OT_vertex_group_normalize_all (struct wmOperatorType *ot)
 
void GPENCIL_OT_lock_layer (struct wmOperatorType *ot)
 
void GPENCIL_OT_material_isolate (struct wmOperatorType *ot)
 
void GPENCIL_OT_material_hide (struct wmOperatorType *ot)
 
void GPENCIL_OT_material_reveal (struct wmOperatorType *ot)
 
void GPENCIL_OT_material_lock_all (struct wmOperatorType *ot)
 
void GPENCIL_OT_material_unlock_all (struct wmOperatorType *ot)
 
void GPENCIL_OT_material_lock_unused (struct wmOperatorType *ot)
 
void GPENCIL_OT_material_select (struct wmOperatorType *ot)
 
void GPENCIL_OT_material_set (struct wmOperatorType *ot)
 
void GPENCIL_OT_set_active_material (struct wmOperatorType *ot)
 
void GPENCIL_OT_materials_copy_to_object (struct wmOperatorType *ot)
 
void GPENCIL_OT_convert_old_files (struct wmOperatorType *ot)
 
void GPENCIL_OT_generate_weights (struct wmOperatorType *ot)
 

Variables

ListBase gpencil_strokes_copypastebuf
 
const EnumPropertyItem rna_gpencil_reproject_type_items []
 

Macro Definition Documentation

◆ DEPTH_INVALID

#define DEPTH_INVALID   1.0f

Definition at line 14 of file gpencil_intern.h.

◆ GP_EDITABLE_CURVES_BEGIN

#define GP_EDITABLE_CURVES_BEGIN (   gpstroke_iter,
  C,
  gpl,
  gps,
  gpc 
)
Value:
{ \
struct GP_EditableStrokes_Iter gpstroke_iter = {{{0}}}; \
Depsgraph *depsgraph_ = CTX_data_ensure_evaluated_depsgraph(C); \
Object *obact_ = CTX_data_active_object(C); \
bGPdata *gpd_ = CTX_data_gpencil_data(C); \
const bool is_multiedit_ = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd_); \
CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) { \
bGPDframe *init_gpf_ = (is_multiedit_) ? gpl->frames.first : gpl->actframe; \
for (bGPDframe *gpf_ = init_gpf_; gpf_; gpf_ = gpf_->next) { \
if ((gpf_ == gpl->actframe) || ((gpf_->flag & GP_FRAME_SELECT) && is_multiedit_)) { \
BKE_gpencil_layer_transform_matrix_get( \
depsgraph_, obact_, gpl, gpstroke_iter.diff_mat); \
invert_m4_m4(gpstroke_iter.inverse_diff_mat, gpstroke_iter.diff_mat); \
/* loop over strokes */ \
bGPDstroke *gpsn_; \
for (bGPDstroke *gps = gpf_->strokes.first; gps; gps = gpsn_) { \
gpsn_ = gps->next; \
/* skip strokes that are invalid for current view */ \
if (ED_gpencil_stroke_can_use(C, gps) == false) \
continue; \
if (gps->editcurve == NULL) \
continue; \
bGPDcurve *gpc = gps->editcurve; \
/* ... Do Stuff With Strokes ... */
struct bGPdata * CTX_data_gpencil_data(const bContext *C)
Definition: context.c:1445
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Definition: context.c:1528
struct Object * CTX_data_active_object(const bContext *C)
Definition: context.c:1353
#define GPENCIL_MULTIEDIT_SESSIONS_ON(gpd)
@ GP_FRAME_SELECT
#define C
Definition: RandGen.cpp:25
bool ED_gpencil_stroke_can_use(const bContext *C, const bGPDstroke *gps)
struct bGPDframe * next

Iterate over all editable edit-curves in the current context, stopping on each usable layer + stroke + curve pair (i.e. gpl, gps and gpc) to perform some operations on the curve.

Parameters
gplThe identifier to use for the layer of the stroke being processed. Choose a suitable value to avoid name clashes.
gpsThe identifier to use for current stroke being processed. Choose a suitable value to avoid name clashes.
gpcThe identifier to use for current editcurve being processed. Choose a suitable value to avoid name clashes.

Definition at line 740 of file gpencil_intern.h.

◆ GP_EDITABLE_CURVES_END

#define GP_EDITABLE_CURVES_END (   gpstroke_iter)
Value:
} \
} \
if (!is_multiedit_) { \
break; \
} \
} \
} \
CTX_DATA_END; \
} \
(void)0
SyclQueue void void size_t num_bytes void

Definition at line 766 of file gpencil_intern.h.

◆ GP_EDITABLE_STROKES_BEGIN

#define GP_EDITABLE_STROKES_BEGIN (   gpstroke_iter,
  C,
  gpl,
  gps 
)
Value:
{ \
struct GP_EditableStrokes_Iter gpstroke_iter = {{{0}}}; \
Depsgraph *depsgraph_ = CTX_data_ensure_evaluated_depsgraph(C); \
Object *obact_ = CTX_data_active_object(C); \
bGPdata *gpd_ = CTX_data_gpencil_data(C); \
const bool is_multiedit_ = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd_); \
CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) { \
bGPDframe *init_gpf_ = (is_multiedit_) ? gpl->frames.first : gpl->actframe; \
for (bGPDframe *gpf_ = init_gpf_; gpf_; gpf_ = gpf_->next) { \
if ((gpf_ == gpl->actframe) || ((gpf_->flag & GP_FRAME_SELECT) && is_multiedit_)) { \
BKE_gpencil_layer_transform_matrix_get( \
depsgraph_, obact_, gpl, gpstroke_iter.diff_mat); \
invert_m4_m4(gpstroke_iter.inverse_diff_mat, gpstroke_iter.diff_mat); \
/* loop over strokes */ \
bGPDstroke *gpsn_; \
for (bGPDstroke *gps = gpf_->strokes.first; gps; gps = gpsn_) { \
gpsn_ = gps->next; \
/* skip strokes that are invalid for current view */ \
if (ED_gpencil_stroke_can_use(C, gps) == false) { \
continue; \
} \
/* check if the color is editable */ \
if (ED_gpencil_stroke_material_editable(obact_, gpl, gps) == false) { \
continue; \
} \
/* ... Do Stuff With Strokes ... */
bool ED_gpencil_stroke_material_editable(Object *ob, const bGPDlayer *gpl, const bGPDstroke *gps)

Iterate over all editable strokes in the current context, stopping on each usable layer + stroke pair (i.e. gpl and gps) to perform some operations on the stroke.

Parameters
gplThe identifier to use for the layer of the stroke being processed. Choose a suitable value to avoid name clashes.
gpsThe identifier to use for current stroke being processed. Choose a suitable value to avoid name clashes.

Definition at line 688 of file gpencil_intern.h.

◆ GP_EDITABLE_STROKES_END

#define GP_EDITABLE_STROKES_END (   gpstroke_iter)
Value:
} \
} \
if (!is_multiedit_) { \
break; \
} \
} \
} \
CTX_DATA_END; \
} \
(void)0

Definition at line 716 of file gpencil_intern.h.

◆ GP_EVALUATED_STROKES_BEGIN

#define GP_EVALUATED_STROKES_BEGIN (   gpstroke_iter,
  C,
  gpl,
  gps 
)
Value:
{ \
struct GP_EditableStrokes_Iter gpstroke_iter = {{{0}}}; \
Depsgraph *depsgraph_ = CTX_data_ensure_evaluated_depsgraph(C); \
Object *obact_ = CTX_data_active_object(C); \
Object *ob_eval_ = (Object *)DEG_get_evaluated_id(depsgraph_, &obact_->id); \
bGPdata *gpd_ = (bGPdata *)ob_eval_->data; \
const bool is_multiedit_ = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd_); \
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd_->layers) { \
bGPDframe *init_gpf_ = (is_multiedit_) ? gpl->frames.first : gpl->actframe; \
for (bGPDframe *gpf_ = init_gpf_; gpf_; gpf_ = gpf_->next) { \
if ((gpf_ == gpl->actframe) || ((gpf_->flag & GP_FRAME_SELECT) && is_multiedit_)) { \
BKE_gpencil_layer_transform_matrix_get( \
depsgraph_, obact_, gpl, gpstroke_iter.diff_mat); \
/* Undo layer transform. */ \
mul_m4_m4m4(gpstroke_iter.diff_mat, gpstroke_iter.diff_mat, gpl->layer_invmat); \
/* loop over strokes */ \
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf_->strokes) { \
/* skip strokes that are invalid for current view */ \
if (ED_gpencil_stroke_can_use(C, gps) == false) { \
continue; \
} \
/* check if the color is editable */ \
if (ED_gpencil_stroke_material_editable(obact_, gpl, gps) == false) { \
continue; \
} \
/* ... Do Stuff With Strokes ... */
bool BKE_gpencil_layer_is_editable(const struct bGPDlayer *gpl)
struct ID * DEG_get_evaluated_id(const struct Depsgraph *depsgraph, struct ID *id)

Iterate over all editable strokes using evaluated data in the current context, stopping on each usable layer + stroke pair (i.e. gpl and gps) to perform some operations on the stroke.

Parameters
gplThe identifier to use for the layer of the stroke being processed. Choose a suitable value to avoid name clashes.
gpsThe identifier to use for current stroke being processed. Choose a suitable value to avoid name clashes.

Definition at line 788 of file gpencil_intern.h.

◆ GP_EVALUATED_STROKES_END

#define GP_EVALUATED_STROKES_END (   gpstroke_iter)
Value:
} \
} \
if (!is_multiedit_) { \
break; \
} \
} \
} \
} \
} \
(void)0

Definition at line 817 of file gpencil_intern.h.

◆ GP_STROKE_BUFFER_CHUNK

#define GP_STROKE_BUFFER_CHUNK   2048

Definition at line 461 of file gpencil_intern.h.

Typedef Documentation

◆ eGPencil_PaintModes

◆ GP_SpaceConversion

◆ GpRandomSettings

Random settings by stroke

◆ tGPDdraw

typedef struct tGPDdraw tGPDdraw

◆ tGPDprimitive

typedef struct tGPDprimitive tGPDprimitive

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
GP_STROKE_JOIN 
GP_STROKE_JOINCOPY 

Definition at line 564 of file gpencil_intern.h.

◆ anonymous enum

anonymous enum
Enumerator
GP_STROKE_BOX 
GP_STROKE_LINE 
GP_STROKE_CIRCLE 
GP_STROKE_ARC 
GP_STROKE_CURVE 
GP_STROKE_POLYLINE 

Definition at line 569 of file gpencil_intern.h.

◆ anonymous enum

anonymous enum
Enumerator
GP_MERGE_STROKE 
GP_MERGE_POINT 

Definition at line 578 of file gpencil_intern.h.

◆ eGPencil_PaintModes

Enumerator
GP_PAINTMODE_DRAW 
GP_PAINTMODE_ERASER 
GP_PAINTMODE_DRAW_STRAIGHT 
GP_PAINTMODE_DRAW_POLY 
GP_PAINTMODE_SET_CP 

Definition at line 452 of file gpencil_intern.h.

Function Documentation

◆ ED_gpencil_draw_fill()

void ED_gpencil_draw_fill ( struct tGPDdraw tgpw)

Wrapper to draw strokes for filling operator.

Definition at line 410 of file drawgpencil.c.

References gpencil_draw_strokes().

Referenced by gpencil_draw_datablock().

◆ ED_gpencil_layers_enum_itemf()

const struct EnumPropertyItem* ED_gpencil_layers_enum_itemf ( struct bContext C,
struct PointerRNA ptr,
struct PropertyRNA prop,
bool r_free 
)

Just existing layers.

◆ ED_gpencil_layers_with_new_enum_itemf()

const struct EnumPropertyItem* ED_gpencil_layers_with_new_enum_itemf ( struct bContext C,
struct PointerRNA ptr,
struct PropertyRNA prop,
bool r_free 
)

Existing + Option to add/use new layer.

Referenced by GPENCIL_OT_layer_change().

◆ ED_gpencil_material_enum_itemf()

const struct EnumPropertyItem* ED_gpencil_material_enum_itemf ( struct bContext C,
struct PointerRNA ptr,
struct PropertyRNA prop,
bool r_free 
)

Just existing Materials.

Referenced by GPENCIL_OT_material_set().

◆ gpencil_active_brush_poll()

bool gpencil_active_brush_poll ( struct bContext C)

Poll callback for checking if there is an active brush.

Definition at line 323 of file gpencil_utils.c.

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

◆ gpencil_active_layer_poll()

bool gpencil_active_layer_poll ( struct bContext C)

◆ gpencil_add_poll()

bool gpencil_add_poll ( struct bContext C)

Poll callback for adding data/layers - special.

Definition at line 300 of file gpencil_utils.c.

References C, CTX_data_active_object(), Object::data, NULL, and return().

Referenced by GPENCIL_OT_blank_frame_add(), GPENCIL_OT_layer_add(), and GPENCIL_OT_layer_mask_add().

◆ gpencil_apply_parent()

void gpencil_apply_parent ( struct Depsgraph depsgraph,
struct Object obact,
bGPDlayer gpl,
bGPDstroke gps 
)

Change points position relative to parent object Change position relative to parent object

Definition at line 625 of file gpencil_utils.c.

References BKE_gpencil_layer_transform_matrix_get(), copy_v3_v3(), depsgraph, invert_m4_m4(), mul_v3_m4v3(), bGPDstroke::points, bGPDstroke::totpoints, bGPDspoint::x, and zero_axis_bias_m4().

Referenced by gpencil_stroke_newfrombuffer().

◆ gpencil_apply_parent_point()

void gpencil_apply_parent_point ( struct Depsgraph depsgraph,
struct Object obact,
bGPDlayer gpl,
bGPDspoint pt 
)

◆ gpencil_brush_create_presets_poll()

bool gpencil_brush_create_presets_poll ( bContext C)

◆ gpencil_copybuf_validate_colormap()

struct GHash* gpencil_copybuf_validate_colormap ( struct bContext C)

◆ gpencil_delete_selected_point_wrap()

int gpencil_delete_selected_point_wrap ( bContext C)

Simple wrapper to external call.

Definition at line 2693 of file gpencil_edit.c.

References C, and gpencil_delete_selected_points().

Referenced by gpencil_generic_select_exec().

◆ GPENCIL_OT_active_frame_delete()

void GPENCIL_OT_active_frame_delete ( struct wmOperatorType ot)

◆ GPENCIL_OT_active_frames_delete_all()

void GPENCIL_OT_active_frames_delete_all ( struct wmOperatorType ot)

◆ GPENCIL_OT_annotate()

void GPENCIL_OT_annotate ( struct wmOperatorType ot)

◆ GPENCIL_OT_annotation_active_frame_delete()

void GPENCIL_OT_annotation_active_frame_delete ( struct wmOperatorType ot)

◆ GPENCIL_OT_annotation_add()

void GPENCIL_OT_annotation_add ( struct wmOperatorType ot)

◆ GPENCIL_OT_bake_grease_pencil_animation()

void GPENCIL_OT_bake_grease_pencil_animation ( struct wmOperatorType ot)

◆ GPENCIL_OT_bake_mesh_animation()

void GPENCIL_OT_bake_mesh_animation ( struct wmOperatorType ot)

◆ GPENCIL_OT_blank_frame_add()

void GPENCIL_OT_blank_frame_add ( struct wmOperatorType ot)

◆ GPENCIL_OT_brush_reset()

void GPENCIL_OT_brush_reset ( struct wmOperatorType ot)

◆ GPENCIL_OT_brush_reset_all()

void GPENCIL_OT_brush_reset_all ( struct wmOperatorType ot)

◆ GPENCIL_OT_convert()

void GPENCIL_OT_convert ( struct wmOperatorType ot)

◆ GPENCIL_OT_convert_old_files()

void GPENCIL_OT_convert_old_files ( struct wmOperatorType ot)

◆ GPENCIL_OT_copy()

void GPENCIL_OT_copy ( struct wmOperatorType ot)

◆ GPENCIL_OT_data_unlink()

void GPENCIL_OT_data_unlink ( struct wmOperatorType ot)

◆ GPENCIL_OT_delete()

void GPENCIL_OT_delete ( struct wmOperatorType ot)

◆ GPENCIL_OT_dissolve()

void GPENCIL_OT_dissolve ( struct wmOperatorType ot)

◆ GPENCIL_OT_draw()

void GPENCIL_OT_draw ( struct wmOperatorType ot)

◆ GPENCIL_OT_duplicate()

void GPENCIL_OT_duplicate ( struct wmOperatorType ot)

◆ GPENCIL_OT_editmode_toggle()

void GPENCIL_OT_editmode_toggle ( struct wmOperatorType ot)

◆ GPENCIL_OT_extract_palette_vertex()

void GPENCIL_OT_extract_palette_vertex ( struct wmOperatorType ot)

◆ GPENCIL_OT_extrude()

void GPENCIL_OT_extrude ( struct wmOperatorType ot)

◆ GPENCIL_OT_fill()

void GPENCIL_OT_fill ( struct wmOperatorType ot)

◆ GPENCIL_OT_frame_clean_duplicate()

void GPENCIL_OT_frame_clean_duplicate ( struct wmOperatorType ot)

◆ GPENCIL_OT_frame_clean_fill()

void GPENCIL_OT_frame_clean_fill ( struct wmOperatorType ot)

◆ GPENCIL_OT_frame_clean_loose()

void GPENCIL_OT_frame_clean_loose ( struct wmOperatorType ot)

◆ GPENCIL_OT_frame_duplicate()

void GPENCIL_OT_frame_duplicate ( struct wmOperatorType ot)

◆ GPENCIL_OT_generate_weights()

void GPENCIL_OT_generate_weights ( struct wmOperatorType ot)

◆ GPENCIL_OT_guide_rotate()

void GPENCIL_OT_guide_rotate ( struct wmOperatorType ot)

◆ GPENCIL_OT_hide()

void GPENCIL_OT_hide ( struct wmOperatorType ot)

◆ GPENCIL_OT_image_to_grease_pencil()

void GPENCIL_OT_image_to_grease_pencil ( struct wmOperatorType ot)

◆ GPENCIL_OT_interpolate()

void GPENCIL_OT_interpolate ( struct wmOperatorType ot)

◆ GPENCIL_OT_interpolate_reverse()

void GPENCIL_OT_interpolate_reverse ( struct wmOperatorType ot)

◆ GPENCIL_OT_interpolate_sequence()

void GPENCIL_OT_interpolate_sequence ( struct wmOperatorType ot)

◆ GPENCIL_OT_layer_active()

void GPENCIL_OT_layer_active ( struct wmOperatorType ot)

◆ GPENCIL_OT_layer_add()

void GPENCIL_OT_layer_add ( struct wmOperatorType ot)

◆ GPENCIL_OT_layer_annotation_add()

void GPENCIL_OT_layer_annotation_add ( struct wmOperatorType ot)

◆ GPENCIL_OT_layer_annotation_move()

void GPENCIL_OT_layer_annotation_move ( struct wmOperatorType ot)

◆ GPENCIL_OT_layer_annotation_remove()

void GPENCIL_OT_layer_annotation_remove ( struct wmOperatorType ot)

◆ GPENCIL_OT_layer_change()

void GPENCIL_OT_layer_change ( struct wmOperatorType ot)

◆ GPENCIL_OT_layer_duplicate()

void GPENCIL_OT_layer_duplicate ( struct wmOperatorType ot)

◆ GPENCIL_OT_layer_duplicate_object()

void GPENCIL_OT_layer_duplicate_object ( struct wmOperatorType ot)

◆ GPENCIL_OT_layer_isolate()

void GPENCIL_OT_layer_isolate ( struct wmOperatorType ot)

◆ GPENCIL_OT_layer_mask_add()

void GPENCIL_OT_layer_mask_add ( struct wmOperatorType ot)

◆ GPENCIL_OT_layer_mask_move()

void GPENCIL_OT_layer_mask_move ( struct wmOperatorType ot)

◆ GPENCIL_OT_layer_mask_remove()

void GPENCIL_OT_layer_mask_remove ( struct wmOperatorType ot)

◆ GPENCIL_OT_layer_merge()

void GPENCIL_OT_layer_merge ( struct wmOperatorType ot)

◆ GPENCIL_OT_layer_move()

void GPENCIL_OT_layer_move ( struct wmOperatorType ot)

◆ GPENCIL_OT_layer_remove()

void GPENCIL_OT_layer_remove ( struct wmOperatorType ot)

◆ GPENCIL_OT_lock_all()

void GPENCIL_OT_lock_all ( struct wmOperatorType ot)

◆ GPENCIL_OT_lock_layer()

void GPENCIL_OT_lock_layer ( struct wmOperatorType ot)

◆ GPENCIL_OT_material_hide()

void GPENCIL_OT_material_hide ( struct wmOperatorType ot)

◆ GPENCIL_OT_material_isolate()

void GPENCIL_OT_material_isolate ( struct wmOperatorType ot)

◆ GPENCIL_OT_material_lock_all()

void GPENCIL_OT_material_lock_all ( struct wmOperatorType ot)

◆ GPENCIL_OT_material_lock_unused()

void GPENCIL_OT_material_lock_unused ( struct wmOperatorType ot)

◆ GPENCIL_OT_material_reveal()

void GPENCIL_OT_material_reveal ( struct wmOperatorType ot)

◆ GPENCIL_OT_material_select()

void GPENCIL_OT_material_select ( struct wmOperatorType ot)

◆ GPENCIL_OT_material_set()

void GPENCIL_OT_material_set ( struct wmOperatorType ot)

◆ GPENCIL_OT_material_to_vertex_color()

void GPENCIL_OT_material_to_vertex_color ( struct wmOperatorType ot)

◆ GPENCIL_OT_material_unlock_all()

void GPENCIL_OT_material_unlock_all ( struct wmOperatorType ot)

◆ GPENCIL_OT_materials_copy_to_object()

void GPENCIL_OT_materials_copy_to_object ( struct wmOperatorType ot)

◆ GPENCIL_OT_move_to_layer()

void GPENCIL_OT_move_to_layer ( struct wmOperatorType ot)

◆ GPENCIL_OT_paintmode_toggle()

void GPENCIL_OT_paintmode_toggle ( struct wmOperatorType ot)

◆ GPENCIL_OT_paste()

void GPENCIL_OT_paste ( struct wmOperatorType ot)

◆ GPENCIL_OT_primitive_box()

void GPENCIL_OT_primitive_box ( struct wmOperatorType ot)

◆ GPENCIL_OT_primitive_circle()

void GPENCIL_OT_primitive_circle ( struct wmOperatorType ot)

◆ GPENCIL_OT_primitive_curve()

void GPENCIL_OT_primitive_curve ( struct wmOperatorType ot)

◆ GPENCIL_OT_primitive_line()

void GPENCIL_OT_primitive_line ( struct wmOperatorType ot)

◆ GPENCIL_OT_primitive_polyline()

void GPENCIL_OT_primitive_polyline ( struct wmOperatorType ot)

◆ GPENCIL_OT_recalc_geometry()

void GPENCIL_OT_recalc_geometry ( struct wmOperatorType ot)

◆ GPENCIL_OT_reproject()

void GPENCIL_OT_reproject ( struct wmOperatorType ot)

◆ GPENCIL_OT_reset_transform_fill()

void GPENCIL_OT_reset_transform_fill ( struct wmOperatorType ot)

◆ GPENCIL_OT_reveal()

void GPENCIL_OT_reveal ( struct wmOperatorType ot)

◆ GPENCIL_OT_sculpt_paint()

void GPENCIL_OT_sculpt_paint ( struct wmOperatorType ot)

◆ GPENCIL_OT_sculptmode_toggle()

void GPENCIL_OT_sculptmode_toggle ( struct wmOperatorType ot)

◆ GPENCIL_OT_select()

void GPENCIL_OT_select ( struct wmOperatorType ot)

◆ GPENCIL_OT_select_all()

void GPENCIL_OT_select_all ( struct wmOperatorType ot)

◆ GPENCIL_OT_select_alternate()

void GPENCIL_OT_select_alternate ( struct wmOperatorType ot)

◆ GPENCIL_OT_select_box()

void GPENCIL_OT_select_box ( struct wmOperatorType ot)

◆ GPENCIL_OT_select_circle()

void GPENCIL_OT_select_circle ( struct wmOperatorType ot)

◆ GPENCIL_OT_select_first()

void GPENCIL_OT_select_first ( struct wmOperatorType ot)

◆ GPENCIL_OT_select_grouped()

void GPENCIL_OT_select_grouped ( struct wmOperatorType ot)

◆ GPENCIL_OT_select_lasso()

void GPENCIL_OT_select_lasso ( struct wmOperatorType ot)

◆ GPENCIL_OT_select_last()

void GPENCIL_OT_select_last ( struct wmOperatorType ot)

◆ GPENCIL_OT_select_less()

void GPENCIL_OT_select_less ( struct wmOperatorType ot)

◆ GPENCIL_OT_select_linked()

void GPENCIL_OT_select_linked ( struct wmOperatorType ot)

◆ GPENCIL_OT_select_more()

void GPENCIL_OT_select_more ( struct wmOperatorType ot)

◆ GPENCIL_OT_select_random()

void GPENCIL_OT_select_random ( struct wmOperatorType ot)

◆ GPENCIL_OT_select_vertex_color()

void GPENCIL_OT_select_vertex_color ( struct wmOperatorType ot)

◆ GPENCIL_OT_selection_opacity_toggle()

void GPENCIL_OT_selection_opacity_toggle ( struct wmOperatorType ot)

◆ GPENCIL_OT_selectmode_toggle()

void GPENCIL_OT_selectmode_toggle ( struct wmOperatorType ot)

◆ GPENCIL_OT_set_active_material()

void GPENCIL_OT_set_active_material ( struct wmOperatorType ot)

◆ GPENCIL_OT_snap_cursor_to_selected()

void GPENCIL_OT_snap_cursor_to_selected ( struct wmOperatorType ot)

◆ GPENCIL_OT_snap_to_cursor()

void GPENCIL_OT_snap_to_cursor ( struct wmOperatorType ot)

◆ GPENCIL_OT_snap_to_grid()

void GPENCIL_OT_snap_to_grid ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_apply_thickness()

void GPENCIL_OT_stroke_apply_thickness ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_arrange()

void GPENCIL_OT_stroke_arrange ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_caps_set()

void GPENCIL_OT_stroke_caps_set ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_change_color()

void GPENCIL_OT_stroke_change_color ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_cutter()

void GPENCIL_OT_stroke_cutter ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_cyclical_set()

void GPENCIL_OT_stroke_cyclical_set ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_editcurve_set_handle_type()

void GPENCIL_OT_stroke_editcurve_set_handle_type ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_enter_editcurve_mode()

void GPENCIL_OT_stroke_enter_editcurve_mode ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_flip()

void GPENCIL_OT_stroke_flip ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_join()

void GPENCIL_OT_stroke_join ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_merge()

void GPENCIL_OT_stroke_merge ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_merge_by_distance()

void GPENCIL_OT_stroke_merge_by_distance ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_merge_material()

void GPENCIL_OT_stroke_merge_material ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_normalize()

void GPENCIL_OT_stroke_normalize ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_reset_vertex_color()

void GPENCIL_OT_stroke_reset_vertex_color ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_sample()

void GPENCIL_OT_stroke_sample ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_separate()

void GPENCIL_OT_stroke_separate ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_simplify()

void GPENCIL_OT_stroke_simplify ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_simplify_fixed()

void GPENCIL_OT_stroke_simplify_fixed ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_smooth()

void GPENCIL_OT_stroke_smooth ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_split()

void GPENCIL_OT_stroke_split ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_subdivide()

void GPENCIL_OT_stroke_subdivide ( struct wmOperatorType ot)

◆ GPENCIL_OT_stroke_trim()

void GPENCIL_OT_stroke_trim ( struct wmOperatorType ot)

◆ GPENCIL_OT_trace_image()

void GPENCIL_OT_trace_image ( struct wmOperatorType ot)

◆ GPENCIL_OT_transform_fill()

void GPENCIL_OT_transform_fill ( struct wmOperatorType ot)

◆ GPENCIL_OT_unlock_all()

void GPENCIL_OT_unlock_all ( struct wmOperatorType ot)

◆ GPENCIL_OT_vertex_color_brightness_contrast()

void GPENCIL_OT_vertex_color_brightness_contrast ( struct wmOperatorType ot)

◆ GPENCIL_OT_vertex_color_hsv()

void GPENCIL_OT_vertex_color_hsv ( struct wmOperatorType ot)

◆ GPENCIL_OT_vertex_color_invert()

void GPENCIL_OT_vertex_color_invert ( struct wmOperatorType ot)

◆ GPENCIL_OT_vertex_color_levels()

void GPENCIL_OT_vertex_color_levels ( struct wmOperatorType ot)

◆ GPENCIL_OT_vertex_color_set()

void GPENCIL_OT_vertex_color_set ( struct wmOperatorType ot)

◆ GPENCIL_OT_vertex_group_assign()

void GPENCIL_OT_vertex_group_assign ( struct wmOperatorType ot)

◆ GPENCIL_OT_vertex_group_deselect()

void GPENCIL_OT_vertex_group_deselect ( struct wmOperatorType ot)

◆ GPENCIL_OT_vertex_group_invert()

void GPENCIL_OT_vertex_group_invert ( struct wmOperatorType ot)

◆ GPENCIL_OT_vertex_group_normalize()

void GPENCIL_OT_vertex_group_normalize ( struct wmOperatorType ot)

◆ GPENCIL_OT_vertex_group_normalize_all()

void GPENCIL_OT_vertex_group_normalize_all ( struct wmOperatorType ot)

◆ GPENCIL_OT_vertex_group_remove_from()

void GPENCIL_OT_vertex_group_remove_from ( struct wmOperatorType ot)

◆ GPENCIL_OT_vertex_group_select()

void GPENCIL_OT_vertex_group_select ( struct wmOperatorType ot)

◆ GPENCIL_OT_vertex_group_smooth()

void GPENCIL_OT_vertex_group_smooth ( struct wmOperatorType ot)

◆ GPENCIL_OT_vertex_paint()

void GPENCIL_OT_vertex_paint ( struct wmOperatorType ot)

◆ GPENCIL_OT_vertexmode_toggle()

void GPENCIL_OT_vertexmode_toggle ( struct wmOperatorType ot)

◆ GPENCIL_OT_weight_paint()

void GPENCIL_OT_weight_paint ( struct wmOperatorType ot)

◆ GPENCIL_OT_weightmode_toggle()

void GPENCIL_OT_weightmode_toggle ( struct wmOperatorType ot)

◆ gpencil_point_3d_to_xy()

void gpencil_point_3d_to_xy ( const GP_SpaceConversion gsc,
short  flag,
const float  pt[3],
float  xy[2] 
)

◆ gpencil_point_conversion_init()

void gpencil_point_conversion_init ( struct bContext C,
GP_SpaceConversion r_gsc 
)

◆ gpencil_point_to_parent_space()

void gpencil_point_to_parent_space ( const bGPDspoint pt,
const float  diff_mat[4][4],
bGPDspoint r_pt 
)

◆ gpencil_point_to_xy()

void gpencil_point_to_xy ( const GP_SpaceConversion gsc,
const struct bGPDstroke gps,
const struct bGPDspoint pt,
int *  r_x,
int *  r_y 
)

Convert a Grease Pencil coordinate (i.e. can be 2D or 3D) to screen-space (2D)

Parameters
[out]r_xThe screen-space x-coordinate of the point
[out]r_yThe screen-space y-coordinate of the point
Warning
This assumes that the caller has already checked whether the stroke in question can be drawn.

Referenced by annotation_stroke_eraser_dostroke(), get_automasking_strokes_list(), gpencil_brush_clone_adjust(), gpencil_select_exec(), gpencil_stroke_do_circle_sel(), gpencil_stroke_eraser_dostroke(), gpencil_test_lasso(), gpencil_vertexpaint_select_stroke(), and gpencil_weightpaint_select_stroke().

◆ gpencil_point_to_xy_fl()

void gpencil_point_to_xy_fl ( const GP_SpaceConversion gsc,
const bGPDstroke gps,
const bGPDspoint pt,
float r_x,
float r_y 
)

Convert a Grease Pencil coordinate (i.e. can be 2D or 3D) to screen-space (2D).

Just like gpencil_point_to_xy(), except the resulting coordinates are floats not ints. Use this version to solve "stair-step" artifacts which may arise when round-tripping the calculations.

Parameters
r_xThe screen-space x-coordinate of the point.
r_yThe screen-space y-coordinate of the point.
Warning
This assumes that the caller has already checked whether the stroke in question can be drawn.

Definition at line 707 of file gpencil_utils.c.

References GP_SpaceConversion::area, BLI_assert, BLI_rctf_size_x(), BLI_rctf_size_y(), ED_view3d_project_float_global(), bGPDstroke::flag, float(), GP_STROKE_2DSPACE, GP_STROKE_3DSPACE, GP_SpaceConversion::mat, mul_m4_v3(), NULL, GP_SpaceConversion::region, SPACE_VIEW3D, ScrArea::spacetype, GP_SpaceConversion::subrect, UI_view2d_view_to_region_clip(), GP_SpaceConversion::v2d, V2D_IS_CLIPPED, V3D_PROJ_RET_OK, V3D_PROJ_TEST_NOP, ARegion::winx, ARegion::winy, bGPDspoint::x, rctf::xmin, bGPDspoint::y, and rctf::ymin.

Referenced by ED_gpencil_project_stroke_to_view(), ED_gpencil_projected_2d_bound_box(), ED_gpencil_stroke_extremes_to2d(), ED_gpencil_stroke_nearest_to_ends(), ED_gpencil_stroke_reproject(), and gpencil_stroke_need_flip().

◆ gpencil_point_xy_to_3d()

bool gpencil_point_xy_to_3d ( const GP_SpaceConversion gsc,
struct Scene scene,
const float  screen_co[2],
float  r_out[3] 
)

Project screen-space coordinates to 3D-space

For use with editing tools where it is easier to perform the operations in 2D, and then later convert the transformed points back to 3D.

Parameters
screen_coThe screen-space 2D coordinates to convert to
r_outThe resulting 3D coordinates of the input point
Note
We include this as a utility function, since the standard method involves quite a few steps, which are invariably always the same for all GPencil operations. So, it's nicer to just centralize these.
Warning
Assumes that it is getting called in a 3D view only.

Definition at line 818 of file gpencil_utils.c.

References ED_gpencil_drawing_reference_get(), ED_view3d_calc_zfac(), ED_view3d_project_float_global(), ED_view3d_win_to_delta(), ToolSettings::gpencil_v3d_align, GP_SpaceConversion::ob, GP_SpaceConversion::region, ARegion::regiondata, scene, sub_v2_v2v2(), sub_v3_v3v3(), Scene::toolsettings, V3D_PROJ_RET_OK, V3D_PROJ_TEST_NOP, and zero_v3().

Referenced by ED_gpencil_project_stroke_to_view(), and ED_gpencil_stroke_reproject().

◆ gpencil_stroke_convertcoords_tpoint()

void gpencil_stroke_convertcoords_tpoint ( struct Scene scene,
struct ARegion region,
struct Object ob,
const struct tGPspoint point2D,
float depth,
float  r_out[3] 
)

Convert tGPspoint (temporary 2D/screen-space point data used by GP modal operators) to 3D coordinates.

Parameters
point2DThe screen-space 2D point data to convert.
depthDepth array (via ED_view3d_depth_read_cached()).
r_outThe resulting 2D point data.

Referenced by gpencil_fill_modal(), gpencil_primitive_update_strokes(), and gpencil_stroke_from_buffer().

◆ gpencil_stroke_inside_circle()

bool gpencil_stroke_inside_circle ( const float  mval[2],
int  rad,
int  x0,
int  y0,
int  x1,
int  y1 
)

Check whether a given stroke segment is inside a circular brush

Parameters
mvalThe current screen-space coordinates (midpoint) of the brush
radThe radius of the brush
x0,y0The screen-space x and y coordinates of the start of the stroke segment
x1,y1The screen-space x and y coordinates of the end of the stroke segment

Definition at line 462 of file gpencil_utils.c.

References edge_inside_circle(), and y1.

Referenced by annotation_stroke_eraser_dostroke(), get_automasking_strokes_list(), gpencil_stroke_eraser_dostroke(), gpencil_vertexpaint_select_stroke(), and gpencil_weightpaint_select_stroke().

◆ gpencil_subdivide_stroke()

void gpencil_subdivide_stroke ( bGPdata gpd,
bGPDstroke gps,
int  subdivide 
)

◆ gpencil_undo_finish()

void gpencil_undo_finish ( void  )

◆ gpencil_undo_init()

void gpencil_undo_init ( struct bGPdata gpd)

Definition at line 97 of file gpencil_undo.c.

References gpencil_undo_push().

Referenced by annotation_session_initdata(), and gpencil_session_init_fill().

◆ gpencil_undo_push()

void gpencil_undo_push ( struct bGPdata gpd)

Variable Documentation

◆ gpencil_strokes_copypastebuf

ListBase gpencil_strokes_copypastebuf
extern

list of bGPDstroke instances

Note
is exposed within the editors/gpencil module so that other tools can use it too.

Definition at line 1373 of file gpencil_edit.c.

Referenced by ED_gpencil_strokes_copybuf_free(), gpencil_brush_clone_add(), gpencil_brush_clone_init(), gpencil_sculpt_brush_init(), gpencil_strokes_copy_exec(), gpencil_strokes_paste_exec(), and gpencil_strokes_paste_poll().

◆ rna_gpencil_reproject_type_items

const EnumPropertyItem rna_gpencil_reproject_type_items[]
extern