Blender V4.3
annotate_draw.cc File Reference
#include <cfloat>
#include <cmath>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "MEM_guardedalloc.h"
#include "BLI_sys_types.h"
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
#include "DNA_gpencil_legacy_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_userdef_types.h"
#include "DNA_view3d_types.h"
#include "BKE_context.hh"
#include "BKE_global.hh"
#include "BKE_gpencil_legacy.h"
#include "WM_api.hh"
#include "GPU_immediate.hh"
#include "GPU_matrix.hh"
#include "GPU_state.hh"
#include "ED_gpencil_legacy.hh"
#include "ED_screen.hh"
#include "ED_view3d.hh"
#include "UI_resources.hh"

Go to the source code of this file.

Enumerations

enum  eDrawStrokeFlags {
  GP_DRAWDATA_NOSTATUS = (1 << 0) , GP_DRAWDATA_ONLY3D = (1 << 1) , GP_DRAWDATA_ONLYV2D = (1 << 2) , GP_DRAWDATA_ONLYI2D = (1 << 3) ,
  GP_DRAWDATA_IEDITHACK = (1 << 4) , GP_DRAWDATA_NO_XRAY = (1 << 5) , GP_DRAWDATA_NO_ONIONS = (1 << 6)
}
 

Functions

static void annotation_draw_stroke_arrow_buffer (uint pos, const float *corner_point, const float *arrow_coords, const int arrow_style)
 
static void annotation_draw_stroke_buffer (bGPdata *gps, short thickness, short dflag, const float ink[4])
 
static void annotation_calc_2d_stroke_fxy (const float pt[3], short sflag, int offsx, int offsy, int winx, int winy, float r_co[2])
 
static void annotation_draw_stroke_point (const bGPDspoint *points, short thickness, short sflag, int offsx, int offsy, int winx, int winy, const float ink[4])
 
static void annotation_draw_stroke_3d (const bGPDspoint *points, int totpoints, short thickness, const float ink[4], bool cyclic)
 
static void annotation_draw_stroke_2d (const bGPDspoint *points, int totpoints, short thickness_s, short sflag, int offsx, int offsy, int winx, int winy, const float ink[4])
 
static bool annotation_can_draw_stroke (const bGPDstroke *gps, const int dflag)
 
static void annotation_draw_strokes (const bGPDframe *gpf, int offsx, int offsy, int winx, int winy, int dflag, short lthick, const float color[4])
 
static void annotation_draw_onionskins (bGPDlayer *gpl, bGPDframe *gpf, int offsx, int offsy, int winx, int winy, int dflag)
 
static void annotation_draw_data_layers (bGPdata *gpd, int offsx, int offsy, int winx, int winy, int cfra, int dflag)
 
static void annotation_draw_data (bGPdata *gpd, int offsx, int offsy, int winx, int winy, int cfra, int dflag)
 
static void annotation_draw_data_all (Scene *scene, bGPdata *gpd, int offsx, int offsy, int winx, int winy, int cfra, int dflag, const eSpace_Type space_type)
 
void ED_annotation_draw_2dimage (const bContext *C)
 
void ED_annotation_draw_view2d (const bContext *C, bool onlyv2d)
 
void ED_annotation_draw_view3d (Scene *scene, Depsgraph *depsgraph, View3D *v3d, ARegion *region, bool only3d)
 
void ED_annotation_draw_ex (Scene *scene, bGPdata *gpd, int winx, int winy, const int cfra, const char spacetype)
 

Enumeration Type Documentation

◆ eDrawStrokeFlags

Enumerator
GP_DRAWDATA_NOSTATUS 

don't draw status info

GP_DRAWDATA_ONLY3D 

only draw 3d-strokes

GP_DRAWDATA_ONLYV2D 

only draw 'canvas' strokes

GP_DRAWDATA_ONLYI2D 

only draw 'image' strokes

GP_DRAWDATA_IEDITHACK 

special hack for drawing strokes in Image Editor (weird coordinates)

GP_DRAWDATA_NO_XRAY 

don't draw xray in 3D view (which is default)

