Blender
V3.3
|
#include <float.h>
#include <math.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "BLI_sys_types.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLF_api.h"
#include "BLT_translation.h"
#include "DNA_gpencil_types.h"
#include "DNA_object_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.h"
#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "WM_api.h"
#include "GPU_immediate.h"
#include "GPU_matrix.h"
#include "GPU_state.h"
#include "ED_gpencil.h"
#include "ED_screen.h"
#include "ED_space_api.h"
#include "ED_view3d.h"
#include "UI_interface_icons.h"
#include "UI_resources.h"
Go to the source code of this file.
Typedefs | |
typedef enum eDrawStrokeFlags | eDrawStrokeFlags |
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) , 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) , GP_DRAWDATA_VOLUMETRIC = (1 << 7) , GP_DRAWDATA_FILL = (1 << 8) } |
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, struct 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) |
typedef enum eDrawStrokeFlags eDrawStrokeFlags |
enum 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) |
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 onion-skins should be drawn (for animation playback). |
GP_DRAWDATA_VOLUMETRIC | draw strokes as "volumetric" circular billboards |
GP_DRAWDATA_FILL | fill insides/bounded-regions of strokes |
Definition at line 57 of file annotate_draw.c.
|
static |
Definition at line 234 of file annotate_draw.c.
References float(), GP_STROKE_2DIMAGE, GP_STROKE_2DSPACE, x, and y.
Referenced by annotation_draw_stroke_2d(), and annotation_draw_stroke_point().
|
static |
Definition at line 488 of file annotate_draw.c.
References bGPDstroke::flag, GP_DRAWDATA_ONLY3D, GP_DRAWDATA_ONLYI2D, GP_DRAWDATA_ONLYV2D, GP_STROKE_2DIMAGE, GP_STROKE_2DSPACE, GP_STROKE_3DSPACE, NULL, bGPDstroke::points, and bGPDstroke::totpoints.
Referenced by annotation_draw_strokes().
|
static |
Definition at line 718 of file annotate_draw.c.
References annotation_draw_data_layers(), GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_depth_mask(), GPU_depth_mask_get(), and GPU_line_smooth().
Referenced by annotation_draw_data_all().
|
static |
Definition at line 743 of file annotate_draw.c.
References annotation_draw_data(), Scene::clip, MovieClip::gpd, Scene::gpd, NULL, scene, SPACE_CLIP, and SPACE_VIEW3D.
Referenced by ED_annotation_draw_2dimage(), ED_annotation_draw_ex(), ED_annotation_draw_view2d(), and ED_annotation_draw_view3d().
|
static |
Definition at line 660 of file annotate_draw.c.
References annotation_draw_onionskins(), annotation_draw_stroke_buffer(), annotation_draw_strokes(), BKE_gpencil_layer_frame_get(), CLAMP_MIN, copy_v3_v3(), ED_gpencil_session_active(), bGPDframe::flag, GP_DRAWDATA_NO_XRAY, GP_FRAME_PAINT, GP_GETFRAME_USE_PREV, GP_LAYER_ACTIVE, GP_LAYER_HIDE, GP_LAYER_NO_XRAY, GP_LAYER_ONIONSKIN, bGPdata::layers, LISTBASE_FOREACH, NULL, and SET_FLAG_FROM_TEST.
Referenced by annotation_draw_data().
|
static |
Definition at line 588 of file annotate_draw.c.
References annotation_draw_strokes(), color, copy_v3_v3(), float(), bGPDframe::framenum, bGPDlayer::gcolor_next, bGPDlayer::gcolor_prev, bGPDlayer::gstep, bGPDlayer::gstep_next, bGPDframe::next, bGPDframe::prev, and bGPDlayer::thickness.
Referenced by annotation_draw_data_layers().
|
static |
Definition at line 390 of file annotate_draw.c.
References annotation_calc_2d_stroke_fxy(), draw_points(), fabsf, float(), GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_point_size(), GPU_PRIM_LINE_STRIP, GPU_PRIM_POINTS, GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR, GPU_vertformat_attr_add(), GPU_viewport_size_get_f(), immBegin(), immBeginAtMost(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniform1f(), immUniform2fv(), immUniformColor3fvAlpha(), immVertex2fv(), immVertexFormat(), max_ff(), pos, bGPDspoint::pressure, and bGPDspoint::x.
Referenced by annotation_draw_strokes().
|
static |
Draw a given stroke in 3d (i.e. in 3d-space), using simple GPU lines.
Definition at line 306 of file annotate_draw.c.
References copy_v3_v3(), draw_points(), fabsf, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_PRIM_LINE_STRIP, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR, GPU_vertformat_attr_add(), GPU_viewport_size_get_f(), immBeginAtMost(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniform1f(), immUniform2fv(), immUniformColor3fvAlpha(), immVertex3fv(), immVertexFormat(), max_ff(), pos, bGPDspoint::pressure, and bGPDspoint::x.
Referenced by annotation_draw_strokes().
|
static |
Definition at line 76 of file annotate_draw.c.
References GP_STROKE_ARROWSTYLE_CLOSED, GP_STROKE_ARROWSTYLE_OPEN, GP_STROKE_ARROWSTYLE_SEGMENT, GP_STROKE_ARROWSTYLE_SQUARE, GPU_PRIM_LINE_STRIP, immBeginAtMost(), immEnd(), immVertex2f(), and pos.
Referenced by annotation_draw_stroke_buffer().
|
static |
Draw stroke defined in buffer (simple GPU lines/points for now, as dotted lines).
Definition at line 116 of file annotate_draw.c.
References annotation_draw_stroke_arrow_buffer(), bGPdata_Runtime::arrow_end, bGPdata_Runtime::arrow_end_style, bGPdata_Runtime::arrow_start, bGPdata_Runtime::arrow_start_style, copy_v2_v2(), draw_points(), fabsf, GP_DRAWDATA_ONLY3D, GP_DRAWDATA_ONLYV2D, GP_STROKE_ARROWSTYLE_NONE, GP_STROKE_ERASER, GP_STROKE_USE_ARROW_END, GP_STROKE_USE_ARROW_START, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_point_size(), GPU_PRIM_LINE_STRIP, GPU_PRIM_POINTS, GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR, GPU_vertformat_attr_add(), GPU_viewport_size_get_f(), immBegin(), immBeginAtMost(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniform1f(), immUniform2fv(), immUniformColor3fvAlpha(), immVertex2fv(), immVertexFormat(), tGPspoint::m_xy, max_ff(), NULL, pos, tGPspoint::pressure, bGPdata::runtime, bGPdata_Runtime::sbuffer, bGPdata_Runtime::sbuffer_sflag, and bGPdata_Runtime::sbuffer_used.
Referenced by annotation_draw_data_layers().
|
static |
Definition at line 260 of file annotate_draw.c.
References annotation_calc_2d_stroke_fxy(), copy_v3_v3(), GP_STROKE_3DSPACE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_PRIM_POINTS, GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA, GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA, GPU_vertformat_attr_add(), immBegin(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniform1f(), immUniformColor3fvAlpha(), immVertex3fv(), immVertexFormat(), pos, bGPDspoint::pressure, and bGPDspoint::x.
Referenced by annotation_draw_strokes().
|
static |
Definition at line 525 of file annotate_draw.c.
References annotation_can_draw_stroke(), annotation_draw_stroke_2d(), annotation_draw_stroke_3d(), annotation_draw_stroke_point(), color, GP_DRAWDATA_NO_XRAY, GP_DRAWDATA_ONLY3D, GP_STROKE_CYCLIC, GPU_DEPTH_LESS_EQUAL, GPU_DEPTH_NONE, GPU_depth_test(), GPU_polygon_offset(), GPU_program_point_size(), LISTBASE_FOREACH, and bGPDframe::strokes.
Referenced by annotation_draw_data_layers(), and annotation_draw_onionskins().
Definition at line 779 of file annotate_draw.c.
References annotation_draw_data_all(), blender::compositor::area(), C, RenderData::cfra, CTX_data_scene(), CTX_wm_area(), CTX_wm_manager(), CTX_wm_region(), View2D::cur, ED_annotation_data_get_active(), ED_screen_animation_playing(), GP_DRAWDATA_IEDITHACK, GP_DRAWDATA_NO_ONIONS, GP_DRAWDATA_NOSTATUS, GP_DRAWDATA_ONLYI2D, GP_DRAWDATA_ONLYV2D, NULL, Scene::r, scene, SPACE_CLIP, SPACE_IMAGE, SPACE_SEQ, ARegion::v2d, ARegion::winx, ARegion::winy, wmOrtho2(), rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by clip_draw_grease_pencil(), and sequencer_draw_gpencil_overlay().
void ED_annotation_draw_ex | ( | Scene * | scene, |
bGPdata * | gpd, | ||
int | winx, | ||
int | winy, | ||
const int | cfra, | ||
const char | spacetype | ||
) |
Definition at line 936 of file annotate_draw.c.
References annotation_draw_data_all(), GP_DRAWDATA_NOSTATUS, GP_DRAWDATA_ONLYV2D, and scene.
Referenced by screen_opengl_render_doit().
Definition at line 848 of file annotate_draw.c.
References annotation_draw_data_all(), blender::compositor::area(), C, RenderData::cfra, 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, NULL, Scene::r, scene, SPACE_CLIP, SPACE_IMAGE, ARegion::winx, and ARegion::winy.
Referenced by clip_draw_grease_pencil(), DRW_draw_render_loop_2d_ex(), blender::ed::space_node::node_draw_space(), and sequencer_draw_gpencil_overlay().
void ED_annotation_draw_view3d | ( | struct Scene * | scene, |
struct Depsgraph * | depsgraph, | ||
struct View3D * | v3d, | ||
struct 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 884 of file annotate_draw.c.
References annotation_draw_data_all(), RenderData::cfra, depsgraph, ED_view3d_calc_camera_border(), View3D::flag2, G, G_FLAG_RENDER_VIEWPORT, GP_DRAWDATA_NOSTATUS, GP_DRAWDATA_ONLY3D, Scene::gpd, NULL, RegionView3D::persp, Scene::r, ARegion::regiondata, round_fl_to_int(), RV3D_CAMOB, scene, View3D::spacetype, V3D_HIDE_OVERLAYS, ARegion::winx, ARegion::winy, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by DRW_draw_callbacks_post_scene().