|
Blender V4.3
|
#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) |
| 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) |
Definition at line 51 of file annotate_draw.cc.
|
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().
|
static |
Definition at line 484 of file annotate_draw.cc.
References bGPDstroke::flag, GP_DRAWDATA_ONLY3D, GP_DRAWDATA_ONLYI2D, GP_DRAWDATA_ONLYV2D, GP_STROKE_2DIMAGE, GP_STROKE_2DSPACE, GP_STROKE_3DSPACE, bGPDstroke::points, and bGPDstroke::totpoints.
Referenced by annotation_draw_strokes().
|
static |
Definition at line 724 of file annotate_draw.cc.
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 749 of file annotate_draw.cc.
References annotation_draw_data(), 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 666 of file annotate_draw.cc.
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, and SET_FLAG_FROM_TEST.
Referenced by annotation_draw_data().
|
static |
Definition at line 584 of file annotate_draw.cc.
References annotation_draw_strokes(), copy_v3_v3(), float, bGPDframe::framenum, bGPDlayer::gcolor_next, bGPDlayer::gcolor_prev, GP_LAYER_ONIONSKIN_CUSTOM_COLOR, bGPDlayer::gstep, bGPDlayer::gstep_next, bGPDframe::next, bGPDlayer::onion_flag, bGPDframe::prev, TH_FRAME_AFTER, TH_FRAME_BEFORE, bGPDlayer::thickness, and UI_GetThemeColor3fv().
Referenced by annotation_draw_data_layers().
|
static |
Definition at line 386 of file annotate_draw.cc.
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 302 of file annotate_draw.cc.
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 70 of file annotate_draw.cc.
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 110 of file annotate_draw.cc.
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(), 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 256 of file annotate_draw.cc.
References annotation_calc_2d_stroke_fxy(), copy_v3_v3(), GP_STROKE_3DSPACE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_PRIM_POINTS, 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 521 of file annotate_draw.cc.
References annotation_can_draw_stroke(), annotation_draw_stroke_2d(), annotation_draw_stroke_3d(), annotation_draw_stroke_point(), 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().
| void ED_annotation_draw_2dimage | ( | const bContext * | C | ) |
Draw grease-pencil sketches to specified 2d-view that uses ibuf corrections.
Definition at line 785 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(), GP_DRAWDATA_IEDITHACK, GP_DRAWDATA_NO_ONIONS, GP_DRAWDATA_NOSTATUS, GP_DRAWDATA_ONLYI2D, GP_DRAWDATA_ONLYV2D, SPACE_CLIP, SPACE_IMAGE, SPACE_SEQ, and wmOrtho2().
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 949 of file annotate_draw.cc.
References annotation_draw_data_all(), GP_DRAWDATA_NOSTATUS, and GP_DRAWDATA_ONLYV2D.
Referenced by screen_opengl_render_doit().
| 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.
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().
| 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().