Blender
V3.3
|
Go to the source code of this file.
void BKE_gpencil_convert_curve | ( | struct Main * | bmain, |
struct Scene * | scene, | ||
struct Object * | ob_gp, | ||
struct Object * | ob_cu, | ||
bool | use_collections, | ||
float | scale_thickness, | ||
float | sample | ||
) |
Convert a curve object to grease pencil stroke.
bmain | Main thread pointer |
scene | Original scene. |
ob_gp | Grease pencil object to add strokes. |
ob_cu | Curve to convert. |
use_collections | Create layers using collection names. |
scale_thickness | Scale thickness factor. |
sample | Sample distance, zero to disable. |
Definition at line 464 of file gpencil_curve.c.
References Object::actcol, BKE_gpencil_layer_active_get(), BKE_gpencil_layer_addnew(), BKE_gpencil_layer_frame_get(), BKE_gpencil_layer_named_get(), BKE_gpencil_merge_materials(), BKE_object_material_slot_remove(), BKE_object_material_slot_used(), RenderData::cfra, Object::data, DATA_, DEG_id_tag_update(), ELEM, ListBase::first, GP_GETFRAME_ADD_COPY, gpencil_convert_spline(), gpencil_get_parent_collection(), Collection::id, Object::id, ID_RECALC_COPY_ON_WRITE, ID_RECALC_GEOMETRY, LISTBASE_FOREACH, ID::name, NULL, Curve::nurb, OB_GPENCIL, Scene::r, sample, scene, Object::totcol, and Object::type.
Referenced by object_convert_exec().
void BKE_gpencil_editcurve_recalculate_handles | ( | struct bGPDstroke * | gps | ) |
Recalculate the handles of the edit curve of a grease pencil stroke.
Definition at line 1103 of file gpencil_curve.c.
References bGPDcurve_point::bezt, BKE_nurb_handle_calc(), bGPDcurve::curve_points, bGPDstroke::editcurve, bGPDcurve_point::flag, bGPDstroke::flag, GP_CURVE_POINT_SELECT, GP_STROKE_CYCLIC, GP_STROKE_NEEDS_CURVE_UPDATE, NULL, and bGPDcurve::tot_curve_points.
Referenced by BKE_gpencil_curve_delete_tagged_points(), createTransGPencil_curves(), gpencil_dissolve_selected_curve_points(), gpencil_editcurve_set_handle_type_exec(), gpencil_snap_to_grid(), gpencil_stroke_cyclical_set_exec(), gpencil_stroke_subdivide_exec(), and recalcData_gpencil_strokes().
void BKE_gpencil_editcurve_stroke_sync_selection | ( | struct bGPdata * | gpd, |
struct bGPDstroke * | gps, | ||
struct bGPDcurve * | gpc | ||
) |
Sync the selection from stroke to edit-curve.
Referenced by gpencil_editmode_toggle_exec(), gpencil_stroke_enter_editcurve_mode_exec(), gpencil_stroke_unselect(), and gpencil_strokes_reproject_exec().
void BKE_gpencil_editcurve_subdivide | ( | struct bGPDstroke * | gps, |
int | cuts | ||
) |
Definition at line 1229 of file gpencil_curve.c.
References bGPDcurve_point::bezt, BEZT_SEL_ALL, bGPDcurve::curve_points, bGPDstroke::editcurve, bGPDcurve_point::flag, bGPDstroke::flag, GP_CURVE_POINT_SELECT, GP_STROKE_CYCLIC, gpencil_editcurve_subdivide_count(), gpencil_editcurve_subdivide_curve_segment(), BezTriple::h1, BezTriple::h2, HD_ALIGN, is_cyclic(), MEM_callocN, MEM_freeN, NULL, and bGPDcurve::tot_curve_points.
Referenced by gpencil_stroke_subdivide_exec().
struct bGPDcurve* BKE_gpencil_stroke_editcurve_generate | ( | struct bGPDstroke * | gps, |
float | error_threshold, | ||
float | corner_angle, | ||
float | stroke_radius | ||
) |
Creates a bGPDcurve by doing a cubic curve fitting on the grease pencil stroke points.
Definition at line 615 of file gpencil_curve.c.
References bGPDcurve_point::bezt, BKE_gpencil_stroke_editcurve_new(), bGPDstroke::boundbox_max, bGPDstroke::boundbox_min, COORD_FITTING_INFLUENCE, bGPDcurve::curve_points, bGPDstroke::flag, free(), GP_STROKE_CYCLIC, gpencil_stroke_editcurve_generate_edgecases(), BezTriple::h1, BezTriple::h2, HD_ALIGN, HD_FREE, len_v3v3(), madd_v3_v3v3fl(), MEM_callocN, MEM_freeN, mul_v3_v3fl(), mul_v4_v4fl(), NULL, POINT_DIM, bGPDcurve_point::point_index, bGPDstroke::points, bGPDspoint::pressure, bGPDcurve_point::pressure, r, bGPDspoint::strength, bGPDcurve_point::strength, sub_v3_v3v3(), bGPDstroke::totpoints, BezTriple::vec, bGPDspoint::vert_color, bGPDcurve_point::vert_color, and bGPDspoint::x.
Referenced by BKE_gpencil_stroke_editcurve_update().
void BKE_gpencil_stroke_editcurve_sync_selection | ( | struct bGPdata * | gpd, |
struct bGPDstroke * | gps, | ||
struct bGPDcurve * | gpc | ||
) |
Sync the selection from edit-curve to stroke.
Definition at line 774 of file gpencil_curve.c.
References BKE_gpencil_stroke_select_index_reset(), BKE_gpencil_stroke_select_index_set(), bGPDcurve::curve_points, bGPDspoint::flag, bGPDcurve_point::flag, bGPDcurve::flag, bGPDstroke::flag, GP_CURVE_POINT_SELECT, GP_CURVE_SELECT, GP_SPOINT_SELECT, GP_STROKE_CYCLIC, GP_STROKE_SELECT, point_index, bGPDcurve_point::point_index, bGPDstroke::points, bGPDcurve::tot_curve_points, and bGPDstroke::totpoints.
Referenced by BKE_gpencil_strokes_selected_sync_selection_editcurve().
void BKE_gpencil_stroke_editcurve_update | ( | struct bGPdata * | gpd, |
struct bGPDlayer * | gpl, | ||
struct bGPDstroke * | gps | ||
) |
Updates the edit-curve for a stroke. Frees the old curve if one exists and generates a new one.
Definition at line 726 of file gpencil_curve.c.
References BKE_gpencil_free_stroke_editcurve(), BKE_gpencil_stroke_editcurve_generate(), bGPdata::curve_edit_corner_angle, bGPdata::curve_edit_threshold, bGPDstroke::editcurve, bGPDlayer::line_change, NULL, bGPdata::pixfactor, bGPDstroke::thickness, and bGPDstroke::totpoints.
Referenced by BKE_gpencil_strokes_selected_update_editcurve(), ED_gpencil_select_curve_toggle_all(), gpencil_editmode_toggle_exec(), gpencil_generic_stroke_select(), gpencil_select_exec(), gpencil_stroke_do_circle_sel(), gpencil_stroke_enter_editcurve_mode_exec(), and gpencil_strokes_reproject_exec().
void BKE_gpencil_stroke_update_geometry_from_editcurve | ( | struct bGPDstroke * | gps, |
uint | resolution, | ||
bool | is_adaptive | ||
) |
Recalculate stroke points with the edit-curve of the stroke.
Definition at line 1019 of file gpencil_curve.c.
References bGPDcurve_point::bezt, BKE_gpencil_stroke_select_index_reset(), copy_v3_v3(), copy_v4_v4(), bGPDcurve::curve_points, bGPDstroke::dvert, bGPDstroke::editcurve, bGPDspoint::flag, bGPDstroke::flag, float(), GP_SPOINT_SELECT, GP_STROKE_CYCLIC, GP_STROKE_SELECT, gpencil_stroke_points_from_editcurve_adaptive_resolu(), gpencil_stroke_points_from_editcurve_fixed_resolu(), is_cyclic(), MEM_freeN, MEM_recallocN, NULL, bGPDstroke::points, bGPDspoint::pressure, bGPDcurve_point::pressure, bGPDspoint::strength, bGPDcurve_point::strength, bGPDcurve::tot_curve_points, bGPDstroke::totpoints, BezTriple::vec, bGPDspoint::vert_color, bGPDcurve_point::vert_color, and bGPDspoint::x.
Referenced by BKE_gpencil_stroke_geometry_update().
Definition at line 1349 of file gpencil_curve.c.
References BKE_gpencil_layer_is_editable(), BKE_gpencil_stroke_editcurve_sync_selection(), bool, GP_FRAME_SELECT, GPENCIL_MULTIEDIT_SESSIONS_ON, bGPdata::layers, LISTBASE_FOREACH, bGPDframe::next, and NULL.
Definition at line 1310 of file gpencil_curve.c.
References BKE_gpencil_editcurve_stroke_sync_selection(), BKE_gpencil_layer_is_editable(), BKE_gpencil_stroke_editcurve_update(), BKE_gpencil_stroke_geometry_update(), bool, GP_CURVE_NEEDS_STROKE_UPDATE, GP_FRAME_SELECT, GP_STROKE_NEEDS_CURVE_UPDATE, GP_STROKE_SELECT, GPENCIL_MULTIEDIT_SESSIONS_ON, bGPdata::layers, LISTBASE_FOREACH, bGPDframe::next, and NULL.