Blender V5.0
blender::ed::greasepencil::DrawingPlacement Class Reference

#include <ED_grease_pencil.hh>

Public Member Functions

 DrawingPlacement ()=default
 DrawingPlacement (const Scene &scene, const ARegion &region, const View3D &view3d, const Object &eval_object, const bke::greasepencil::Layer *layer)
 DrawingPlacement (const Scene &scene, const ARegion &region, const View3D &view3d, const Object &eval_object, const bke::greasepencil::Layer *layer, ReprojectMode reproject_mode, float surface_offset=0.0f, ViewDepths *view_depths=nullptr)
 DrawingPlacement (const DrawingPlacement &other)
 DrawingPlacement (DrawingPlacement &&other)
DrawingPlacementoperator= (const DrawingPlacement &other)
DrawingPlacementoperator= (DrawingPlacement &&other)
 ~DrawingPlacement ()
bool use_project_to_surface () const
bool use_project_to_stroke () const
void cache_viewport_depths (Depsgraph *depsgraph, ARegion *region, View3D *view3d)
std::optional< float3project_depth (float2 co) const
float3 project (float2 co, bool &clipped) const
float3 project (float2 co) const
void project (Span< float2 > src, MutableSpan< float3 > dst) const
float3 project_with_shift (float2 co) const
float3 place (float2 co, float depth) const
float3 reproject (float3 pos) const
void reproject (Span< float3 > src, MutableSpan< float3 > dst) const
float4x4 to_world_space () const
std::optional< floatget_depth (float2 co) const

Detailed Description

Definition at line 129 of file ED_grease_pencil.hh.

Constructor & Destructor Documentation

◆ DrawingPlacement() [1/5]

blender::ed::greasepencil::DrawingPlacement::DrawingPlacement ( )
default

◆ DrawingPlacement() [2/5]

blender::ed::greasepencil::DrawingPlacement::DrawingPlacement ( const Scene & scene,
const ARegion & region,
const View3D & view3d,
const Object & eval_object,
const bke::greasepencil::Layer * layer )

◆ DrawingPlacement() [3/5]

◆ DrawingPlacement() [4/5]

blender::ed::greasepencil::DrawingPlacement::DrawingPlacement ( const DrawingPlacement & other)

Definition at line 209 of file grease_pencil_utils.cc.

References ViewDepths::depths, DrawingPlacement(), and MEM_dupallocN().

◆ DrawingPlacement() [5/5]

blender::ed::greasepencil::DrawingPlacement::DrawingPlacement ( DrawingPlacement && other)

Definition at line 233 of file grease_pencil_utils.cc.

References DrawingPlacement().

◆ ~DrawingPlacement()

blender::ed::greasepencil::DrawingPlacement::~DrawingPlacement ( )

Definition at line 274 of file grease_pencil_utils.cc.

References ED_view3d_depths_free().

Member Function Documentation

◆ cache_viewport_depths()

◆ get_depth()

std::optional< float > blender::ed::greasepencil::DrawingPlacement::get_depth ( float2 co) const

Return depth buffer if possible.

Definition at line 332 of file grease_pencil_utils.cc.

References ED_view3d_depth_read_cached().

Referenced by project_depth().

◆ operator=() [1/2]

DrawingPlacement & blender::ed::greasepencil::DrawingPlacement::operator= ( const DrawingPlacement & other)

Definition at line 254 of file grease_pencil_utils.cc.

References DrawingPlacement().

◆ operator=() [2/2]

DrawingPlacement & blender::ed::greasepencil::DrawingPlacement::operator= ( DrawingPlacement && other)

Definition at line 264 of file grease_pencil_utils.cc.

References DrawingPlacement().

◆ place()

float3 blender::ed::greasepencil::DrawingPlacement::place ( float2 co,
float depth ) const

Convert a screen space coordinate with depth to the local drawing space.

Definition at line 405 of file grease_pencil_utils.cc.

References ED_view3d_unproject_v3(), and blender::math::transform_point().

◆ project() [1/3]

float3 blender::ed::greasepencil::DrawingPlacement::project ( float2 co) const

Definition at line 372 of file grease_pencil_utils.cc.

References project().

◆ project() [2/3]

◆ project() [3/3]

void blender::ed::greasepencil::DrawingPlacement::project ( Span< float2 > src,
MutableSpan< float3 > dst ) const

◆ project_depth()

std::optional< float3 > blender::ed::greasepencil::DrawingPlacement::project_depth ( float2 co) const

Attempt to project from the depth buffer.

Returns
Un-projected position if a valid depth is found at the screen position.

Definition at line 315 of file grease_pencil_utils.cc.

References ED_view3d_depth_unproject_v3(), ED_view3d_win_to_vector(), and get_depth().

◆ project_with_shift()

float3 blender::ed::greasepencil::DrawingPlacement::project_with_shift ( float2 co) const

Projects a screen space coordinate to the local drawing space including camera shift.

Definition at line 378 of file grease_pencil_utils.cc.

References ED_view3d_win_to_3d_on_plane(), ED_view3d_win_to_3d_with_shift(), blender::ed::greasepencil::Surface, and blender::math::transform_point().

Referenced by blender::ed::greasepencil::boundary_to_curves().

◆ reproject() [1/2]

◆ reproject() [2/2]

void blender::ed::greasepencil::DrawingPlacement::reproject ( Span< float3 > src,
MutableSpan< float3 > dst ) const

◆ to_world_space()

◆ use_project_to_stroke()

bool blender::ed::greasepencil::DrawingPlacement::use_project_to_stroke ( ) const

◆ use_project_to_surface()

bool blender::ed::greasepencil::DrawingPlacement::use_project_to_surface ( ) const

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