GP_DRAWDATA_NO_ONIONS 

no onionskins should be drawn (for animation playback)

Definition at line 51 of file annotate_draw.cc.

Function Documentation

◆ annotation_calc_2d_stroke_fxy()

static void annotation_calc_2d_stroke_fxy ( const float pt[3],
short sflag,
int offsx,
int offsy,
int winx,
int winy,
float r_co[2] )
static

Definition at line 230 of file annotate_draw.cc.

References float, GP_STROKE_2DIMAGE, GP_STROKE_2DSPACE, x, and y.

Referenced by annotation_draw_stroke_2d(), and annotation_draw_stroke_point().

◆ annotation_can_draw_stroke()

static bool annotation_can_draw_stroke ( const bGPDstroke * gps,
const int dflag )
static

◆ annotation_draw_data()

static void annotation_draw_data ( bGPdata * gpd,
int offsx,
int offsy,
int winx,
int winy,
int cfra,
int dflag )
static

◆ annotation_draw_data_all()

static void annotation_draw_data_all ( Scene * scene,
bGPdata * gpd,
int offsx,
int offsy,
int winx,
int winy,
int cfra,
int dflag,
const eSpace_Type space_type )
static

◆ annotation_draw_data_layers()

◆ annotation_draw_onionskins()

◆ annotation_draw_stroke_2d()

◆ annotation_draw_stroke_3d()

static void annotation_draw_stroke_3d ( const bGPDspoint * points,
int totpoints,
short thickness,
const float ink[4],
bool cyclic )
static

◆ annotation_draw_stroke_arrow_buffer()

static void annotation_draw_stroke_arrow_buffer ( uint pos,
const float * corner_point,
const float * arrow_coords,
const int arrow_style )
static

◆ annotation_draw_stroke_buffer()

◆ annotation_draw_stroke_point()

◆ annotation_draw_strokes()

◆ ED_annotation_draw_2dimage()

◆ ED_annotation_draw_ex()

void ED_annotation_draw_ex ( Scene * scene,
bGPdata * gpd,
int winx,
int winy,
const int cfra,
const char spacetype )

◆ ED_annotation_draw_view2d()

void ED_annotation_draw_view2d ( const bContext * C,
bool onlyv2d )

Draw grease-pencil sketches to specified 2d-view assuming that matrices are already set correctly.

Note
This gets called twice - first time with onlyv2d=true to draw 'canvas' strokes, second time with onlyv2d=false for screen-aligned strokes.

Definition at line 854 of file annotate_draw.cc.

References annotation_draw_data_all(), CTX_data_scene(), CTX_wm_area(), CTX_wm_manager(), CTX_wm_region(), ED_annotation_data_get_active(), ED_screen_animation_playing(), ELEM, GP_DRAWDATA_IEDITHACK, GP_DRAWDATA_NO_ONIONS, GP_DRAWDATA_NOSTATUS, GP_DRAWDATA_ONLYV2D, SPACE_CLIP, and SPACE_IMAGE.

Referenced by clip_draw_grease_pencil(), DRW_draw_render_loop_2d_ex(), blender::ed::space_node::node_draw_space(), and sequencer_draw_gpencil_overlay().

◆ ED_annotation_draw_view3d()

void ED_annotation_draw_view3d ( Scene * scene,
Depsgraph * depsgraph,
View3D * v3d,
ARegion * region,
bool only3d )

Draw annotations sketches to specified 3d-view assuming that matrices are already set correctly. NOTE: this gets called twice - first time with only3d=true to draw 3d-strokes, second time with only3d=false for screen-aligned strokes.

Definition at line 897 of file annotate_draw.cc.

References annotation_draw_data_all(), depsgraph, ED_view3d_calc_camera_border(), View3D::flag2, G, G_FLAG_RENDER_VIEWPORT, GP_DRAWDATA_NOSTATUS, GP_DRAWDATA_ONLY3D, RegionView3D::persp, round_fl_to_int(), RV3D_CAMOB, View3D::spacetype, V3D_HIDE_OVERLAYS, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.

Referenced by DRW_draw_callbacks_post_scene().