68 if (mesh ==
nullptr) {
72 float(*accumulated_vecs)[3] =
static_cast<float(*)[3]
>(
74 if (!accumulated_vecs) {
78 uint *accumulated_vecs_count =
static_cast<uint *
>(
80 if (!accumulated_vecs_count) {
85 const float fac_new = smd->
fac;
86 const float fac_orig = 1.0f - fac_new;
95 for (
int j = 0; j < smd->
repeat; j++) {
97 memset(accumulated_vecs, 0,
sizeof(*accumulated_vecs) *
size_t(verts_num));
98 memset(accumulated_vecs_count, 0,
sizeof(*accumulated_vecs_count) *
size_t(verts_num));
101 for (
const int i : edges.index_range()) {
103 const uint idx1 = edges[i][0];
104 const uint idx2 = edges[i][1];
106 mid_v3_v3v3(fvec, vertexCos[idx1], vertexCos[idx2]);
108 accumulated_vecs_count[idx1]++;
111 accumulated_vecs_count[idx2]++;
118 for (
int i = 0; i < verts_num; i++, dv++) {
119 float *vco_orig = vertexCos[i];
120 if (accumulated_vecs_count[i] > 0) {
121 mul_v3_fl(accumulated_vecs[i], 1.0f /
float(accumulated_vecs_count[i]));
123 float *vco_new = accumulated_vecs[i];
127 if (f_vgroup <= 0.0f) {
130 const float f_new = f_vgroup * fac_new;
131 const float f_orig = 1.0f - f_new;
134 vco_orig[0] = f_orig * vco_orig[0] + f_new * vco_new[0];
137 vco_orig[1] = f_orig * vco_orig[1] + f_new * vco_new[1];
140 vco_orig[2] = f_orig * vco_orig[2] + f_new * vco_new[2];
145 for (
int i = 0; i < verts_num; i++) {
146 float *vco_orig = vertexCos[i];
147 if (accumulated_vecs_count[i] > 0) {
148 mul_v3_fl(accumulated_vecs[i], 1.0f /
float(accumulated_vecs_count[i]));
150 float *vco_new = accumulated_vecs[i];
153 vco_orig[0] = fac_orig * vco_orig[0] + fac_new * vco_new[0];
156 vco_orig[1] = fac_orig * vco_orig[1] + fac_new * vco_new[1];
159 vco_orig[2] = fac_orig * vco_orig[2] + fac_new * vco_new[2];
void modifier_vgroup_ui(uiLayout *layout, PointerRNA *ptr, PointerRNA *ob_ptr, const char *vgroup_prop, const char *invert_vgroup_prop, const char *text)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)