|
Blender V5.0
|
#include <cstdlib>#include <cstring>#include "MEM_guardedalloc.h"#include "BLI_math_matrix.h"#include "BLI_math_vector.h"#include "BLI_utildefines.h"#include "DNA_gpencil_legacy_types.h"#include "DNA_material_types.h"#include "DNA_object_types.h"#include "DNA_scene_types.h"#include "DNA_screen_types.h"#include "DNA_space_types.h"#include "DNA_view3d_types.h"#include "BKE_context.hh"#include "BKE_paint.hh"#include "BKE_tracking.h"#include "WM_api.hh"#include "WM_toolsystem.hh"#include "WM_types.hh"#include "RNA_access.hh"#include "RNA_enum_types.hh"#include "RNA_prototypes.hh"#include "UI_view2d.hh"#include "ED_clip.hh"#include "ED_gpencil_legacy.hh"#include "ED_object.hh"#include "ED_select_utils.hh"#include "ED_view3d.hh"#include "DEG_depsgraph_query.hh"#include "gpencil_intern.hh"Go to the source code of this file.
Functions | |
| bGPdata ** | ED_annotation_data_get_pointers_direct (ID *screen_id, ScrArea *area, Scene *scene, PointerRNA *r_ptr) |
| bGPdata ** | ED_annotation_data_get_pointers (const bContext *C, PointerRNA *r_ptr) |
| bGPdata * | ED_annotation_data_get_active_direct (ID *screen_id, ScrArea *area, Scene *scene) |
| bGPdata * | ED_annotation_data_get_active (const bContext *C) |
| bool | gpencil_stroke_inside_circle (const float mval[2], int rad, int x0, int y0, int x1, int y1) |
| bool | ED_gpencil_stroke_can_use_direct (const ScrArea *area, const bGPDstroke *gps) |
| void | gpencil_point_to_xy (const GP_SpaceConversion *gsc, const bGPDstroke *gps, const bGPDspoint *pt, int *r_x, int *r_y) |
| tGPspoint * | ED_gpencil_sbuffer_ensure (tGPspoint *buffer_array, int *buffer_size, int *buffer_used, const bool clear) |
Get the active Grease Pencil data-block
Definition at line 167 of file gpencil_utils.cc.
References C, and ED_annotation_data_get_pointers().
Referenced by annotation_actframe_delete_poll(), ED_annotation_draw_2dimage(), ED_annotation_draw_view2d(), gpencil_actframe_delete_exec(), gpencil_active_layer_annotation_poll(), gpencil_layer_move_exec(), and gpencil_layer_remove_exec().
Get the active Grease Pencil data-block, when context is not available.
Definition at line 161 of file gpencil_utils.cc.
References ED_annotation_data_get_pointers_direct().
Referenced by screen_ctx_active_annotation_layer(), and screen_ctx_annotation_data().
| bGPdata ** ED_annotation_data_get_pointers | ( | const bContext * | C, |
| PointerRNA * | r_ptr ) |
Get pointer to active Grease Pencil data-block, and an RNA-pointer to trace back to whatever owns it.
Definition at line 151 of file gpencil_utils.cc.
References C, CTX_data_scene(), CTX_wm_area(), CTX_wm_screen(), and ED_annotation_data_get_pointers_direct().
Referenced by annotation_draw_poll(), annotation_session_initdata(), ED_annotation_data_get_active(), gpencil_add_annotation_poll(), gpencil_data_add_exec(), gpencil_data_add_poll(), gpencil_data_unlink_exec(), gpencil_data_unlink_poll(), gpencil_layer_add_exec(), and gpencil_layer_remove_exec().
| bGPdata ** ED_annotation_data_get_pointers_direct | ( | ID * | screen_id, |
| ScrArea * | area, | ||
| Scene * | scene, | ||
| PointerRNA * | r_ptr ) |
Get pointer to active Grease Pencil data-block for annotations, and an RNA-pointer to trace back to whatever owns it, when context info is not available.
Definition at line 53 of file gpencil_utils.cc.
References MovieTrackingObject::active_track, BKE_tracking_object_get_active(), ED_space_clip_get_clip(), ListBase::first, bNodeTree::gpd, MovieClip::gpd, MovieTrackingTrack::gpd, Scene::gpd, SpaceImage::gpd, SpaceSeq::gpd, SpaceClip::gpencil_src, bNodeTree::id, MovieClip::id, Scene::id, SpaceNode::nodetree, RNA_id_pointer_create(), RNA_pointer_create_discrete(), SC_GPENCIL_SRC_TRACK, SPACE_CLIP, SPACE_IMAGE, SPACE_INFO, SPACE_NODE, SPACE_PROPERTIES, SPACE_SEQ, SPACE_TOPBAR, SPACE_VIEW3D, ScrArea::spacedata, ScrArea::spacetype, and MovieClip::tracking.
Referenced by ED_annotation_data_get_active_direct(), ED_annotation_data_get_pointers(), and screen_ctx_annotation_data_owner().
| tGPspoint * ED_gpencil_sbuffer_ensure | ( | tGPspoint * | buffer_array, |
| int * | buffer_size, | ||
| int * | buffer_used, | ||
| bool | clear ) |
Ensure the tGPspoint buffer (while drawing stroke) size is enough to save all points of the stroke.
Definition at line 262 of file gpencil_utils.cc.
References clear(), GP_STROKE_BUFFER_CHUNK, MEM_calloc_arrayN(), and MEM_recallocN.
Referenced by annotation_session_validatebuffer(), and annotation_stroke_addpoint().
| bool ED_gpencil_stroke_can_use_direct | ( | const ScrArea * | area, |
| const bGPDstroke * | gps ) |
Check whether given stroke can be edited given the supplied context. TODO: do we need additional flags for screen-space vs data-space?.
Definition at line 193 of file gpencil_utils.cc.
References ELEM, bGPDstroke::flag, GP_STROKE_2DIMAGE, GP_STROKE_2DSPACE, GP_STROKE_3DSPACE, SPACE_IMAGE, SPACE_PROPERTIES, SPACE_VIEW3D, and ScrArea::spacetype.
Referenced by annotation_stroke_doeraser().
| void gpencil_point_to_xy | ( | const GP_SpaceConversion * | gsc, |
| const bGPDstroke * | gps, | ||
| const bGPDspoint * | pt, | ||
| int * | r_x, | ||
| int * | r_y ) |
Convert a Grease Pencil coordinate (i.e. can be 2D or 3D) to screen-space (2D)
| [out] | r_x | The screen-space x-coordinate of the point |
| [out] | r_y | The screen-space y-coordinate of the point |
Definition at line 220 of file gpencil_utils.cc.
References GP_SpaceConversion::area, BLI_assert, BLI_rctf_size_x(), BLI_rctf_size_y(), ED_view3d_project_int_global(), bGPDstroke::flag, GP_STROKE_2DSPACE, GP_STROKE_3DSPACE, GP_SpaceConversion::mat, mul_m4_v3(), GP_SpaceConversion::region, SPACE_VIEW3D, ScrArea::spacetype, GP_SpaceConversion::subrect, UI_view2d_view_to_region_clip(), GP_SpaceConversion::v2d, V2D_IS_CLIPPED, V3D_PROJ_RET_OK, V3D_PROJ_TEST_NOP, ARegion::winx, ARegion::winy, bGPDspoint::x, rctf::xmin, bGPDspoint::y, and rctf::ymin.
Referenced by annotation_stroke_eraser_dostroke().
| bool gpencil_stroke_inside_circle | ( | const float | mval[2], |
| int | rad, | ||
| int | x0, | ||
| int | y0, | ||
| int | x1, | ||
| int | y1 ) |
Check whether a given stroke segment is inside a circular brush
| mval | The current screen-space coordinates (midpoint) of the brush |
| rad | The radius of the brush |
| x0,y0 | The screen-space x and y coordinates of the start of the stroke segment |
| x1,y1 | The screen-space x and y coordinates of the end of the stroke segment |
Definition at line 176 of file gpencil_utils.cc.
References edge_inside_circle(), and float.
Referenced by annotation_stroke_eraser_dostroke().