|
Blender V4.3
|
Go to the source code of this file.
Classes | |
| struct | GPencilPointCoordinates |
Typedefs | |
| typedef struct GPencilPointCoordinates | GPencilPointCoordinates |
Functions | |
| std::optional< blender::Bounds< blender::float3 > > | BKE_gpencil_data_minmax (const struct bGPdata *gpd) |
| bool | BKE_gpencil_stroke_minmax (const struct bGPDstroke *gps, bool use_select, float r_min[3], float r_max[3]) |
| void | BKE_gpencil_centroid_3d (struct bGPdata *gpd, float r_centroid[3]) |
| void | BKE_gpencil_stroke_boundingbox_calc (struct bGPDstroke *gps) |
| void | BKE_gpencil_stroke_normal (const struct bGPDstroke *gps, float r_normal[3]) |
| bool | BKE_gpencil_stroke_trim (struct bGPdata *gpd, struct bGPDstroke *gps) |
| void | BKE_gpencil_stroke_2d_flat (const struct bGPDspoint *points, int totpoints, float(*points2d)[2], int *r_direction) |
| void | BKE_gpencil_stroke_2d_flat_ref (const struct bGPDspoint *ref_points, int ref_totpoints, const struct bGPDspoint *points, int totpoints, float(*points2d)[2], float scale, int *r_direction) |
| void | BKE_gpencil_stroke_fill_triangulate (struct bGPDstroke *gps) |
| void | BKE_gpencil_stroke_geometry_update (struct bGPdata *gpd, struct bGPDstroke *gps) |
| void | BKE_gpencil_stroke_uv_update (struct bGPDstroke *gps) |
| void | BKE_gpencil_transform (struct bGPdata *gpd, const float mat[4][4]) |
| int | BKE_gpencil_stroke_point_count (const struct bGPdata *gpd) |
| void | BKE_gpencil_point_coords_get (struct bGPdata *gpd, GPencilPointCoordinates *elem_data) |
| void | BKE_gpencil_point_coords_apply (struct bGPdata *gpd, const GPencilPointCoordinates *elem_data) |
| void | BKE_gpencil_point_coords_apply_with_mat4 (struct bGPdata *gpd, const GPencilPointCoordinates *elem_data, const float mat[4][4]) |
| bool | BKE_gpencil_stroke_smooth_point (struct bGPDstroke *gps, int point_index, float influence, int iterations, bool smooth_caps, bool keep_shape, struct bGPDstroke *r_gps) |
| bool | BKE_gpencil_stroke_smooth_strength (struct bGPDstroke *gps, int point_index, float influence, int iterations, struct bGPDstroke *r_gps) |
| bool | BKE_gpencil_stroke_smooth_thickness (struct bGPDstroke *gps, int point_index, float influence, int iterations, struct bGPDstroke *r_gps) |
| bool | BKE_gpencil_stroke_smooth_uv (struct bGPDstroke *gps, int point_index, float influence, int iterations, struct bGPDstroke *r_gps) |
| void | BKE_gpencil_stroke_smooth (struct bGPDstroke *gps, const float influence, const int iterations, const bool smooth_position, const bool smooth_strength, const bool smooth_thickness, const bool smooth_uv, const bool keep_shape, const float *weights) |
| bool | BKE_gpencil_stroke_close (struct bGPDstroke *gps) |
| struct bGPDstroke * | BKE_gpencil_stroke_delete_tagged_points (struct bGPdata *gpd, struct bGPDframe *gpf, struct bGPDstroke *gps, struct bGPDstroke *next_stroke, int tag_flags, bool select, bool flat_cap, int limit) |
| void | BKE_gpencil_stroke_flip (struct bGPDstroke *gps) |
| float | BKE_gpencil_stroke_length (const struct bGPDstroke *gps, bool use_3d) |
| float | BKE_gpencil_stroke_segment_length (const struct bGPDstroke *gps, int start_index, int end_index, bool use_3d) |
| void | BKE_gpencil_stroke_set_random_color (struct bGPDstroke *gps) |
| void | BKE_gpencil_stroke_join (struct bGPDstroke *gps_a, struct bGPDstroke *gps_b, bool leave_gaps, bool fit_thickness, bool smooth, bool auto_flip) |
| void | BKE_gpencil_stroke_to_view_space (struct bGPDstroke *gps, float viewmat[4][4], const float diff_mat[4][4]) |
| void | BKE_gpencil_stroke_from_view_space (struct bGPDstroke *gps, float viewinv[4][4], const float diff_mat[4][4]) |
| float | BKE_gpencil_stroke_average_pressure_get (struct bGPDstroke *gps) |
| bool | BKE_gpencil_stroke_is_pressure_constant (struct bGPDstroke *gps) |
| typedef struct GPencilPointCoordinates GPencilPointCoordinates |
Compute center of bounding box.
| gpd | Grease pencil data-block |
| r_centroid | Location of the center |
Definition at line 110 of file gpencil_geom_legacy.cc.
References BKE_gpencil_data_minmax(), bounds(), copy_v3_v3(), and blender::math::midpoint().
Referenced by blender::ed::object::object_origin_set_exec().
| std::optional< blender::Bounds< blender::float3 > > BKE_gpencil_data_minmax | ( | const struct bGPdata * | gpd | ) |
Get min/max bounds of all strokes in grease pencil data-block.
| gpd | Grease pencil data-block |
| r_min | Result minimum coordinates |
| r_max | Result maximum coordinates |
Referenced by BKE_object_boundbox_get().
| void BKE_gpencil_point_coords_apply | ( | struct bGPdata * | gpd, |
| const GPencilPointCoordinates * | elem_data ) |
Definition at line 1141 of file gpencil_geom_legacy.cc.
References BKE_gpencil_stroke_geometry_update(), GPencilPointCoordinates::co, copy_v3_v3(), bGPdata::layers, LISTBASE_FOREACH, bGPDstroke::points, bGPDspoint::pressure, GPencilPointCoordinates::pressure, bGPDstroke::totpoints, and bGPDspoint::x.
Referenced by blender::ed::object::data_xform_restore().
| void BKE_gpencil_point_coords_apply_with_mat4 | ( | struct bGPdata * | gpd, |
| const GPencilPointCoordinates * | elem_data, | ||
| const float | mat[4][4] ) |
Definition at line 1174 of file gpencil_geom_legacy.cc.
References BKE_gpencil_stroke_geometry_update(), GPencilPointCoordinates::co, bGPdata::layers, LISTBASE_FOREACH, mat4_to_scale(), mul_v3_m4v3(), bGPDstroke::points, bGPDspoint::pressure, GPencilPointCoordinates::pressure, bGPDstroke::totpoints, and bGPDspoint::x.
Referenced by blender::ed::object::data_xform_by_mat4().
| void BKE_gpencil_point_coords_get | ( | struct bGPdata * | gpd, |
| GPencilPointCoordinates * | elem_data ) |
Definition at line 1111 of file gpencil_geom_legacy.cc.
References GPencilPointCoordinates::co, copy_v3_v3(), bGPdata::layers, LISTBASE_FOREACH, bGPDstroke::points, bGPDspoint::pressure, GPencilPointCoordinates::pressure, bGPDstroke::totpoints, and bGPDspoint::x.
Referenced by blender::ed::object::data_xform_create_ex().
| void BKE_gpencil_stroke_2d_flat | ( | const struct bGPDspoint * | points, |
| int | totpoints, | ||
| float(*) | points2d[2], | ||
| int * | r_direction ) |
Get points of stroke always flat to view not affected by camera view or view position.
| points | Array of grease pencil points (3D) |
| totpoints | Total of points |
| points2d | Result array of 2D points |
| r_direction | Return Concave (-1), Convex (1), or Auto-detect (0) |
| void BKE_gpencil_stroke_2d_flat_ref | ( | const struct bGPDspoint * | ref_points, |
| int | ref_totpoints, | ||
| const struct bGPDspoint * | points, | ||
| int | totpoints, | ||
| float(*) | points2d[2], | ||
| float | scale, | ||
| int * | r_direction ) |
Get points of stroke always flat to view not affected by camera view or view position using another stroke as reference.
| ref_points | Array of reference points (3D) |
| ref_totpoints | Total reference points |
| points | Array of points to flat (3D) |
| totpoints | Total points |
| points2d | Result array of 2D points |
| scale | Scale factor |
| r_direction | Return Concave (-1), Convex (1), or Auto-detect (0) |
| float BKE_gpencil_stroke_average_pressure_get | ( | struct bGPDstroke * | gps | ) |
Get average pressure.
Definition at line 1714 of file gpencil_geom_legacy.cc.
References float, bGPDstroke::points, bGPDspoint::pressure, and bGPDstroke::totpoints.
| void BKE_gpencil_stroke_boundingbox_calc | ( | struct bGPDstroke * | gps | ) |
Compute stroke bounding box.
| gps | Grease pencil Stroke |
Definition at line 117 of file gpencil_geom_legacy.cc.
References BKE_gpencil_stroke_minmax(), bGPDstroke::boundbox_max, bGPDstroke::boundbox_min, and INIT_MINMAX.
Referenced by BKE_gpencil_stroke_geometry_update().
| bool BKE_gpencil_stroke_close | ( | struct bGPDstroke * | gps | ) |
Close grease pencil stroke.
| gps | Stroke to close |
Definition at line 925 of file gpencil_geom_legacy.cc.
References BKE_defvert_ensure_index(), bGPDstroke::dvert, MDeformVert::dw, bGPDspoint::flag, bGPDstroke::flag, float, GP_SPOINT_SELECT, GP_STROKE_CYCLIC, GP_STROKE_SELECT, interp_v3_v3v3(), interp_v4_v4v4(), interpf(), len_v3v3(), MEM_recallocN, bGPDstroke::points, bGPDspoint::pressure, bGPDspoint::strength, bGPDstroke::totpoints, MDeformVert::totweight, bGPDspoint::vert_color, MDeformWeight::weight, and bGPDspoint::x.
| struct bGPDstroke * BKE_gpencil_stroke_delete_tagged_points | ( | struct bGPdata * | gpd, |
| struct bGPDframe * | gpf, | ||
| struct bGPDstroke * | gps, | ||
| struct bGPDstroke * | next_stroke, | ||
| int | tag_flags, | ||
| bool | select, | ||
| bool | flat_cap, | ||
| int | limit ) |
Split the given stroke into several new strokes, partitioning it based on whether the stroke points have a particular flag is set (e.g. GP_SPOINT_SELECT in most cases, but not always).
Definition at line 1334 of file gpencil_geom_legacy.cc.
References BKE_gpencil_free_stroke(), BKE_gpencil_stroke_duplicate(), BKE_gpencil_stroke_geometry_update(), BLI_addtail(), BLI_insertlinkbefore(), BLI_remlink(), bGPDstroke::caps, double(), bGPDstroke::dvert, MDeformVert::dw, e, tGPDeleteIsland::end_idx, bGPDspoint::flag, bGPDstroke::flag, GP_SPOINT_TAG, GP_STROKE_CAP_FLAT, GP_STROKE_CYCLIC, gpencil_stroke_join_islands(), bGPDstroke::inittime, is_cyclic(), max_ff(), MEM_callocN, MEM_dupallocN, MEM_freeN(), bGPDstroke::points, select(), tGPDeleteIsland::start_idx, bGPDframe::strokes, bGPDspoint::time, and bGPDstroke::totpoints.
Referenced by annotation_stroke_eraser_dostroke().
| void BKE_gpencil_stroke_fill_triangulate | ( | struct bGPDstroke * | gps | ) |
Triangulate stroke to generate data for filling areas.
| gps | Grease pencil stroke |
Definition at line 691 of file gpencil_geom_legacy.cc.
References ARRAY_SET_ITEMS, BKE_gpencil_stroke_2d_flat(), BLI_assert, BLI_polyfill_calc(), copy_v2_v2(), float, gpencil_calc_stroke_fill_uv(), MEM_callocN, MEM_freeN(), MEM_mallocN, MEM_SAFE_FREE, bGPDstroke::points, bGPDstroke::tot_triangles, bGPDstroke::totpoints, bGPDstroke::triangles, bGPDspoint::uv_fill, and bGPDtriangle::verts.
Referenced by BKE_gpencil_stroke_geometry_update().
| void BKE_gpencil_stroke_flip | ( | struct bGPDstroke * | gps | ) |
Flip stroke.
Definition at line 1225 of file gpencil_geom_legacy.cc.
References BLI_array_reverse, bGPDstroke::dvert, bGPDstroke::points, and bGPDstroke::totpoints.
Referenced by BKE_gpencil_stroke_join().
| void BKE_gpencil_stroke_from_view_space | ( | struct bGPDstroke * | gps, |
| float | viewinv[4][4], | ||
| const float | diff_mat[4][4] ) |
Stroke from view space Transforms a stroke from view space back to world space. Inverse of BKE_gpencil_stroke_to_view_space
Definition at line 1698 of file gpencil_geom_legacy.cc.
References invert_m4_m4(), mul_m4_v3(), mul_v3_m4v3(), bGPDstroke::points, bGPDstroke::totpoints, and bGPDspoint::x.
| void BKE_gpencil_stroke_geometry_update | ( | struct bGPdata * | gpd, |
| struct bGPDstroke * | gps ) |
Recalc all internal geometry data for the stroke
| gpd | Grease pencil data-block |
| gps | Grease pencil stroke |
Definition at line 765 of file gpencil_geom_legacy.cc.
References BKE_gpencil_stroke_boundingbox_calc(), BKE_gpencil_stroke_fill_triangulate(), BKE_gpencil_stroke_uv_update(), MEM_SAFE_FREE, bGPDstroke::tot_triangles, bGPDstroke::totpoints, and bGPDstroke::triangles.
Referenced by BKE_gpencil_point_coords_apply(), BKE_gpencil_point_coords_apply_with_mat4(), BKE_gpencil_stroke_delete_tagged_points(), BKE_gpencil_stroke_trim(), BKE_gpencil_transform(), blo_do_versions_280(), gpencil_stroke_join_islands(), blender::ed::object::object_origin_set_exec(), and recalcData_gpencil_strokes().
| bool BKE_gpencil_stroke_is_pressure_constant | ( | struct bGPDstroke * | gps | ) |
Check if the thickness of the stroke is constant.
Definition at line 1730 of file gpencil_geom_legacy.cc.
References bGPDstroke::points, bGPDspoint::pressure, and bGPDstroke::totpoints.
| void BKE_gpencil_stroke_join | ( | struct bGPDstroke * | gps_a, |
| struct bGPDstroke * | gps_b, | ||
| bool | leave_gaps, | ||
| bool | fit_thickness, | ||
| bool | smooth, | ||
| bool | auto_flip ) |
Join two strokes using the shortest distance (reorder stroke if necessary).
| auto_flip | Flip the stroke if the join between two strokes is not end->start points. |
Definition at line 1552 of file gpencil_geom_legacy.cc.
References BKE_gpencil_stroke_flip(), BKE_gpencil_stroke_smooth_point(), copy_v3_v3(), bGPDstroke::dvert, ELEM, float, gpencil_stroke_copy_point(), len, len_squared_v3v3(), point, bGPDstroke::points, bGPDspoint::pressure, bGPDspoint::strength, bGPDstroke::thickness, bGPDstroke::totpoints, and bGPDspoint::x.
| float BKE_gpencil_stroke_length | ( | const struct bGPDstroke * | gps, |
| bool | use_3d ) |
Calculate grease pencil stroke length.
| gps | Grease pencil stroke. |
| use_3d | Set to true to use 3D points. |
| bool BKE_gpencil_stroke_minmax | ( | const struct bGPDstroke * | gps, |
| bool | use_select, | ||
| float | r_min[3], | ||
| float | r_max[3] ) |
Get min/max coordinate bounds for single stroke.
| gps | Grease pencil stroke |
| use_select | Include only selected points |
| r_min | Result minimum coordinates |
| r_max | Result maximum coordinates |
| void BKE_gpencil_stroke_normal | ( | const struct bGPDstroke * | gps, |
| float | r_normal[3] ) |
Calculate stroke normals.
| gps | Grease pencil stroke |
| r_normal | Return Normal vector normalized |
Referenced by blender::ed::object::data_xform_create_ex().
| float BKE_gpencil_stroke_segment_length | ( | const struct bGPDstroke * | gps, |
| int | start_index, | ||
| int | end_index, | ||
| bool | use_3d ) |
Calculate grease pencil stroke length between points.
| void BKE_gpencil_stroke_set_random_color | ( | struct bGPDstroke * | gps | ) |
Set a random color to stroke using vertex color.
| gps | Stroke |
Definition at line 1210 of file gpencil_geom_legacy.cc.
References BLI_assert, BLI_hash_int_01(), BLI_hash_int_2d(), copy_v4_v4(), bGPDstroke::points, bGPDstroke::totpoints, bGPDspoint::vert_color, bGPDspoint::x, bGPDspoint::y, and bGPDspoint::z.
| void BKE_gpencil_stroke_smooth | ( | struct bGPDstroke * | gps, |
| const float | influence, | ||
| const int | iterations, | ||
| const bool | smooth_position, | ||
| const bool | smooth_strength, | ||
| const bool | smooth_thickness, | ||
| const bool | smooth_uv, | ||
| const bool | keep_shape, | ||
| const float * | weights ) |
Apply smooth operation to the stroke.
| gps | Stroke to smooth |
| influence | The interpolation factor for the smooth and the original stroke |
| iterations | Radius of points to consider, equivalent to iterations |
| smooth_position | Smooth point locations |
| smooth_strength | Smooth point strength |
| smooth_thickness | Smooth point thickness |
| smooth_uv | Smooth uv rotation/factor |
| keep_shape | Use different distribution for smooth locations to keep the shape |
| weights | per point weights to multiply influence with (optional, can be null) |
Definition at line 438 of file gpencil_geom_legacy.cc.
References BKE_gpencil_stroke_smooth_point(), BKE_gpencil_stroke_smooth_strength(), BKE_gpencil_stroke_smooth_thickness(), BKE_gpencil_stroke_smooth_uv(), MEM_dupallocN, MEM_freeN(), bGPDstroke::points, and bGPDstroke::totpoints.
| bool BKE_gpencil_stroke_smooth_point | ( | struct bGPDstroke * | gps, |
| int | point_index, | ||
| float | influence, | ||
| int | iterations, | ||
| bool | smooth_caps, | ||
| bool | keep_shape, | ||
| struct bGPDstroke * | r_gps ) |
Apply smooth position to stroke point.
| gps | Stroke to smooth |
| i | Point index |
| inf | Amount of smoothing to apply |
| iterations | Radius of points to consider, equivalent to iterations |
| smooth_caps | Apply smooth to stroke extremes |
| keep_shape | Smooth out fine details first |
| r_gps | Stroke to put the result into |
Definition at line 129 of file gpencil_geom_legacy.cc.
References add_v3_v3(), copy_v3_v3(), double(), ELEM, exp(), bGPDstroke::flag, float, GP_STROKE_CYCLIC, interp_v3_v3v3(), is_cyclic(), M_SQRT3, madd_v3_v3fl(), mul_v3_fl(), bGPDstroke::points, sub_v3_v3v3(), bGPDstroke::totpoints, w(), and bGPDspoint::x.
Referenced by BKE_gpencil_stroke_join(), and BKE_gpencil_stroke_smooth().
| bool BKE_gpencil_stroke_smooth_strength | ( | struct bGPDstroke * | gps, |
| int | point_index, | ||
| float | influence, | ||
| int | iterations, | ||
| struct bGPDstroke * | r_gps ) |
Apply smooth strength to stroke point.
| gps | Stroke to smooth |
| point_index | Point index |
| influence | Amount of smoothing to apply |
| iterations | Radius of points to consider, equivalent to iterations |
| r_gps | Stroke to put the result into |
Definition at line 251 of file gpencil_geom_legacy.cc.
References CLAMP_MAX, CLAMP_MIN, bGPDstroke::flag, float, GP_STROKE_CYCLIC, is_cyclic(), bGPDstroke::points, bGPDspoint::strength, bGPDstroke::totpoints, and w().
Referenced by BKE_gpencil_stroke_smooth().
| bool BKE_gpencil_stroke_smooth_thickness | ( | struct bGPDstroke * | gps, |
| int | point_index, | ||
| float | influence, | ||
| int | iterations, | ||
| struct bGPDstroke * | r_gps ) |
Apply smooth for thickness to stroke point (use pressure).
| gps | Stroke to smooth |
| point_index | Point index |
| influence | Amount of smoothing to apply |
| iterations | Radius of points to consider, equivalent to iterations |
| r_gps | Stroke to put the result into |
Definition at line 309 of file gpencil_geom_legacy.cc.
References CLAMP_MAX, CLAMP_MIN, bGPDstroke::flag, float, GP_STROKE_CYCLIC, is_cyclic(), bGPDstroke::points, bGPDspoint::pressure, bGPDstroke::totpoints, and w().
Referenced by BKE_gpencil_stroke_smooth().
| bool BKE_gpencil_stroke_smooth_uv | ( | struct bGPDstroke * | gps, |
| int | point_index, | ||
| float | influence, | ||
| int | iterations, | ||
| struct bGPDstroke * | r_gps ) |
Apply smooth for UV rotation/factor to stroke point.
| gps | Stroke to smooth |
| point_index | Point index |
| influence | Amount of smoothing to apply |
| iterations | Radius of points to consider, equivalent to iterations |
| r_gps | Stroke to put the result into |
Definition at line 367 of file gpencil_geom_legacy.cc.
References ELEM, bGPDstroke::flag, float, GP_STROKE_CYCLIC, is_cyclic(), bGPDstroke::points, bGPDstroke::totpoints, bGPDspoint::uv_fac, bGPDspoint::uv_rot, and w().
Referenced by BKE_gpencil_stroke_smooth().
| void BKE_gpencil_stroke_to_view_space | ( | struct bGPDstroke * | gps, |
| float | viewmat[4][4], | ||
| const float | diff_mat[4][4] ) |
Stroke to view space Transforms a stroke to view space. This allows for manipulations in 2D but also easy conversion back to 3D.
Definition at line 1685 of file gpencil_geom_legacy.cc.
References mul_m4_v3(), mul_v3_m4v3(), bGPDstroke::points, bGPDstroke::totpoints, and bGPDspoint::x.
| bool BKE_gpencil_stroke_trim | ( | struct bGPdata * | gpd, |
| struct bGPDstroke * | gps ) |
Trim stroke to the first intersection or loop.
| gps | Stroke data |
Definition at line 833 of file gpencil_geom_legacy.cc.
References b, BKE_gpencil_stroke_geometry_update(), closest_to_line_v3(), copy_v3_v3(), bGPDstroke::dvert, MDeformVert::dw, ELEM, intersect(), isect_line_line_v3(), len_v3(), MEM_dupallocN, MEM_recallocN, MEM_SAFE_FREE, bGPDstroke::points, bGPDstroke::totpoints, and bGPDspoint::x.
| void BKE_gpencil_stroke_uv_update | ( | struct bGPDstroke * | gps | ) |
Update Stroke UV data.
| gps | Grease pencil stroke |
Definition at line 750 of file gpencil_geom_legacy.cc.
References len_v3v3(), bGPDstroke::points, bGPDstroke::totpoints, and bGPDspoint::uv_fac.
Referenced by BKE_gpencil_stroke_geometry_update().
Apply grease pencil Transforms.
| gpd | Grease pencil data-block |
| mat | Transformation matrix |
Definition at line 1052 of file gpencil_geom_legacy.cc.
References BKE_gpencil_stroke_geometry_update(), bGPdata::layers, LISTBASE_FOREACH, mat4_to_scale(), mul_m4_v3(), bGPDstroke::points, bGPDspoint::pressure, bGPDstroke::totpoints, and bGPDspoint::x.
Referenced by blender::ed::object::apply_objects_internal().