65 const Object *ob_curve,
float co[3],
const short axis,
const CurveDeform *cd,
float r_quat[4])
67 const Curve *cu = id_cast<const Curve *>(ob_curve->
data);
68 float fac, loc[4], dir[3], new_quat[4], radius;
70 const bool is_neg_axis = (axis > 2);
128 float quat[4], cent[3];
134 float dir_flat[3] = {0, 0, 0}, q[4];
201 float (*vert_coords)[3],
202 const int vert_coords_len,
204 const int defgrp_index,
207 const BMesh *bm_target)
213 const bool is_neg_axis = (defaxis > 2);
215 bool use_dverts =
false;
222 cu = id_cast<Curve *>(ob_curve->
data);
228 if (is_neg_axis ==
false) {
246 if (cd_dvert_offset != -1) {
251 if (dvert !=
nullptr) {
259#define DEFORM_OP(dvert) \
261 const float weight = invert_vgroup ? 1.0f - BKE_defvert_find_weight(dvert, defgrp_index) : \
262 BKE_defvert_find_weight(dvert, defgrp_index); \
263 if (weight > 0.0f) { \
265 mul_m4_v3(cd.curvespace, vert_coords[a]); \
266 copy_v3_v3(vec, vert_coords[a]); \
267 calc_curve_deform(ob_curve, vec, defaxis, &cd, nullptr); \
268 interp_v3_v3v3(vert_coords[a], vert_coords[a], vec, weight); \
269 mul_m4_v3(cd.objectspace, vert_coords[a]); \
283 for (a = 0; a < vert_coords_len; a++) {
292#define DEFORM_OP_MINMAX(dvert) \
294 const float weight = invert_vgroup ? 1.0f - BKE_defvert_find_weight(dvert, defgrp_index) : \
295 BKE_defvert_find_weight(dvert, defgrp_index); \
296 if (weight > 0.0f) { \
297 mul_m4_v3(cd.curvespace, vert_coords[a]); \
298 minmax_v3v3_v3(cd.dmin, cd.dmax, vert_coords[a]); \
304#define DEFORM_OP_CLAMPED(dvert) \
306 const float weight = invert_vgroup ? 1.0f - BKE_defvert_find_weight(dvert, defgrp_index) : \
307 BKE_defvert_find_weight(dvert, defgrp_index); \
308 if (weight > 0.0f) { \
310 copy_v3_v3(vec, vert_coords[a]); \
311 calc_curve_deform(ob_curve, vec, defaxis, &cd, nullptr); \
312 interp_v3_v3v3(vert_coords[a], vert_coords[a], vec, weight); \
313 mul_m4_v3(cd.objectspace, vert_coords[a]); \
333 for (a = 0; a < vert_coords_len; a++) {
337 for (a = 0; a < vert_coords_len; a++) {
343#undef DEFORM_OP_MINMAX
344#undef DEFORM_OP_CLAMPED
348 for (a = 0; a < vert_coords_len; a++) {
355 for (a = 0; a < vert_coords_len; a++) {
360 for (a = 0; a < vert_coords_len; a++) {
371 float (*vert_coords)[3],
372 const int vert_coords_len,
374 const int defgrp_index,
391 float (*vert_coords)[3],
392 const int vert_coords_len,
393 const int defgrp_index,
396 const BMesh &bm_target)
413 const int no_rot_axis,
Object is a sort of wrapper for general info.
#define INIT_MINMAX(min, max)
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
int CustomData_get_offset(const CustomData *data, eCustomDataType type)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void BKE_curve_deform_co(const Object *ob_curve, const Object *ob_target, const float orco[3], float vec[3], int no_rot_axis, float r_mat[3][3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
void copy_m3_m4(float m1[3][3], const float m2[4][4])
void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
@ MOD_CURVE_INVERT_VGROUP
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
bool BKE_where_on_path(const struct Object *ob, float ctime, float r_vec[4], float r_dir[3], float r_quat[4], float *r_radius, float *r_weight)
float normalize_qt(float q[4])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void rotation_between_vecs_to_quat(float q[4], const float v1[3], const float v2[3])
void mul_qt_qtqt(float q[4], const float a[4], const float b[4])
ATTR_WARN_UNUSED_RESULT const BMVert * v
MINLINE void mul_v3_fl(float r[3], float f)
void mul_qt_v3(const float q[4], float r[3])
static void curve_deform_coords_impl(const Object *ob_curve, const Object *ob_target, float(*vert_coords)[3], const int vert_coords_len, const MDeformVert *dvert, const int defgrp_index, const short flag, const short defaxis, const BMesh *bm_target)
void mul_m4_v3(const float M[4][4], float r[3])
void quat_to_mat3(float m[3][3], const float q[4])
void BKE_curve_deform_coords(const Object *ob_curve, const Object *ob_target, float(*vert_coords)[3], int vert_coords_len, const MDeformVert *dvert, int defgrp_index, short flag, short defaxis)
void vec_apply_track(float vec[3], short axis)
void copy_qt_qt(float q[4], const float a[4])
void BKE_curve_deform_coords_with_editmesh(const Object *ob_curve, const Object *ob_target, float(*vert_coords)[3], int vert_coords_len, int defgrp_index, short flag, short defaxis, const BMesh &bm_target)
void quat_apply_track(float quat[4], short axis, short upflag)
MINLINE float normalize_v3(float n[3])
void unit_m3(float m[3][3])
static void init_curve_deform(const Object *ob_curve, const Object *ob_target, CurveDeform *cd)
static bool calc_curve_deform(const Object *ob_curve, float co[3], const short axis, const CurveDeform *cd, float r_quat[4])
float BKE_anim_path_get_length(const struct CurveCache *curve_cache)
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
const float * anim_path_accum_length
bke::ObjectRuntime * runtime