Blender V5.0
blender::draw::overlay::GreasePencil Class Reference

#include <overlay_grease_pencil.hh>

Inherits blender::draw::overlay::Overlay.

Public Member Functions

void begin_sync (Resources &res, const State &state) final
void edit_object_sync (Manager &manager, const ObjectRef &ob_ref, Resources &res, const State &state) final
void paint_object_sync (Manager &manager, const ObjectRef &ob_ref, Resources &res, const State &state)
void sculpt_object_sync (Manager &manager, const ObjectRef &ob_ref, Resources &res, const State &state)
void object_sync (Manager &, const ObjectRef &ob_ref, Resources &, const State &state) final
void draw_line (Framebuffer &framebuffer, Manager &manager, View &view) final
void draw_color_only (Framebuffer &framebuffer, Manager &manager, View &view) final

Static Public Member Functions

static void compute_depth_planes (Manager &manager, View &view, Resources &res, const State &)
static void draw_grease_pencil (Resources &res, PassMain::Sub &pass, const Scene *scene, Object *ob, ResourceHandleRange res_handle, select::ID select_id=select::SelectMap::select_invalid_id())

Detailed Description

Draw grease pencil overlays. Also contains grease pencil helper functions for other overlays.

Definition at line 35 of file overlay_grease_pencil.hh.

Member Function Documentation

◆ begin_sync()

void blender::draw::overlay::GreasePencil::begin_sync ( Resources & ,
const State &  )
inlinefinalvirtual

Synchronization creates and fill render passes based on context state and scene state.

It runs for every scene update, so keep computation overhead low. If it is triggered, everything in the scene is considered updated. Note that this only concerns the render passes, the mesh batch caches are updated on a per object-data basis.

IMPORTANT: Synchronization must be view agnostic. That is, not rely on view position, projection matrix or frame-buffer size to do conditional pass creation. This is because, by design, syncing can happen once and rendered multiple time (multi view rendering, stereo rendering, orbiting view ...). Conditional pass creation, must be done in the drawing callbacks, but they should remain the exception. Also there will be no access to object data at this point. Creates passes used for object sync and enabling / disabling internal overlay types (e.g. vertices, edges, faces in edit mode). Runs once at the start of the sync cycle. Should also contain passes setup for overlays that are not per object overlays (e.g. Grid).

This method must be implemented.

Implements blender::draw::overlay::Overlay.

Definition at line 57 of file overlay_grease_pencil.hh.

References CURVE_HANDLE_NONE, DRW_CLIPPING_UBO_SLOT, DRW_STATE_BLEND_ALPHA, DRW_STATE_DEPTH_ALWAYS, DRW_STATE_DEPTH_LESS_EQUAL, DRW_STATE_WRITE_COLOR, DRW_STATE_WRITE_DEPTH, ELEM, blender::draw::overlay::Overlay::enabled_, View3D::gp_flag, GP_PROJECT_DEPTH_STROKE, GP_PROJECT_DEPTH_VIEW, GP_SCULPT_MASK_SELECTMODE_POINT, GP_SCULPT_MASK_SELECTMODE_SEGMENT, GP_SELECTMODE_POINT, GP_SELECTMODE_SEGMENT, GP_VERTEX_MASK_SELECTMODE_POINT, GP_VERTEX_MASK_SELECTMODE_SEGMENT, ToolSettings::gpencil_selectmode_edit, ToolSettings::gpencil_selectmode_sculpt, ToolSettings::gpencil_selectmode_vertex, ToolSettings::gpencil_v3d_align, OB_MODE_EDIT, OB_MODE_PAINT_GREASE_PENCIL, OB_MODE_SCULPT_GREASE_PENCIL, OB_MODE_VERTEX_GREASE_PENCIL, OB_MODE_WEIGHT_GREASE_PENCIL, OVERLAY_GLOBALS_SLOT, state, V3D_GP_SHOW_EDIT_LINES, V3D_GP_SHOW_GRID, V3D_GP_SHOW_GRID_XRAY, V3D_GP_SHOW_MATERIAL_NAME, and V3D_GP_SHOW_STROKE_DIRECTION.

◆ compute_depth_planes()

◆ draw_color_only()

void blender::draw::overlay::GreasePencil::draw_color_only ( Framebuffer & framebuffer,
Manager & manager,
View & view )
inlinefinalvirtual

◆ draw_grease_pencil()

void blender::draw::overlay::GreasePencil::draw_grease_pencil ( Resources & res,
PassMain::Sub & pass,
const Scene * scene,
Object * ob,
ResourceHandleRange res_handle,
select::ID select_id = select::SelectMap::select_invalid_id() )
inlinestatic

◆ draw_line()

void blender::draw::overlay::GreasePencil::draw_line ( Framebuffer & framebuffer,
Manager & manager,
View & view )
inlinefinalvirtual

◆ edit_object_sync()

void blender::draw::overlay::GreasePencil::edit_object_sync ( Manager & ,
const ObjectRef & ,
Resources & ,
const State &  )
inlinefinalvirtual

◆ object_sync()

void blender::draw::overlay::GreasePencil::object_sync ( Manager & ,
const ObjectRef & ,
Resources & ,
const State &  )
inlinefinalvirtual

Fills passes or buffers for each object. Runs for each individual object state. IMPORTANT: Can run only once for instances using the same state (ObjectRef might contains instancing data).

Reimplemented from blender::draw::overlay::Overlay.

Definition at line 238 of file overlay_grease_pencil.hh.

References blender::draw::overlay::Overlay::enabled_, blender::math::from_loc_scale(), GPU_PRIM_LINES, blender::MatBase< T, NumCol, NumRow, Alignment >::location(), state, blender::MatBase< T, NumCol, NumRow, Alignment >::x_axis(), and blender::MatBase< T, NumCol, NumRow, Alignment >::y_axis().

Referenced by blender::draw::overlay::Instance::object_sync().

◆ paint_object_sync()

void blender::draw::overlay::GreasePencil::paint_object_sync ( Manager & manager,
const ObjectRef & ob_ref,
Resources & res,
const State & state )
inline

Definition at line 220 of file overlay_grease_pencil.hh.

References edit_object_sync(), and state.

Referenced by blender::draw::overlay::Instance::object_sync().

◆ sculpt_object_sync()

void blender::draw::overlay::GreasePencil::sculpt_object_sync ( Manager & manager,
const ObjectRef & ob_ref,
Resources & res,
const State & state )
inline

Definition at line 229 of file overlay_grease_pencil.hh.

References edit_object_sync(), and state.

Referenced by blender::draw::overlay::Instance::object_sync().


The documentation for this class was generated from the following file: