39 #include "curve_fit_nd.h"
43 #define COORD_FITTING_INFLUENCE 20.0f
51 const float color_stroke[4],
52 const float color_fill[4],
61 float hsv_stroke[4], hsv_fill[4];
66 hsv_stroke[3] = color_stroke[3];
71 hsv_fill[3] = color_fill[3];
73 bool match_stroke =
false;
74 bool match_fill =
false;
76 for (
int i = 1; i <= ob_gp->
totcol; i++) {
82 if (do_fill && !fill) {
86 if (do_stroke && !stroke) {
121 if (match_stroke || match_fill) {
126 if (!match_stroke || !match_fill) {
137 const float stroke_color[4],
138 const float fill_color[4],
169 const float *coord_array,
170 const float pressure_start,
171 const float pressure_end,
174 const float init_co[3],
179 const float step = 1.0f / ((
float)totpoints - 1.0f);
181 for (
int i = 0; i < totpoints; i++) {
186 if ((last) && (i > 0) && (i == totpoints - 1)) {
207 if ((mycol ==
NULL) && (cob->ob == ob)) {
225 float color_stroke[4] = {0.0f, 0.0f, 0.0f, 0.0f};
226 float color_fill[4] = {0.0f, 0.0f, 0.0f, 0.0f};
231 if (ob_cu->totcol >= 2) {
237 else if (ob_cu->totcol == 1) {
239 if ((mat_curve_stroke) && (strstr(mat_curve_stroke->id.name,
"_stroke") !=
NULL)) {
242 mat_curve_fill =
NULL;
248 mat_curve_fill = mat_curve_stroke;
249 mat_curve_stroke =
NULL;
258 if (mat_curve_stroke) {
259 copy_v4_v4(color_stroke, &mat_curve_stroke->r);
261 if (mat_curve_fill) {
266 ob_gp, color_stroke, color_fill, *do_stroke, *do_fill, &mat_gp);
268 if ((ob_gp->totcol < r_idx) || (r_idx < 0)) {
270 bmain, ob_gp, color_stroke, color_fill, *do_stroke, *do_fill, &r_idx);
290 const float scale_thickness,
300 gps->thickness = 1.0f;
301 gps->fill_opacity_fac = 1.0f;
302 gps->hardeness = 1.0f;
303 gps->uv_scale = 1.0f;
307 gps->inittime = 0.0f;
319 int resolu = nu->
resolu + 1;
320 segments = nu->
pntsu;
325 totpoints = (resolu * segments) - (segments - 1);
330 bool do_stroke, do_fill;
340 float *coord_array =
NULL;
346 gps->totpoints = nu->
pntsu;
349 gps->thickness = 10.0f;
352 for (
int s = 0; s < gps->totpoints; s++) {
363 gps->totpoints = totpoints;
368 segments = nu->
pntsu;
373 for (
int s = 0; s < segments; s++) {
374 int inext = (s + 1) % nu->
pntsu;
377 bool last = (
bool)(s == segments - 1);
379 coord_array =
MEM_callocN((
size_t)3 * resolu *
sizeof(
float), __func__);
381 for (
int j = 0; j < 3; j++) {
395 float radius_start = prevbezt->radius * scale_thickness;
396 float radius_end = bezt->radius * scale_thickness;
399 gps, coord_array, radius_start, radius_end,
init, resolu, init_co, last);
411 if (nu->
pntsv == 1) {
416 nurb_points = nu->
pntsu * resolu;
419 nurb_points = (nu->
pntsu - 1) * resolu;
422 coord_array =
MEM_callocN(
sizeof(
float[3]) * nurb_points, __func__);
426 gps->totpoints = nurb_points;
468 const bool use_collections,
469 const float scale_thickness,
486 if (use_collections) {
488 if (collection !=
NULL) {
516 int actcol = ob_gp->
actcol;
518 for (
int slot = 1; slot <= ob_gp->
totcol; slot++) {
523 if (actcol >= slot) {
543 const float stroke_radius)
557 for (
int j = 0; j < 3; j++) {
586 for (
int i = 0; i < 2; i++) {
592 for (
int j = 0; j < 3; j++) {
616 const float error_threshold,
617 const float corner_angle,
618 const float stroke_radius)
629 for (
int i = 0; i < gps->
totpoints; i++) {
636 points[row + 3] = pt->
pressure / diag_length;
639 points[row + 4] = pt->
strength / diag_length;
643 uint calc_flag = CURVE_FIT_CALC_HIGH_QUALIY;
645 calc_flag |= CURVE_FIT_CALC_CYCLIC;
648 float *r_cubic_array =
NULL;
649 unsigned int r_cubic_array_len = 0;
650 unsigned int *r_cubic_orig_index =
NULL;
651 unsigned int *r_corners_index_array =
NULL;
652 unsigned int r_corners_index_len = 0;
653 int r = curve_fit_cubic_to_points_refit_fl(points,
664 &r_corners_index_array,
665 &r_corners_index_len);
667 if (
r != 0 || r_cubic_array_len < 1) {
675 for (
int i = 0; i < r_cubic_array_len; i++) {
678 float *curve_point = &r_cubic_array[i * curve_point_size];
680 for (
int j = 0; j < 3; j++) {
681 float *bez = &curve_point[j *
POINT_DIM];
685 float *ctrl_point = &curve_point[1 *
POINT_DIM];
686 cpt->
pressure = ctrl_point[3] * diag_length;
687 cpt->
strength = ctrl_point[4] * diag_length;
697 if (r_corners_index_len > 0 && r_corners_index_array !=
NULL) {
698 int start = 0, end = r_corners_index_len;
699 if ((r_corners_index_len > 1) && (calc_flag & CURVE_FIT_CALC_CYCLIC) == 0) {
701 end = r_corners_index_len - 1;
703 for (
int i = start; i < end; i++) {
715 if (r_corners_index_array) {
716 free(r_corners_index_array);
718 if (r_cubic_orig_index) {
719 free(r_cubic_orig_index);
736 float defaultpixsize = 1000.0f / gpd->
pixfactor;
741 if (editcurve ==
NULL) {
817 for (
int i = gpc_last->
point_index + 1; i < gps->totpoints; i++) {
823 for (
int i = gpc_last->
point_index + 1; i < gps->totpoints; i++) {
833 for (
int i = 0; i < gps->
totpoints; i++) {
841 float from,
float to,
float *point_offset,
int it,
int stride)
844 float *
r = point_offset;
845 for (
int i = 0; i <= it; i++) {
846 float fac = (
float)i / (
float)it;
847 fac = 3.0f * fac * fac - 2.0f * fac * fac * fac;
854 float from[4],
float to[4],
float *point_offset,
int it,
int stride)
857 float *
r = point_offset;
858 for (
int i = 0; i <= it; i++) {
859 float fac = (
float)i / (
float)it;
860 fac = 3.0f * fac * fac - 2.0f * fac * fac * fac;
877 return (chord_len + net_len) / 2.0f;
884 for (
uint axis = 0; axis < 3; axis++) {
914 int curve_point_array_len,
921 const uint cpt_last = curve_point_array_len - 1;
922 const uint num_segments = (
is_cyclic) ? curve_point_array_len : curve_point_array_len - 1;
923 int *segment_point_lengths =
MEM_callocN(
sizeof(
int) * num_segments, __func__);
926 for (
int i = 0; i < cpt_last; i++) {
930 int segment_resolu = (int)
floorf(arclen * resolution);
933 segment_point_lengths[i] = segment_resolu;
934 points_len += segment_resolu;
941 int segment_resolu = (int)
floorf(arclen * resolution);
944 segment_point_lengths[cpt_last] = segment_resolu;
945 points_len += segment_resolu;
949 float *points_offset = &r_points[0][0];
951 for (
int i = 0; i < cpt_last; i++) {
954 int segment_resolu = segment_point_lengths[i];
956 cpt_curr, cpt_next, points_offset, segment_resolu,
stride);
967 int segment_resolu = segment_point_lengths[cpt_last];
969 cpt_curr, cpt_next, points_offset, segment_resolu,
stride);
974 *r_points_len = points_len;
975 return (
float(*))r_points;
982 int curve_point_array_len,
989 const uint array_last = curve_point_array_len - 1;
990 const uint resolu_stride = resolution *
stride;
992 curve_point_array_len, resolution,
is_cyclic,
false);
995 float *points_offset = &r_points[0][0];
996 for (
unsigned int i = 0; i < array_last; i++) {
1001 cpt_curr, cpt_next, points_offset, resolution,
stride);
1012 cpt_curr, cpt_next, points_offset, resolution,
stride);
1015 *r_points_len = points_len;
1016 return (
float(*))r_points;
1020 const uint resolution,
1021 const bool adaptive)
1030 if (curve_point_array_len == 0) {
1034 if (curve_point_array_len == 1) {
1065 curve_point_array, curve_point_array_len, resolution,
is_cyclic, &points_len);
1069 curve_point_array, curve_point_array_len, resolution,
is_cyclic, &points_len);
1072 if (points ==
NULL || points_len == 0) {
1084 for (
int i = 0; i < points_len; i++) {
1109 bool changed =
false;
1203 for (
int axis = 0; axis < 3; axis++) {
1204 float p0, p1, p2, p3, m0, m1, q0,
q1,
b;
1205 p0 = bezt_start->
vec[1][axis];
1206 p1 = bezt_start->
vec[2][axis];
1207 p2 = bezt_end->
vec[0][axis];
1208 p3 = bezt_end->
vec[1][axis];
1211 q0 = (p0 + 2 * p1 + p2) / 4;
1212 b = (p0 + 3 * p1 + 3 * p2 + p3) / 8;
1213 q1 = (p1 + 2 * p2 + p3) / 4;
1216 bezt_new->
vec[0][axis] = q0;
1217 bezt_new->
vec[2][axis] =
q1;
1218 bezt_new->
vec[1][axis] =
b;
1220 bezt_start->
vec[2][axis] = m0;
1221 bezt_end->
vec[0][axis] = m1;
1238 for (
int s = 0; s < cuts; s++) {
1241 if (new_num_curve_points == 0) {
1244 int new_tot_curve_points = old_tot_curve_points + new_num_curve_points;
1249 bool prev_subdivided =
false;
1251 for (
int i = 0; i < old_tot_curve_points - 1; i++, j++) {
1267 prev_subdivided =
true;
1270 else if (!prev_subdivided) {
1272 prev_subdivided =
false;
1275 prev_subdivided =
false;
1295 else if (!prev_subdivided) {
1318 bGPDframe *init_gpf = (is_multiedit) ? gpl->frames.first : gpl->actframe;
1320 if ((gpf == gpl->actframe) || ((gpf->flag &
GP_FRAME_SELECT) && is_multiedit)) {
1328 if (gps->editcurve ==
NULL) {
1331 if (gps->editcurve ==
NULL) {
1357 bGPDframe *init_gpf = (is_multiedit) ? gpl->frames.first : gpl->actframe;
1359 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)
unsigned int BKE_curve_calc_coords_axis_len(unsigned int bezt_array_len, unsigned int resolu, bool is_cyclic, 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_nurb_handle_calc(struct BezTriple *bezt, struct BezTriple *prev, struct BezTriple *next, bool is_fcurve, char smoothing)
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)
struct bGPDcurve * BKE_gpencil_stroke_editcurve_new(int tot_curve_points)
void BKE_gpencil_stroke_select_index_reset(struct bGPDstroke *gps)
struct bGPDlayer * BKE_gpencil_layer_addnew(struct bGPdata *gpd, const char *name, bool setactive, bool add_to_header)
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)
bool BKE_gpencil_merge_materials(struct Object *ob, float hue_threshold, float sat_threshold, float val_threshold, int *r_removed)
struct bGPDframe * BKE_gpencil_layer_frame_get(struct bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode addnew)
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, const float sharp_threshold)
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)
struct Material * BKE_object_material_get(struct Object *ob, short act)
bool BKE_object_material_slot_used(struct Object *object, short actcol)
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 copy_v4_v4(float r[4], const float a[4])
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])
MINLINE void mul_v4_v4fl(float r[4], const float a[4], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void interp_v4_v4v4(float r[4], const float a[4], const float b[4], float t)
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE float normalize_v3_length(float r[3], 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)
MINLINE bool compare_v4v4(const float a[4], const float b[4], float limit) ATTR_WARN_UNUSED_RESULT
#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_FILL_STYLE_SOLID
@ GP_MATERIAL_STROKE_STYLE_SOLID
@ GP_MATERIAL_STROKE_SHOW
_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)
static bool is_cyclic(const Nurb *nu)
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)
static int gpencil_check_same_material_color(Object *ob_gp, const float color_stroke[4], const float color_fill[4], const bool do_stroke, const bool do_fill, Material **r_mat)
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 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)
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
T length(const vec_base< T, Size > &a)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
struct MaterialGPencilStyle * gp_style
bGPDcurve_point * curve_points
struct bGPDcurve * editcurve
struct MDeformVert * dvert
float curve_edit_corner_angle
float curve_edit_threshold