52#include "RNA_prototypes.hh"
64#define DEPTH_INVALID 1.0f
194#define MIN_MANHATTAN_PX (U.gp_manhattandist)
196#define MIN_EUCLIDEAN_PX (U.gp_euclideandist)
261 int dx = int(
fabsf(mval[0] - pmval[0]));
262 int dy = int(
fabsf(mval[1] - pmval[1]));
389 if ((num_points < 3) || (idx < 3) || (inf == 0.0f)) {
399 tGPspoint *pta = idx >= 4 ? &points[idx - 4] :
nullptr;
400 tGPspoint *ptb = idx >= 3 ? &points[idx - 3] :
nullptr;
401 tGPspoint *ptc = idx >= 2 ? &points[idx - 2] :
nullptr;
404 float sco[2] = {0.0f};
405 float a[2],
b[2], c[2], d[2];
406 const float average_fac = 1.0f / steps;
432 const float ref_point[2],
433 const float dir_cw[2],
434 const float dir_ccw[2],
438 stroke_points[0] = ref_point[0] + dir_cw[0] *
length *
sign;
439 stroke_points[1] = ref_point[1] + dir_cw[1] *
length *
sign;
440 stroke_points[2] = ref_point[0] + dir_ccw[0] *
length *
sign;
441 stroke_points[3] = ref_point[1] + dir_ccw[1] *
length *
sign;
445 const float stroke_dir[2],
447 float stroke_points[8],
448 const int arrow_style)
450 const int arrow_length = 8;
454 const float inv_norm_dir_clockwise[2] = {norm_dir[1], -norm_dir[0]};
455 const float inv_norm_dir_counterclockwise[2] = {-norm_dir[1], norm_dir[0]};
457 switch (arrow_style) {
460 stroke_points[0] = corner[0] + inv_norm_dir_clockwise[0] * arrow_length + norm_dir[0];
461 stroke_points[1] = corner[1] + inv_norm_dir_clockwise[1] * arrow_length + norm_dir[1];
462 stroke_points[2] = corner[0] + inv_norm_dir_counterclockwise[0] * arrow_length + norm_dir[0];
463 stroke_points[3] = corner[1] + inv_norm_dir_counterclockwise[1] * arrow_length + norm_dir[1];
468 inv_norm_dir_clockwise,
469 inv_norm_dir_counterclockwise,
475 if (point !=
nullptr) {
481 inv_norm_dir_clockwise,
482 inv_norm_dir_counterclockwise,
485 stroke_points[4] = corner[0] - norm_dir[0];
486 stroke_points[5] = corner[1] - norm_dir[1];
489 mul_v2_fl(norm_dir, arrow_length * 1.5f);
490 if (point !=
nullptr) {
496 inv_norm_dir_clockwise,
497 inv_norm_dir_counterclockwise,
498 arrow_length * 0.75f,
500 stroke_points[4] = stroke_points[0] - norm_dir[0];
501 stroke_points[5] = stroke_points[1] - norm_dir[1];
502 stroke_points[6] = stroke_points[2] - norm_dir[0];
503 stroke_points[7] = stroke_points[3] - norm_dir[1];
565 const float e_heading[2] = {start[0] - end[0], start[1] - end[1]};
572 const float s_heading[2] = {end[0] - start[0], end[1] - start[1]};
607 for (
int s = 0; s < 3; s++) {
705 const float real_co[2] = {co[co_idx], co[co_idx + 1]};
716 gps->
points = MEM_new_array<bGPDspoint>(gps->
totpoints,
"annotation_stroke_points");
722 const float corner_point[3],
723 const float arrow_points[8])
735 const float arrow_points[8])
745 const float arrow_points[8])
759 const float corner_point[3],
760 const float arrow_points[8])
779 const float arrow_points[8],
782 float corner_conv[3];
846 gps = MEM_new<bGPDstroke>(
"annotation_stroke");
860 gps->
points = MEM_new_array<bGPDspoint>(gps->
totpoints,
"annotation_stroke_points");
960 float *depth_arr =
nullptr;
964 int2 mval_i, mval_prev = {0, 0};
965 int interp_depth = 0;
971 for (i = 0, ptc = gpd->
runtime.
sbuffer; i < gpd->runtime.sbuffer_used; i++, ptc++, pt++) {
975 depths, mval_i, mval_prev, depth_margin + 1, depth_arr + i) == 0)))
986 if (found_depth ==
false) {
990 depth_arr[i] = 0.9999f;
1014 for (i = first_valid + 1; i < last_valid; i++) {
1018 interp_depth =
true;
1030 for (i = 0, ptc = gpd->
runtime.
sbuffer; i < gpd->runtime.sbuffer_used && ptc; i++, ptc++, pt++)
1043 MEM_delete(depth_arr);
1065 MEM_delete(gps->
dvert);
1083 const int mval_i[2] = {
x,
y};
1093 if (depth_pt > depth_mval) {
1122 join_stroke->
points = MEM_new_array<bGPDspoint>(totpoints, __func__);
1131 for (
int i = 0; i < totpoints; i++) {
1132 pt_final = &join_stroke->
points[i];
1133 if (i < gps_last->totpoints) {
1134 pt = &gps_last->
points[e1];
1138 pt = &gps_first->
points[e2];
1146 pt_final->
time = delta;
1155 if ((gps_first->
dvert !=
nullptr) || (gps_last->
dvert !=
nullptr)) {
1163 for (
int i = 0; i < totpoints; i++) {
1164 dvert_dst = &join_stroke->
dvert[i];
1165 dvert_src =
nullptr;
1166 if (i < gps_last->totpoints) {
1167 if (gps_last->
dvert) {
1168 dvert_src = &gps_last->
dvert[e1];
1173 if (gps_first->
dvert) {
1174 dvert_src = &gps_first->
dvert[e2];
1179 if ((dvert_src) && (dvert_src->
dw)) {
1180 dvert_dst->
dw = MEM_dupalloc(dvert_src->
dw);
1205 const bool flat_cap,
1219 "gp_point_islands");
1220 bool in_island =
false;
1221 int num_islands = 0;
1229 for (
int i = 0; i < gps->
totpoints; i++, pt++) {
1230 if (pt->
flag & tag_flags) {
1240 idx = num_islands - 1;
1248 idx = num_islands - 1;
1261 for (idx = 0; idx < num_islands; idx++) {
1269 if ((is_cyclic) && (gps_first ==
nullptr)) {
1270 gps_first = new_stroke;
1280 "gp delete stroke fragment");
1281 memcpy(
static_cast<void *
>(new_stroke->
points),
1286 if (gps->
dvert !=
nullptr) {
1289 "gp delete stroke fragment weight");
1290 memcpy(new_stroke->
dvert,
1296 for (
int i = 0; i < new_stroke->
totpoints; i++) {
1299 if (dvert_src->
dw) {
1300 dvert_dst->
dw = MEM_dupalloc(dvert_src->
dw);
1318 new_stroke->
inittime += double(delta);
1320 pts = new_stroke->
points;
1321 for (j = 0; j < new_stroke->
totpoints; j++, pts++) {
1333 if ((limit > 0) && (new_stroke->
totpoints <= limit)) {
1334 if (gps_first == new_stroke) {
1335 gps_first =
nullptr;
1352 if ((is_cyclic) && (gps_first !=
nullptr) && (gps_first != new_stroke)) {
1371 const float mval[2],
1401 bool do_cull =
false;
1409 for (
int i = 0; i < gps->
totpoints; i++) {
1418 for (
int i = 0; (i + 1) < gps->
totpoints; i++) {
1421 pt2 = gps->
points + i + 1;
1488 for (gps = gpf->
strokes.first(); gps; gps = gpn) {
1527 if (curarea ==
nullptr) {
1601 if (clip ==
nullptr) {
1628 p->
imat[3][0] -= marker->
pos[0];
1629 p->
imat[3][1] -= marker->
pos[1];
1650 if (gpd_ptr ==
nullptr) {
1656 if (*gpd_ptr ==
nullptr) {
1712 p = MEM_new<tGPsdata>(
"Annotation Drawing Data");
1745 if (gpd ==
nullptr) {
1773 Depsgraph *depsgraph)
1783 if (p->
gpl ==
nullptr) {
1805 bool has_layer_to_erase =
false;
1810 has_layer_to_erase =
true;
1817 if (has_layer_to_erase ==
false) {
1819 printf(
"Error: Eraser will not be affecting anything (gpencil_paint_init)\n");
1837 if (p->
gpf ==
nullptr) {
2001 float viewport_size[4];
2003 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
2052 if (totpoints < 2) {
2055 const tGPspoint *pt = &points[totpoints - 1];
2063 const float color[3] = {1.0f, 0.39f, 0.39f};
2067 const float radius = 4.0f;
2177 if (event !=
nullptr) {
2212 status.
item(
IFACE_(
"Place Next Stroke Vertex"), ICON_MOUSE_LMB);
2216 status.
item(
IFACE_(
"Erase"), ICON_MOUSE_LMB);
2262 float last_mouse[2];
2346 if ((dx > 0) || (dy > 0)) {
2384 p->
pressure =
event->tablet.pressure;
2432 mousef[0] = p->
mval[0];
2433 mousef[1] = p->
mval[1];
2473 p->
mval[0] = int(mousef[0]);
2474 p->
mval[1] = int(mousef[1]);
2611 printf(
"\t\t\tGP - wrong area execution abort!\n");
2654 float pt[2], a[2],
b[2];
2655 float factor = 10.0f;
2671 else if (dist >= factor) {
2672 int slices = 2 + int((dist - 1.0) / factor);
2673 float n = 1.0f / slices;
2674 for (
int i = 1; i < slices; i++) {
2823 bool in_bounds =
false;
2833 if (current_region) {
2837 p->
region = current_region;
2908 printf(
"\t\t\t\tGP - add error done!\n");
2923 switch (event->
type) {
2999 "Draw Straight Lines",
3000 "Draw straight line segment(s)"},
3005 "Click to place endpoints of straight line segments (connected)"},
3007 {0,
nullptr, 0,
nullptr,
nullptr},
3015 "ARROW_OPEN_INVERTED",
3018 "Use perpendicular segment style"},
3020 {0,
nullptr, 0,
nullptr,
nullptr},
3028 ot->
name =
"Annotation Draw";
3029 ot->
idname =
"GPENCIL_OT_annotate";
3030 ot->
description =
"Make annotations on the active data";
3048 ot->
srna,
"arrowstyle_start",
arrow_types, 0,
"Start Arrow Style",
"Stroke start style");
3050 ot->
srna,
"arrowstyle_end",
arrow_types, 0,
"End Arrow Style",
"Stroke end style");
3055 "Helper to draw smooth and clean lines. Press Shift for an invert effect "
3056 "(even if this option is not active)");
3058 "stabilizer_factor",
3062 "Stabilizer Stroke Factor",
3063 "Higher values give a smoother stroke",
3067 "stabilizer_radius",
3071 "Stabilizer Stroke Radius",
3072 "Minimum distance from last point before stroke continues",
3086 "Wait for first click instead of painting immediately");
#define GPENCIL_STRENGTH_MIN
Camera data-block and utility functions.
#define ENUM_OPERATORS(_enum_type)
Platform independent time functions.
Read Blender memory allocation and freeing.
#define RNA_BEGIN(sptr, itemptr, propname)
#define MEM_realloc_uninitialized(vmemh, len)
void item(std::string text, int icon1, int icon2=0)
float length(VecOp< float, D >) RET
internal::ShallowDataConstRef< T > shallow_copy(const T &other)
void view2d_region_to_view(const View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
MINLINE float min_ff(float a, float b)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
bool ED_view3d_depth_read_cached_seg(const ViewDepths *vd, const int mval_sta[2], const int mval_end[2], int margin, float *r_depth)
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
void BKE_callback_exec_id_depsgraph(Main *bmain, ID *id, Depsgraph *depsgraph, eCbEvent evt)
static void annotation_stroke_added_enable(tGPsdata *p)
static void annotation_draw_exit(bContext *C, wmOperator *op)
ScrArea * CTX_wm_area(const bContext *C)
static void annotation_stroke_arrow_calc_points_segment(float stroke_points[8], const float ref_point[2], const float dir_cw[2], const float dir_ccw[2], const float length, const float sign)
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
int RNA_enum_get(PointerRNA *ptr, const char *name)
void WM_event_drag_start_mval_fl(const wmEvent *event, const ARegion *region, float r_mval[2])
static void annotation_arrow_create_segm(tGPsdata *p, tGPspoint *ptc, bGPDspoint *pt, const float arrow_points[8])
static void annotation_add_missing_events(bContext *C, wmOperator *op, const wmEvent *event, tGPsdata *p)
static void annotation_draw_status_indicators(bContext *C, tGPsdata *p)
static bool annotation_stroke_added_check(tGPsdata *p)
MINLINE void copy_v2_fl(float r[2], float f)
static bool annotation_area_exists(bContext *C, ScrArea *area_test)
static void annotation_stroke_arrow_calc_points(tGPspoint *point, const float stroke_dir[2], float corner[2], float stroke_points[8], const int arrow_style)
static void annotation_paint_cleanup(tGPsdata *p)
struct bGPDframe * BKE_annotations_layer_frame_get(struct bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode addnew)
MINLINE void copy_v3_v3(float r[3], const float a[3])
int interp_sparse_array(float *array, int list_size, float skipval)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
@ BKE_CB_EVT_ANNOTATION_PRE
@ BKE_CB_EVT_ANNOTATION_POST
static void annotation_session_validatebuffer(tGPsdata *p)
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void ED_view3d_depths_free(ViewDepths *depths)
@ GP_STROKE_USE_ARROW_START
@ GP_STROKE_USE_ARROW_END
void immUniformColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
MINLINE void mul_v2_fl(float r[2], float f)
void immUniform2f(const char *name, float x, float y)
bGPdata ** ED_annotation_data_get_pointers(const bContext *C, PointerRNA *r_ptr)
static bGPDstroke * stroke_delete_tagged_points(bGPdata *gpd, bGPDframe *gpf, bGPDstroke *gps, bGPDstroke *next_stroke, int tag_flags, const bool select, const bool flat_cap, const int limit)
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
MINLINE void copy_v2_v2(float r[2], const float a[2])
MovieTrackingObject * BKE_tracking_object_get_active(const MovieTracking *tracking)
GPUVertFormat * immVertexFormat()
static const EnumPropertyItem arrow_types[]
MINLINE float len_v2v2_int(const int v1[2], const int v2[2])
void BKE_annotations_free_stroke_weights(struct bGPDstroke *gps)
struct bGPDlayer * BKE_annotations_layer_addnew(struct bGPdata *gpd, const char *name, bool setactive, bool add_to_header)
static void annotation_paint_strokeend(tGPsdata *p)
void WM_cursor_modal_set(wmWindow *win, int val)
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
@ OP_IS_MODAL_CURSOR_REGION
void immBegin(GPUPrimType, uint vertex_len)
void BKE_annotation_stroke_geometry_update(struct bGPdata *gpd, struct bGPDstroke *gps)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
static void annotation_arrow_create(tGPsdata *p, tGPspoint *ptc, bGPDspoint *pt, bGPDstroke *arrow_stroke, const float arrow_points[8], const int style)
void GPU_line_smooth(bool enable)
int RNA_int_get(PointerRNA *ptr, const char *name)
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
static void annotation_draw_cursor_set(tGPsdata *p)
wmWindow * CTX_wm_window(const bContext *C)
MINLINE float normalize_v2(float n[2])
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
PropertyRNA * RNA_def_collection_runtime(StructOrFunctionRNA *cont, const char *identifier, StructRNA *type, const char *ui_name, const char *ui_description)
MINLINE int max_ii(int a, int b)
static bool annotation_is_tablet_eraser_active(const wmEvent *event)
const rcti * ED_region_visible_rect(ARegion *region)
void BKE_annotations_free_stroke(struct bGPDstroke *gps)
bool gpencil_stroke_inside_circle(const float mval[2], int rad, int x0, int y0, int x1, int y1)
void ED_region_tag_redraw(ARegion *region)
static void annotation_stroke_arrow_allocate(bGPDstroke *gps, const int totpoints)
struct bGPdata * BKE_annotations_data_addnew(struct Main *bmain, const char name[])
static short annotation_stroke_addpoint(tGPsdata *p, const float mval[2], float pressure, double curtime)
static bool annotation_draw_poll(bContext *C)
static void annotation_draw_apply(wmOperator *op, tGPsdata *p, Depsgraph *depsgraph)
bool ED_gpencil_stroke_can_use_direct(const ScrArea *area, const bGPDstroke *gps)
void GPU_line_width(float width)
static tGPsdata * annotation_session_initpaint(bContext *C)
static bool annotation_stroke_filtermval(tGPsdata *p, const float mval[2], const float pmval[2])
static void annotation_session_free(tGPsdata *p)
static void annotation_arrow_create_square(tGPsdata *p, tGPspoint *ptc, bGPDspoint *pt, const float corner_point[3], const float arrow_points[8])
static void annotation_draw_eraser(bContext *, const int2 &xy, const float2 &, void *p_ptr)
@ GP_STROKE_ARROWSTYLE_SQUARE
@ GP_STROKE_ARROWSTYLE_CLOSED
@ GP_STROKE_ARROWSTYLE_SEGMENT
@ GP_STROKE_ARROWSTYLE_NONE
@ GP_STROKE_ARROWSTYLE_OPEN
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
void imm_draw_circle_wire_2d(uint shdr_pos, float x, float y, float radius, int nsegments)
static void annotation_stroke_arrow_init_conv_point(bGPDspoint *pt, const float point[3])
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
@ GP_TOOL_FLAG_RETAIN_LAST
void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg)
static void annotation_draw_toggle_stabilizer_cursor(tGPsdata *p, short enable)
static void annotation_stroke_newfrombuffer(tGPsdata *p)
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
void immUniform1f(const char *name, float x)
void immVertex2f(uint attr_id, float x, float y)
MINLINE void add_v2_v2(float r[2], const float a[2])
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void GPU_viewport_size_get_f(float coords[4])
void BKE_report(ReportList *reports, eReportType type, const char *message)
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C, bool rna_write_check=false)
@ SEQ_PREVIEW_SHOW_GPENCIL
int ED_space_clip_get_clip_frame_number(const SpaceClip *sc)
rctf BKE_camera_view_border(const struct Scene *scene, const struct Depsgraph *depsgraph, const struct View3D *v3d, const struct RegionView3D *rv3d, int winx, int winy, bool no_shift, bool no_zoom, bool no_roll)
eV3DProjStatus ED_view3d_project_float_global(const ARegion *region, const float co[3], float r_co[2], eV3DProjTest flag)
static void stroke_join_islands(bGPdata *gpd, bGPDframe *gpf, bGPDstroke *gps_first, bGPDstroke *gps_last)
void BLI_freelinkN(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
void WM_cursor_modal_restore(wmWindow *win)
static bool annotation_session_initdata(bContext *C, tGPsdata *p)
void immUniformColor4f(float r, float g, float b, float a)
bool ED_operator_regionactive(bContext *C)
static void annotation_stroke_arrow_init_point_default(bGPDspoint *pt)
void unit_m4(float m[4][4])
float ED_view3d_calc_zfac(const RegionView3D *rv3d, const float co[3])
ToolSettings * CTX_data_tool_settings(const bContext *C)
wmOperatorStatus WM_operator_name_call(bContext *C, const char *opstring, wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)
struct bGPDstroke * BKE_gpencil_stroke_duplicate(struct bGPDstroke *gps_src, bool dup_points, bool dup_curve)
static void annotation_stroke_convertcoords(tGPsdata *p, const float2 mval, float out[3], const float *depth)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
struct bGPDlayer * BKE_annotations_layer_active_get(struct bGPdata *gpd)
MINLINE void zero_v3(float r[3])
void GPENCIL_OT_annotate(wmOperatorType *ot)
bool ED_view3d_autodist_simple(ARegion *region, const int mval[2], float mouse_worldloc[3], int margin, const float *force_depth)
uint GPU_vertformat_attr_add(GPUVertFormat *format, StringRef name, gpu::VertAttrType type)
static void annotation_draw_cancel(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
static void annotation_get_3d_reference(tGPsdata *p, float vec[3])
void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
static void annotation_stroke_eraser_dostroke(tGPsdata *p, bGPDframe *gpf, bGPDstroke *gps, const float mval[2], const int radius, const rcti *rect)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
static void annotation_stroke_end(wmOperator *op)
wmPaintCursor * WM_paint_cursor_activate(short space_type, short region_type, wmPaintCursorPoll poll, wmPaintCursorDraw draw, void *customdata)
static wmOperatorStatus annotation_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event)
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
static void annotation_arrow_create_open(tGPsdata *p, tGPspoint *ptc, bGPDspoint *pt, const float corner_point[3], const float arrow_points[8])
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
void gpencil_point_to_xy(const GP_SpaceConversion *gsc, const bGPDstroke *gps, const bGPDspoint *pt, int *r_x, int *r_y)
static void annotation_stroke_doeraser(tGPsdata *p)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE void madd_v2_v2fl(float r[2], const float a[2], float f)
Main * CTX_data_main(const bContext *C)
static void annotation_smooth_buffer(tGPsdata *p, float inf, int idx)
MovieClip * ED_space_clip_get_clip(const SpaceClip *sc)
bool BKE_annotations_layer_is_editable(const struct bGPDlayer *gpl)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
static void annotation_stroke_arrow_init_point(tGPsdata *p, tGPspoint *ptc, bGPDspoint *pt, const float co[8], const int co_idx)
void interp_v2_v2v2(float r[2], const float a[2], const float b[2], float t)
static void annotation_visible_on_space(tGPsdata *p)
static void annotation_draw_apply_event(wmOperator *op, const wmEvent *event, Depsgraph *depsgraph, float x, float y)
MINLINE float max_ff(float a, float b)
void ED_view3d_depth_override(Depsgraph *depsgraph, ARegion *region, View3D *v3d, Object *obact, eV3DDepthOverrideMode mode, bool use_overlay, ViewDepths **r_depths)
MINLINE float len_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
bool ED_view3d_depth_read_cached(const ViewDepths *vd, const int mval[2], int margin, float *r_depth)
tGPspoint * ED_gpencil_sbuffer_ensure(tGPspoint *buffer_array, int *buffer_size, int *buffer_used, const bool clear)
static tGPsdata * annotation_stroke_begin(bContext *C, wmOperator *op)
static void annotation_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Depsgraph *depsgraph)
@ V3D_DEPTH_SELECTED_ONLY
@ GP_PAINTMODE_DRAW_STRAIGHT
static bool annotation_stroke_eraser_is_occluded(tGPsdata *p, const bGPDspoint *pt, const int x, const int y)
static void annotation_arrow_create_closed(tGPsdata *p, tGPspoint *ptc, bGPDspoint *pt, const float arrow_points[8])
double BLI_time_now_seconds()
Scene * CTX_data_scene(const bContext *C)
static void annotation_session_cleanup(tGPsdata *p)
bScreen * CTX_wm_screen(const bContext *C)
bool BLI_rcti_isect_pt_v(const struct rcti *rect, const int xy[2])
MINLINE void copy_v4_v4(float r[4], const float a[4])
@ GP_PROJECT_DEPTH_STROKE_ENDPOINTS
@ GP_PROJECT_DEPTH_STROKE
@ GP_PROJECT_DEPTH_ONLY_SELECTED
void GPU_blend(GPUBlend blend)
bool BLI_rcti_isect_pt(const struct rcti *rect, int x, int y)
bool ED_view3d_depth_unproject_v3(const ARegion *region, const int mval[2], double depth, float r_location_world[3])
@ GP_PAINTFLAG_SELECTMASK
@ GP_PAINTFLAG_V3D_ERASER_DEPTH
@ GP_PAINTFLAG_STROKEADDED
@ GP_PAINTFLAG_USE_STABILIZER_TEMP
@ GP_PAINTFLAG_USE_STABILIZER
void copy_m4_m4(float m1[4][4], const float m2[4][4])
static void annotation_free_stroke(bGPDframe *gpf, bGPDstroke *gps)
void immUniform1i(const char *name, int x)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
static void annotation_draw_toggle_eraser_cursor(tGPsdata *p, short enable)
static int annotation_draw_init(bContext *C, wmOperator *op, const wmEvent *event)
void immVertex2fv(uint attr_id, const float data[2])
void imm_draw_circle_fill_2d(uint shdr_pos, float x, float y, float radius, int nsegments)
static const EnumPropertyItem prop_gpencil_drawmodes[]
void view3d_region_operator_needs_gpu(ARegion *region)
void RNA_collection_add(PointerRNA *ptr, const char *name, PointerRNA *r_value)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
static wmOperatorStatus annotation_draw_exec(bContext *C, wmOperator *op)
static void annotation_draw_stabilizer(bContext *C, const int2 &xy, const float2 &, void *p_ptr)
ARegion * CTX_wm_region(const bContext *C)
float RNA_float_get(PointerRNA *ptr, const char *name)
void ED_view3d_win_to_delta(const ARegion *region, const float xy_delta[2], float zfac, float r_out[3], bool precise=false)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
static bool annotation_project_check(tGPsdata *p)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
bool WM_paint_cursor_end(wmPaintCursor *handle)
ARegion * BKE_area_find_region_xy(const ScrArea *area, int regiontype, const int xy[2]) ATTR_NONNULL(3)
MovieTrackingMarker * BKE_tracking_marker_get(MovieTrackingTrack *track, int framenr)
float ED_view3d_calc_depth_for_comparison(const RegionView3D *rv3d, const float co[3])
static wmOperatorStatus annotation_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
MovieTrackingTrack * active_track
struct ToolSettings * toolsettings
ListBaseT< SpaceLink > spacedata
eSpaceSeq_SequencerPreviewOverlay_Flag flag
eSpaceClip_GPencil_Source gpencil_src
struct SequencerPreviewOverlay preview_overlay
eSpaceSeq_RegionType mainb
ListBaseT< bGPDstroke > strokes
struct MDeformVert * dvert
eGPDstroke_Flag sbuffer_sflag
eGPDstroke_Arrowstyle arrow_end_style
eGPDstroke_Arrowstyle arrow_start_style
ListBaseT< struct ScrArea > areabase
eGPencil_Placement_Flags * align_flag
eGPencil_PaintFlags flags
eGPencil_PaintStatus status
eGPencil_PaintModes paintmode
wmEventModifierFlag modifier
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
void(*) cancel(bContext *C, wmOperator *op)
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
#define ISMOUSE_BUTTON(event_type)
#define ISMOUSE_MOTION(event_type)
#define ISKEYBOARD(event_type)