55 #include "curve_fit_nd.h"
59 #define COORD_FITTING_INFLUENCE 20.0f
67 const float color_stroke[4],
68 const float color_fill[4],
77 float hsv_stroke[4], hsv_fill[4];
82 hsv_stroke[3] = color_stroke[3];
87 hsv_fill[3] = color_fill[3];
89 bool match_stroke =
false;
90 bool match_fill =
false;
92 for (
int i = 1; i <= ob_gp->
totcol; i++) {
98 if (do_fill && !fill) {
102 if (do_stroke && !stroke) {
137 if (match_stroke || match_fill) {
142 if (!match_stroke || !match_fill) {
153 const float stroke_color[4],
154 const float fill_color[4],
185 const float *coord_array,
186 const float pressure_start,
187 const float pressure_end,
190 const float init_co[3],
195 const float step = 1.0f / ((
float)totpoints - 1.0f);
197 for (
int i = 0; i < totpoints; i++) {
202 if ((last) && (i > 0) && (i == totpoints - 1)) {
223 if ((mycol ==
NULL) && (cob->ob == ob)) {
241 float color_stroke[4] = {0.0f, 0.0f, 0.0f, 0.0f};
242 float color_fill[4] = {0.0f, 0.0f, 0.0f, 0.0f};
247 if (ob_cu->totcol >= 2) {
253 else if (ob_cu->totcol == 1) {
255 if ((mat_curve_stroke) && (strstr(mat_curve_stroke->id.name,
"_stroke") !=
NULL)) {
258 mat_curve_fill =
NULL;
264 mat_curve_fill = mat_curve_stroke;
265 mat_curve_stroke =
NULL;
274 if (mat_curve_stroke) {
275 copy_v4_v4(color_stroke, &mat_curve_stroke->r);
277 if (mat_curve_fill) {
282 ob_gp, color_stroke, color_fill, *do_stroke, *do_fill, &mat_gp);
284 if ((ob_gp->totcol < r_idx) || (r_idx < 0)) {
286 bmain, ob_gp, color_stroke, color_fill, *do_stroke, *do_fill, &r_idx);
306 const float scale_thickness,
316 gps->thickness = 1.0f;
317 gps->fill_opacity_fac = 1.0f;
318 gps->hardeness = 1.0f;
319 gps->uv_scale = 1.0f;
323 gps->inittime = 0.0f;
335 int resolu = nu->
resolu + 1;
336 segments = nu->
pntsu;
341 totpoints = (resolu * segments) - (segments - 1);
346 bool do_stroke, do_fill;
356 float *coord_array =
NULL;
362 gps->totpoints = nu->
pntsu;
365 gps->thickness = 10.0f;
368 for (
int s = 0; s < gps->totpoints; s++) {
379 gps->totpoints = totpoints;
384 segments = nu->
pntsu;
389 for (
int s = 0; s < segments; s++) {
390 int inext = (s + 1) % nu->
pntsu;
393 bool last = (
bool)(s == segments - 1);
395 coord_array =
MEM_callocN((
size_t)3 * resolu *
sizeof(
float), __func__);
397 for (
int j = 0; j < 3; j++) {
411 float radius_start = prevbezt->radius * scale_thickness;
412 float radius_end = bezt->radius * scale_thickness;
415 gps, coord_array, radius_start, radius_end,
init, resolu, init_co, last);
427 if (nu->
pntsv == 1) {
432 nurb_points = nu->
pntsu * resolu;
435 nurb_points = (nu->
pntsu - 1) * resolu;
438 coord_array =
MEM_callocN(
sizeof(
float[3]) * nurb_points, __func__);
442 gps->totpoints = nurb_points;
495 const bool use_collections,
496 const float scale_thickness,
513 if (use_collections) {
515 if (collection !=
NULL) {
543 int actcol = ob_gp->
actcol;
545 for (
int slot = 1; slot <= ob_gp->
totcol; slot++) {
550 if (actcol >= slot) {
570 const float stroke_radius)
581 float offset = (pt->
pressure * stroke_radius) * 2.0f;
584 for (
int j = 0; j < 3; j++) {
587 tmp_vec[0] += (
float)(j - 1) * offset;
609 float offset =
length / 3;
613 for (
int i = 0; i < 2; i++) {
619 for (
int j = 0; j < 3; j++) {
646 const float error_threshold,
647 const float corner_angle,
648 const float stroke_radius)
659 for (
int i = 0; i < gps->
totpoints; i++) {
666 points[row + 3] = pt->
pressure / diag_length;
669 points[row + 4] = pt->
strength / diag_length;
673 uint calc_flag = CURVE_FIT_CALC_HIGH_QUALIY;
675 calc_flag |= CURVE_FIT_CALC_CYCLIC;
678 float *r_cubic_array =
NULL;
679 unsigned int r_cubic_array_len = 0;
680 unsigned int *r_cubic_orig_index =
NULL;
681 unsigned int *r_corners_index_array =
NULL;
682 unsigned int r_corners_index_len = 0;
683 int r = curve_fit_cubic_to_points_refit_fl(points,
694 &r_corners_index_array,
695 &r_corners_index_len);
697 if (
r != 0 || r_cubic_array_len < 1) {
705 for (
int i = 0; i < r_cubic_array_len; i++) {
708 float *curve_point = &r_cubic_array[i * curve_point_size];
710 for (
int j = 0; j < 3; j++) {
711 float *bez = &curve_point[j *
POINT_DIM];
715 float *ctrl_point = &curve_point[1 *
POINT_DIM];
716 cpt->
pressure = ctrl_point[3] * diag_length;
717 cpt->
strength = ctrl_point[4] * diag_length;
727 if (r_corners_index_len > 0 && r_corners_index_array !=
NULL) {
728 int start = 0, end = r_corners_index_len;
729 if ((r_corners_index_len > 1) && (calc_flag & CURVE_FIT_CALC_CYCLIC) == 0) {
731 end = r_corners_index_len - 1;
733 for (
int i = start; i < end; i++) {
745 if (r_corners_index_array) {
746 free(r_corners_index_array);
748 if (r_cubic_orig_index) {
749 free(r_cubic_orig_index);
769 float defaultpixsize = 1000.0f / gpd->
pixfactor;
774 if (editcurve ==
NULL) {
828 for (
int j = gpc_pt->
point_index + 1; j < gpc_pt_next->point_index; j++) {
837 for (
int j = gpc_pt->
point_index + 1; j < gpc_pt_next->point_index; j++) {
856 for (
int i = gpc_last->
point_index + 1; i < gps->totpoints; i++) {
862 for (
int i = gpc_last->
point_index + 1; i < gps->totpoints; i++) {
872 for (
int i = 0; i < gps->
totpoints; i++) {
880 float from,
float to,
float *point_offset,
int it,
int stride)
883 float *
r = point_offset;
884 for (
int i = 0; i <= it; i++) {
885 float fac = (
float)i / (
float)it;
886 fac = 3.0f * fac * fac - 2.0f * fac * fac * fac;
893 float from[4],
float to[4],
float *point_offset,
int it,
int stride)
896 float *
r = point_offset;
897 for (
int i = 0; i <= it; i++) {
898 float fac = (
float)i / (
float)it;
899 fac = 3.0f * fac * fac - 2.0f * fac * fac * fac;
916 return (chord_len + net_len) / 2.0f;
923 for (
uint axis = 0; axis < 3; axis++) {
953 int curve_point_array_len,
960 const uint cpt_last = curve_point_array_len - 1;
961 const uint num_segments = (is_cyclic) ? curve_point_array_len : curve_point_array_len - 1;
962 int *segment_point_lengths =
MEM_callocN(
sizeof(
int) * num_segments, __func__);
965 for (
int i = 0; i < cpt_last; i++) {
969 int segment_resolu = (int)
floorf(arclen * resolution);
972 segment_point_lengths[i] = segment_resolu;
973 points_len += segment_resolu;
980 int segment_resolu = (int)
floorf(arclen * resolution);
983 segment_point_lengths[cpt_last] = segment_resolu;
984 points_len += segment_resolu;
988 float *points_offset = &r_points[0][0];
990 for (
int i = 0; i < cpt_last; i++) {
993 int segment_resolu = segment_point_lengths[i];
995 cpt_curr, cpt_next, points_offset, segment_resolu,
stride);
998 point_index += segment_resolu;
1006 int segment_resolu = segment_point_lengths[cpt_last];
1008 cpt_curr, cpt_next, points_offset, segment_resolu,
stride);
1013 *r_points_len = points_len;
1014 return (
float(*))r_points;
1021 int curve_point_array_len,
1028 const uint array_last = curve_point_array_len - 1;
1029 const uint resolu_stride = resolution *
stride;
1031 curve_point_array_len, resolution, is_cyclic,
false);
1034 float *points_offset = &r_points[0][0];
1035 for (
unsigned int i = 0; i < array_last; i++) {
1040 cpt_curr, cpt_next, points_offset, resolution,
stride);
1051 cpt_curr, cpt_next, points_offset, resolution,
stride);
1054 *r_points_len = points_len;
1055 return (
float(*))r_points;
1062 const uint resolution,
1063 const bool adaptive)
1072 if (curve_point_array_len == 0) {
1076 if (curve_point_array_len == 1) {
1107 curve_point_array, curve_point_array_len, resolution, is_cyclic, &points_len);
1111 curve_point_array, curve_point_array_len, resolution, is_cyclic, &points_len);
1114 if (points ==
NULL || points_len == 0) {
1126 for (
int i = 0; i < points_len; i++) {
1154 bool changed =
false;
1248 for (
int axis = 0; axis < 3; axis++) {
1249 float p0, p1, p2, p3, m0, m1, q0,
q1, b;
1250 p0 = bezt_start->
vec[1][axis];
1251 p1 = bezt_start->
vec[2][axis];
1252 p2 = bezt_end->
vec[0][axis];
1253 p3 = bezt_end->
vec[1][axis];
1256 q0 = (p0 + 2 * p1 + p2) / 4;
1257 b = (p0 + 3 * p1 + 3 * p2 + p3) / 8;
1258 q1 = (p1 + 2 * p2 + p3) / 4;
1261 bezt_new->
vec[0][axis] = q0;
1262 bezt_new->
vec[2][axis] =
q1;
1263 bezt_new->
vec[1][axis] = b;
1265 bezt_start->
vec[2][axis] = m0;
1266 bezt_end->
vec[0][axis] = m1;
1283 for (
int s = 0; s < cuts; s++) {
1286 if (new_num_curve_points == 0) {
1289 int new_tot_curve_points = old_tot_curve_points + new_num_curve_points;
1294 bool prev_subdivided =
false;
1296 for (
int i = 0; i < old_tot_curve_points - 1; i++, j++) {
1312 prev_subdivided =
true;
1315 else if (!prev_subdivided) {
1317 prev_subdivided =
false;
1320 prev_subdivided =
false;
1340 else if (!prev_subdivided) {
1363 bGPDframe *init_gpf = (is_multiedit) ? gpl->frames.first : gpl->actframe;
1365 if ((gpf == gpl->actframe) || ((gpf->flag &
GP_FRAME_SELECT) && is_multiedit)) {
1373 if (gps->editcurve ==
NULL) {
1376 if (gps->editcurve ==
NULL) {
1402 bGPDframe *init_gpf = (is_multiedit) ? gpl->frames.first : gpl->actframe;
1404 if ((gpf == gpl->actframe) || ((gpf->flag &
GP_FRAME_SELECT) && is_multiedit)) {
typedef float(TangentPoint)[2]
#define FOREACH_SCENE_COLLECTION_END
#define FOREACH_SCENE_COLLECTION_BEGIN(scene, _instance)
void BKE_nurb_handle_calc(struct BezTriple *bezt, struct BezTriple *prev, struct BezTriple *next, const bool is_fcurve, const char smoothing)
unsigned int BKE_curve_calc_coords_axis_len(const unsigned int bezt_array_len, const unsigned int resolu, const bool is_cyclic, const bool use_cyclic_duplicate_endpoint)
void BKE_curve_forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride)
void BKE_nurb_makeCurve(const struct Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride)
void BKE_gpencil_stroke_select_index_set(struct bGPdata *gpd, struct bGPDstroke *gps)
struct Material * BKE_gpencil_object_material_new(struct Main *bmain, struct Object *ob, const char *name, int *r_index)
struct bGPDlayer * BKE_gpencil_layer_active_get(struct bGPdata *gpd)
void BKE_gpencil_stroke_select_index_reset(struct bGPDstroke *gps)
struct bGPDcurve * BKE_gpencil_stroke_editcurve_new(const int tot_curve_points)
bool BKE_gpencil_layer_is_editable(const struct bGPDlayer *gpl)
void BKE_gpencil_free_stroke_editcurve(struct bGPDstroke *gps)
struct bGPDlayer * BKE_gpencil_layer_named_get(struct bGPdata *gpd, const char *name)
struct bGPDframe * BKE_gpencil_layer_frame_get(struct bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode addnew)
bool BKE_gpencil_merge_materials(struct Object *ob, const float hue_threshold, const float sat_threshold, const float val_threshold, int *r_removed)
struct bGPDlayer * BKE_gpencil_layer_addnew(struct bGPdata *gpd, const char *name, bool setactive)
void BKE_gpencil_stroke_geometry_update(struct bGPdata *gpd, struct bGPDstroke *gps)
bool BKE_gpencil_stroke_sample(struct bGPdata *gpd, struct bGPDstroke *gps, const float dist, const bool select)
bool BKE_gpencil_stroke_close(struct bGPDstroke *gps)
General operations, lookup, etc. for materials.
bool BKE_object_material_slot_remove(struct Main *bmain, struct Object *ob)
bool BKE_object_material_slot_used(struct ID *id, short actcol)
struct Material * BKE_object_material_get(struct Object *ob, short act)
General operations, lookup, etc. for blender objects.
void BLI_kdtree_nd_() free(KDTree *tree)
#define LISTBASE_FOREACH(type, var, list)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE float interpf(float a, float b, float t)
void rgb_to_hsv_v(const float rgb[3], float r_hsv[3])
MINLINE void mul_v4_v4fl(float r[3], const float a[4], float f)
MINLINE void copy_v4_v4(float r[4], const float a[4])
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], const float t)
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
void interp_v4_v4v4(float r[4], const float a[4], const float b[4], const float t)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE bool compare_v4v4(const float a[4], const float b[4], const float limit) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3_length(float r[3], const float unit_scale)
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE void zero_v3(float r[3])
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
#define ARRAY_SET_ITEMS(...)
#define POINTER_OFFSET(v, ofs)
void DEG_id_tag_update(struct ID *id, int flag)
@ ID_RECALC_COPY_ON_WRITE
Object groups, one object can be in many groups at once.
#define BEZT_SEL_ALL(bezt)
#define BEZT_DESEL_ALL(bezt)
@ GP_CURVE_NEEDS_STROKE_UPDATE
@ GP_STROKE_NEEDS_CURVE_UPDATE
#define GPENCIL_MULTIEDIT_SESSIONS_ON(gpd)
@ GP_MATERIAL_STROKE_SHOW
@ GP_MATERIAL_STROKE_STYLE_SOLID
@ GP_MATERIAL_FILL_STYLE_SOLID
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei stride
Read Guarded memory(de)allocation.
#define MEM_recallocN(vmemh, len)
SIMD_FORCE_INLINE btScalar length(const btQuaternion &q)
Return the length of a quaternion.
void BKE_gpencil_editcurve_subdivide(bGPDstroke *gps, const int cuts)
static void gpencil_editcurve_subdivide_curve_segment(bGPDcurve_point *cpt_start, bGPDcurve_point *cpt_end, bGPDcurve_point *cpt_new)
void BKE_gpencil_strokes_selected_sync_selection_editcurve(bGPdata *gpd)
void BKE_gpencil_stroke_editcurve_sync_selection(bGPdata *gpd, bGPDstroke *gps, bGPDcurve *gpc)
static void gpencil_calculate_stroke_points_curve_segment(bGPDcurve_point *cpt, bGPDcurve_point *cpt_next, float *points_offset, int resolu, int stride)
#define COORD_FITTING_INFLUENCE
void BKE_gpencil_strokes_selected_update_editcurve(bGPdata *gpd)
bGPDcurve * BKE_gpencil_stroke_editcurve_generate(bGPDstroke *gps, const float error_threshold, const float corner_angle, const float stroke_radius)
static float * gpencil_stroke_points_from_editcurve_fixed_resolu(bGPDcurve_point *curve_point_array, int curve_point_array_len, int resolution, bool is_cyclic, int *r_points_len)
static int gpencil_get_stroke_material_fromcurve(Main *bmain, Object *ob_gp, Object *ob_cu, bool *do_stroke, bool *do_fill)
static void gpencil_editstroke_deselect_all(bGPDcurve *gpc)
static int gpencil_check_same_material_color(Object *ob_gp, const float color_stroke[4], const float color_fill[4], const bool do_fill, const bool do_stroke, Material **r_mat)
static void gpencil_add_new_points(bGPDstroke *gps, const float *coord_array, const float pressure_start, const float pressure_end, const int init, const int totpoints, const float init_co[3], const bool last)
static void gpencil_convert_spline(Main *bmain, Object *ob_gp, Object *ob_cu, const float scale_thickness, const float sample, bGPDframe *gpf, Nurb *nu)
void BKE_gpencil_editcurve_recalculate_handles(bGPDstroke *gps)
void BKE_gpencil_convert_curve(Main *bmain, Scene *scene, Object *ob_gp, Object *ob_cu, const bool use_collections, const float scale_thickness, const float sample)
static float * gpencil_stroke_points_from_editcurve_adaptive_resolu(bGPDcurve_point *curve_point_array, int curve_point_array_len, int resolution, bool is_cyclic, int *r_points_len)
static void gpencil_interpolate_v4_from_to(float from[4], float to[4], float *point_offset, int it, int stride)
static void gpencil_interpolate_fl_from_to(float from, float to, float *point_offset, int it, int stride)
static float gpencil_approximate_curve_segment_arclength(bGPDcurve_point *cpt_start, bGPDcurve_point *cpt_end)
static int gpencil_editcurve_subdivide_count(bGPDcurve *gpc, bool is_cyclic)
static Material * gpencil_add_from_curve_material(Main *bmain, Object *ob_gp, const float stroke_color[4], const float fill_color[4], const bool stroke, const bool fill, int *r_idx)
void BKE_gpencil_stroke_editcurve_update(bGPdata *gpd, bGPDlayer *gpl, bGPDstroke *gps)
static bGPDcurve * gpencil_stroke_editcurve_generate_edgecases(bGPDstroke *gps, const float stroke_radius)
void BKE_gpencil_stroke_update_geometry_from_editcurve(bGPDstroke *gps, const uint resolution, const bool adaptive)
static Collection * gpencil_get_parent_collection(Scene *scene, Object *ob)
void BKE_gpencil_editcurve_stroke_sync_selection(bGPdata *UNUSED(gpd), bGPDstroke *gps, bGPDcurve *gpc)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
static void sample(SocketReader *reader, int x, int y, float color[4])
struct MaterialGPencilStyle * gp_style
bGPDcurve_point * curve_points
struct bGPDcurve * editcurve
struct MDeformVert * dvert
float curve_edit_corner_angle
float curve_edit_threshold