Blender V5.3
MOD_array.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2005 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10
11#include <algorithm>
12
13#include "MEM_guardedalloc.h"
14
15#include "BLI_utildefines.hh"
16
17#include "BLI_math_matrix_c.hh"
18#include "BLI_math_vector_c.hh"
19#include "BLI_span.hh"
20
21#include "BLT_translation.hh"
22
23#include "DNA_meshdata_types.h"
24#include "DNA_object_types.h"
25#include "DNA_screen_types.h"
26
27#include "BKE_anim_path.h"
28#include "BKE_attribute.hh"
30#include "BKE_curve.hh"
31#include "BKE_customdata.hh"
32#include "BKE_lib_id.hh"
33#include "BKE_lib_query.hh"
34#include "BKE_mesh.hh"
35#include "BKE_mesh_wrapper.hh"
36#include "BKE_modifier.hh"
37#include "BKE_object_deform.h"
38#include "BKE_object_types.hh"
39
41#include "UI_resources.hh"
42
43#include "RNA_access.hh"
44#include "RNA_prototypes.hh"
45
46#include "MOD_ui_common.hh"
47
48#include "DEG_depsgraph.hh"
49
51
52namespace blender {
53
54static void init_data(ModifierData *md)
55{
56 ArrayModifierData *amd = reinterpret_cast<ArrayModifierData *>(md);
58
59 /* Open the first sub-panel by default,
60 * it corresponds to Relative offset which is enabled too. */
62}
63
64static void foreach_ID_link(ModifierData *md, Object *ob, IDWalkFunc walk, void *user_data)
65{
66 ArrayModifierData *amd = reinterpret_cast<ArrayModifierData *>(md);
67
68 walk(user_data, ob, reinterpret_cast<ID **>(&amd->start_cap), IDWALK_CB_NOP);
69 walk(user_data, ob, reinterpret_cast<ID **>(&amd->end_cap), IDWALK_CB_NOP);
70 walk(user_data, ob, reinterpret_cast<ID **>(&amd->curve_ob), IDWALK_CB_NOP);
71 walk(user_data, ob, reinterpret_cast<ID **>(&amd->offset_ob), IDWALK_CB_NOP);
72}
73
75{
76 ArrayModifierData *amd = reinterpret_cast<ArrayModifierData *>(md);
77 bool need_transform_dependency = false;
78 if (amd->start_cap != nullptr) {
80 ctx->node, amd->start_cap, DEG_OB_COMP_GEOMETRY, "Array Modifier Start Cap");
81 }
82 if (amd->end_cap != nullptr) {
84 ctx->node, amd->end_cap, DEG_OB_COMP_GEOMETRY, "Array Modifier End Cap");
85 }
86 if (amd->curve_ob) {
88 ctx->node, amd->curve_ob, DEG_OB_COMP_GEOMETRY, "Array Modifier Curve");
90 }
91 if (amd->offset_ob != nullptr) {
93 ctx->node, amd->offset_ob, DEG_OB_COMP_TRANSFORM, "Array Modifier Offset");
94 need_transform_dependency = true;
95 }
96
97 if (need_transform_dependency) {
98 DEG_add_depends_on_transform_relation(ctx->node, "Array Modifier");
99 }
100}
101
102BLI_INLINE float sum_v3(const float v[3])
103{
104 return v[0] + v[1] + v[2];
105}
106
107/* Structure used for sorting vertices, when processing doubles */
109 int vertex_num; /* The original index of the vertex, prior to sorting */
110 float co[3]; /* Its coordinates */
111 float sum_co; /* `sum_v3(co)`: just so we don't do the sum many times. */
112};
113
114static int svert_sum_cmp(const void *e1, const void *e2)
115{
116 const SortVertsElem *sv1 = static_cast<const SortVertsElem *>(e1);
117 const SortVertsElem *sv2 = static_cast<const SortVertsElem *>(e2);
118
119 if (sv1->sum_co > sv2->sum_co) {
120 return 1;
121 }
122 if (sv1->sum_co < sv2->sum_co) {
123 return -1;
124 }
125
126 return 0;
127}
128
130 const Span<float3> vert_positions,
131 const int i_begin,
132 const int i_end)
133{
134 int i;
135 for (i = i_begin; i < i_end; i++, sv++) {
136 sv->vertex_num = i;
137 copy_v3_v3(sv->co, vert_positions[i]);
138 sv->sum_co = sum_v3(vert_positions[i]);
139 }
140}
141
149static void dm_mvert_map_doubles(int *doubles_map,
150 const Span<float3> vert_positions,
151 const int target_start,
152 const int target_verts_num,
153 const int source_start,
154 const int source_verts_num,
155 const float dist)
156{
157 const float dist3 = (float(M_SQRT3) + 0.00005f) * dist; /* Just above `sqrt(3)`. */
158 int i_source, i_target, i_target_low_bound, target_end, source_end;
159 SortVertsElem *sve_source, *sve_target, *sve_target_low_bound;
160 bool target_scan_completed;
161
162 target_end = target_start + target_verts_num;
163 source_end = source_start + source_verts_num;
164
165 /* build array of MVerts to be tested for merging */
167 size_t(target_verts_num), __func__);
169 size_t(source_verts_num), __func__);
170
171 /* Copy target vertices index and cos into SortVertsElem array */
172 svert_from_mvert(sorted_verts_target, vert_positions, target_start, target_end);
173
174 /* Copy source vertices index and cos into SortVertsElem array */
175 svert_from_mvert(sorted_verts_source, vert_positions, source_start, source_end);
176
177 /* sort arrays according to sum of vertex coordinates (sumco) */
178 qsort(sorted_verts_target, target_verts_num, sizeof(SortVertsElem), svert_sum_cmp);
179 qsort(sorted_verts_source, source_verts_num, sizeof(SortVertsElem), svert_sum_cmp);
180
181 sve_target_low_bound = sorted_verts_target;
182 i_target_low_bound = 0;
183 target_scan_completed = false;
184
185 /* Scan source vertices, in #SortVertsElem sorted array,
186 * all the while maintaining the lower bound of possible doubles in target vertices. */
187 for (i_source = 0, sve_source = sorted_verts_source; i_source < source_verts_num;
188 i_source++, sve_source++)
189 {
190 int best_target_vertex = -1;
191 float best_dist_sq = dist * dist;
192 float sve_source_sumco;
193
194 /* If source has already been assigned to a target (in an earlier call, with other chunks) */
195 if (doubles_map[sve_source->vertex_num] != -1) {
196 continue;
197 }
198
199 /* If target fully scanned already, then all remaining source vertices cannot have a double */
200 if (target_scan_completed) {
201 doubles_map[sve_source->vertex_num] = -1;
202 continue;
203 }
204
205 sve_source_sumco = sum_v3(sve_source->co);
206
207 /* Skip all target vertices that are more than dist3 lower in terms of sumco */
208 /* and advance the overall lower bound, applicable to all remaining vertices as well. */
209 while ((i_target_low_bound < target_verts_num) &&
210 (sve_target_low_bound->sum_co < sve_source_sumco - dist3))
211 {
212 i_target_low_bound++;
213 sve_target_low_bound++;
214 }
215 /* If end of target list reached, then no more possible doubles */
216 if (i_target_low_bound >= target_verts_num) {
217 doubles_map[sve_source->vertex_num] = -1;
218 target_scan_completed = true;
219 continue;
220 }
221 /* Test target candidates starting at the low bound of possible doubles,
222 * ordered in terms of sumco. */
223 i_target = i_target_low_bound;
224 sve_target = sve_target_low_bound;
225
226 /* i_target will scan vertices in the
227 * [v_source_sumco - dist3; v_source_sumco + dist3] range */
228
229 while ((i_target < target_verts_num) && (sve_target->sum_co <= sve_source_sumco + dist3)) {
230 /* Testing distance for candidate double in target */
231 /* v_target is within dist3 of v_source in terms of sumco; check real distance */
232 const float dist_sq = len_squared_v3v3(sve_source->co, sve_target->co);
233 if (dist_sq <= best_dist_sq) {
234 /* Potential double found */
235 best_dist_sq = dist_sq;
236 best_target_vertex = sve_target->vertex_num;
237
238 /* If target is already mapped, we only follow that mapping if final target remains
239 * close enough from current vert (otherwise no mapping at all).
240 * Note that if we later find another target closer than this one, then we check it.
241 * But if other potential targets are farther,
242 * then there will be no mapping at all for this source. */
243 while (best_target_vertex != -1 &&
244 !ELEM(doubles_map[best_target_vertex], -1, best_target_vertex))
245 {
246 if (compare_len_v3v3(vert_positions[sve_source->vertex_num],
247 vert_positions[doubles_map[best_target_vertex]],
248 dist))
249 {
250 best_target_vertex = doubles_map[best_target_vertex];
251 }
252 else {
253 best_target_vertex = -1;
254 }
255 }
256 }
257 i_target++;
258 sve_target++;
259 }
260 /* End of candidate scan: if none found then no doubles */
261 doubles_map[sve_source->vertex_num] = best_target_vertex;
262 }
263
264 MEM_delete(sorted_verts_source);
265 MEM_delete(sorted_verts_target);
266}
267
269 Mesh *cap_mesh,
270 const float cap_offset[4][4],
271 uint cap_verts_index,
272 uint cap_edges_index,
273 int cap_loops_index,
274 int cap_faces_index,
275 int cap_nverts,
276 int cap_nedges,
277 int cap_nloops,
278 int cap_nfaces,
279 int *remap,
280 int remap_len,
281 MutableSpan<float3> dst_vert_normals)
282{
283 int *index_orig;
284 int i;
285 int2 *edge;
286 const Span<int> cap_face_offsets = cap_mesh->face_offsets();
287 MutableSpan<float3> result_positions = result->vert_positions_for_write();
288 MutableSpan<int2> result_edges = result->edges_for_write();
289 MutableSpan<int> result_face_offsets = result->face_offsets_for_write();
290 MutableSpan<int> result_corner_verts = result->corner_verts_for_write();
291 MutableSpan<int> result_corner_edges = result->corner_edges_for_write();
292 bke::MutableAttributeAccessor result_attributes = result->attributes_for_write();
293
298
299 vert_interp.copy(0, cap_verts_index, cap_nverts);
300 edge_interp.copy(0, cap_edges_index, cap_nedges);
301 face_interp.copy(0, cap_faces_index, cap_nfaces);
302 corner_interp.copy(0, cap_loops_index, cap_nloops);
303
304 for (i = 0; i < cap_nverts; i++) {
305 mul_m4_v3(cap_offset, result_positions[cap_verts_index + i]);
306 }
307
308 /* We have to correct normals too, if we do not tag them as dirty later! */
309 if (!dst_vert_normals.is_empty()) {
310 for (i = 0; i < cap_nverts; i++) {
311 mul_mat3_m4_v3(cap_offset, dst_vert_normals[cap_verts_index + i]);
312 normalize_v3(dst_vert_normals[cap_verts_index + i]);
313 }
314 }
315
316 /* remap the vertex groups if necessary */
317 if (!result->deform_verts().is_empty()) {
318 MDeformVert *dvert = result->deform_verts_for_write().data();
319 BKE_object_defgroup_index_map_apply(&dvert[cap_verts_index], cap_nverts, remap, remap_len);
320 }
321
322 /* adjust cap edge vertex indices */
323 edge = &result_edges[cap_edges_index];
324 for (i = 0; i < cap_nedges; i++, edge++) {
325 (*edge) += cap_verts_index;
326 }
327
328 /* Adjust cap face loop-start indices. */
329 for (i = 0; i < cap_nfaces; i++) {
330 result_face_offsets[cap_faces_index + i] = cap_face_offsets[i] + cap_loops_index;
331 }
332
333 /* adjust cap loop vertex and edge indices */
334 for (i = 0; i < cap_nloops; i++) {
335 result_corner_verts[cap_loops_index + i] += cap_verts_index;
336 result_corner_edges[cap_loops_index + i] += cap_edges_index;
337 }
338
339 const bke::AttributeAccessor cap_attributes = cap_mesh->attributes();
340 if (const VArray cap_material_indices = *cap_attributes.lookup<int>("material_index",
342 {
343 bke::SpanAttributeWriter<int> result_material_indices =
344 result_attributes.lookup_or_add_for_write_span<int>("material_index",
346 cap_material_indices.materialize(
347 result_material_indices.span.slice(cap_faces_index, cap_nfaces));
348 result_material_indices.finish();
349 }
350
351 /* Set #CD_ORIGINDEX. */
352 index_orig = static_cast<int *>(
353 CustomData_get_layer_for_write(&result->vert_data, CD_ORIGINDEX, result->verts_num));
354 if (index_orig) {
355 std::fill_n(index_orig + cap_verts_index, cap_nverts, ORIGINDEX_NONE);
356 }
357
358 index_orig = static_cast<int *>(
359 CustomData_get_layer_for_write(&result->edge_data, CD_ORIGINDEX, result->edges_num));
360 if (index_orig) {
361 std::fill_n(index_orig + cap_edges_index, cap_nedges, ORIGINDEX_NONE);
362 }
363
364 index_orig = static_cast<int *>(
365 CustomData_get_layer_for_write(&result->face_data, CD_ORIGINDEX, result->faces_num));
366 if (index_orig) {
367 std::fill_n(index_orig + cap_faces_index, cap_nfaces, ORIGINDEX_NONE);
368 }
369
370 index_orig = static_cast<int *>(
371 CustomData_get_layer_for_write(&result->corner_data, CD_ORIGINDEX, result->corners_num));
372 if (index_orig) {
373 std::fill_n(index_orig + cap_loops_index, cap_nloops, ORIGINDEX_NONE);
374 }
375}
376
378 const ModifierEvalContext *ctx,
379 Mesh *mesh)
380{
381 /* NOTE(@ideasman4): the `mesh` may be empty, the following code must account for this,
382 * merging start/end caps into the empty mesh. Avoid an early return here as it can cause
383 * problems if the expected custom-data layers don't exist in the resulting mesh,
384 * see: #107353, #132991. */
385
386 int2 *edge;
387 int i, j, c, count;
388 float length = amd->length;
389 /* offset matrix */
390 float offset[4][4];
391 float scale[3];
392 bool offset_has_scale;
393 float current_offset[4][4];
394 float final_offset[4][4];
395 int *full_doubles_map = nullptr;
396 int tot_doubles;
397
398 const bool use_merge = (amd->flags & MOD_ARR_MERGE) != 0;
399 const bool use_recalc_normals = BKE_mesh_vert_normals_are_dirty(mesh) || use_merge;
400 const bool use_offset_ob = ((amd->offset_type & MOD_ARR_OFF_OBJ) && amd->offset_ob != nullptr);
401
402 int start_cap_nverts = 0, start_cap_nedges = 0, start_cap_nfaces = 0, start_cap_nloops = 0;
403 int end_cap_nverts = 0, end_cap_nedges = 0, end_cap_nfaces = 0, end_cap_nloops = 0;
404 int result_nverts = 0, result_nedges = 0, result_nfaces = 0, result_nloops = 0;
405 int chunk_nverts, chunk_nedges, chunk_nloops, chunk_nfaces;
406 int first_chunk_start, first_chunk_nverts, last_chunk_start, last_chunk_nverts;
407
408 Mesh *result, *start_cap_mesh = nullptr, *end_cap_mesh = nullptr;
409
410 int *vgroup_start_cap_remap = nullptr;
411 int vgroup_start_cap_remap_len = 0;
412 int *vgroup_end_cap_remap = nullptr;
413 int vgroup_end_cap_remap_len = 0;
414
415 chunk_nverts = mesh->verts_num;
416 chunk_nedges = mesh->edges_num;
417 chunk_nloops = mesh->corners_num;
418 chunk_nfaces = mesh->faces_num;
419
420 count = amd->count;
421
422 Object *start_cap_ob = amd->start_cap;
423 if (start_cap_ob && start_cap_ob != ctx->object) {
424 if (start_cap_ob->type == OB_MESH && ctx->object->type == OB_MESH) {
425 vgroup_start_cap_remap = BKE_object_defgroup_index_map_create(
426 start_cap_ob, ctx->object, &vgroup_start_cap_remap_len);
427 }
428
429 start_cap_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(start_cap_ob);
430 if (start_cap_mesh) {
431 BKE_mesh_wrapper_ensure_mdata(start_cap_mesh);
432 start_cap_nverts = start_cap_mesh->verts_num;
433 start_cap_nedges = start_cap_mesh->edges_num;
434 start_cap_nloops = start_cap_mesh->corners_num;
435 start_cap_nfaces = start_cap_mesh->faces_num;
436 }
437 }
438 Object *end_cap_ob = amd->end_cap;
439 if (end_cap_ob && end_cap_ob != ctx->object) {
440 if (end_cap_ob->type == OB_MESH && ctx->object->type == OB_MESH) {
441 vgroup_end_cap_remap = BKE_object_defgroup_index_map_create(
442 end_cap_ob, ctx->object, &vgroup_end_cap_remap_len);
443 }
444
446 if (end_cap_mesh) {
447 BKE_mesh_wrapper_ensure_mdata(end_cap_mesh);
448 end_cap_nverts = end_cap_mesh->verts_num;
449 end_cap_nedges = end_cap_mesh->edges_num;
450 end_cap_nloops = end_cap_mesh->corners_num;
451 end_cap_nfaces = end_cap_mesh->faces_num;
452 }
453 }
454
455 /* Build up offset array, accumulating all settings options. */
456
457 unit_m4(offset);
458
459 if (amd->offset_type & MOD_ARR_OFF_CONST) {
460 add_v3_v3(offset[3], amd->offset);
461 }
462
464 if (const std::optional<Bounds<float3>> bounds = mesh->bounds_min_max()) {
465 for (j = 3; j--;) {
466 offset[3][j] += amd->scale[j] * (bounds->max[j] - bounds->min[j]);
467 }
468 }
469 }
470
471 if (use_offset_ob) {
472 float obinv[4][4];
473 float result_mat[4][4];
474
475 if (ctx->object) {
476 invert_m4_m4(obinv, ctx->object->object_to_world().ptr());
477 }
478 else {
479 unit_m4(obinv);
480 }
481
482 mul_m4_series(result_mat, offset, obinv, amd->offset_ob->object_to_world().ptr());
483 copy_m4_m4(offset, result_mat);
484 }
485
486 /* Check if there is some scaling. If scaling, then we will not translate mapping */
487 mat4_to_size(scale, offset);
488 offset_has_scale = !is_one_v3(scale);
489
490 if (amd->fit_type == MOD_ARR_FITCURVE && amd->curve_ob != nullptr) {
491 Object *curve_ob = amd->curve_ob;
492 CurveCache *curve_cache = curve_ob->runtime->curve_cache;
493 if (curve_cache != nullptr && curve_cache->anim_path_accum_length != nullptr) {
494 float scale_fac = mat4_to_scale(curve_ob->object_to_world().ptr());
495 length = scale_fac * BKE_anim_path_get_length(curve_cache);
496 }
497 }
498
499 /* About 67 million vertices max seems a decent limit for now. */
500 const size_t max_verts_num = 1 << 26;
501
502 /* calculate the maximum number of copies which will fit within the
503 * prescribed length */
505 const float float_epsilon = 1e-6f;
506 bool offset_is_too_small = false;
507 float dist = len_v3(offset[3]);
508
509 if (dist > float_epsilon) {
510 /* this gives length = first copy start to last copy end
511 * add a tiny offset for floating point rounding errors */
512 count = (length + float_epsilon) / dist + 1;
513
514 /* Ensure we keep things to a reasonable level, in terms of rough total amount of generated
515 * vertices.
516 */
517 if ((size_t(count) * size_t(chunk_nverts) + size_t(start_cap_nverts) +
518 size_t(end_cap_nverts)) > max_verts_num)
519 {
520 count = 1;
521 offset_is_too_small = true;
522 }
523 }
524 else {
525 /* if the offset has no translation, just make one copy */
526 count = 1;
527 offset_is_too_small = true;
528 }
529
530 if (offset_is_too_small) {
532 ctx->object,
533 &amd->modifier,
534 "The offset is too small, we cannot generate the amount of geometry it would require");
535 }
536 }
537 /* Ensure we keep things to a reasonable level, in terms of rough total amount of generated
538 * vertices.
539 */
540 else if ((size_t(count) * size_t(chunk_nverts) + size_t(start_cap_nverts) +
541 size_t(end_cap_nverts)) > max_verts_num)
542 {
543 count = 1;
545 &amd->modifier,
546 "The amount of copies is too high, we cannot generate the amount of "
547 "geometry it would require");
548 }
549
550 count = std::max(count, 1);
551
552 /* The number of verts, edges, loops, faces, before eventually merging doubles */
553 result_nverts = chunk_nverts * count + start_cap_nverts + end_cap_nverts;
554 result_nedges = chunk_nedges * count + start_cap_nedges + end_cap_nedges;
555 result_nloops = chunk_nloops * count + start_cap_nloops + end_cap_nloops;
556 result_nfaces = chunk_nfaces * count + start_cap_nfaces + end_cap_nfaces;
557
558 /* Initialize a result dm */
560 mesh, result_nverts, result_nedges, result_nfaces, result_nloops);
561 MutableSpan<float3> result_positions = result->vert_positions_for_write();
562 MutableSpan<int2> result_edges = result->edges_for_write();
563 MutableSpan<int> result_face_offsets = result->face_offsets_for_write();
564 MutableSpan<int> result_corner_verts = result->corner_verts_for_write();
565 MutableSpan<int> result_corner_edges = result->corner_edges_for_write();
566 bke::MutableAttributeAccessor result_attributes = result->attributes_for_write();
567
568 if (use_merge) {
569 /* Will need full_doubles_map for handling merge */
570 full_doubles_map = MEM_new_array_uninitialized<int>(size_t(result_nverts), __func__);
571 std::fill_n(full_doubles_map, result_nverts, -1);
572 }
573
574 /* copy customdata to original geometry */
579 vert_interp.copy(0, 0, chunk_nverts);
580 edge_interp.copy(0, 0, chunk_nedges);
581 face_interp.copy(0, 0, chunk_nfaces);
582 corner_interp.copy(0, 0, chunk_nloops);
583
584 result_face_offsets.take_front(mesh->faces_num).copy_from(mesh->face_offsets().drop_back(1));
585
586 /* Remember first chunk, in case of cap merge */
587 first_chunk_start = 0;
588 first_chunk_nverts = chunk_nverts;
589
590 unit_m4(current_offset);
591 Span<float3> src_vert_normals;
592 Vector<float3> dst_vert_normals;
593 if (!use_recalc_normals) {
594 src_vert_normals = mesh->vert_normals();
595 dst_vert_normals.reinitialize(result->verts_num);
596 dst_vert_normals.as_mutable_span()
597 .take_front(src_vert_normals.size())
598 .copy_from(src_vert_normals);
599 }
600
601 for (c = 1; c < count; c++) {
602 /* copy customdata to new geometry */
603 vert_interp.copy(0, c * chunk_nverts, chunk_nverts);
604 edge_interp.copy(0, c * chunk_nedges, chunk_nedges);
605 face_interp.copy(0, c * chunk_nfaces, chunk_nfaces);
606 corner_interp.copy(0, c * chunk_nloops, chunk_nloops);
607
608 /* recalculate cumulative offset here */
609 mul_m4_m4m4(current_offset, current_offset, offset);
610
611 if (chunk_nverts) {
612 /* Apply offset to all new verts. */
613 const int vert_offset = c * chunk_nverts;
614 for (i = 0; i < chunk_nverts; i++) {
615 const int i_dst = vert_offset + i;
616 mul_m4_v3(current_offset, result_positions[i_dst]);
617
618 /* We have to correct normals too, if we do not tag them as dirty! */
619 if (!dst_vert_normals.is_empty()) {
620 copy_v3_v3(dst_vert_normals[i_dst], src_vert_normals[i]);
621 mul_mat3_m4_v3(current_offset, dst_vert_normals[i_dst]);
622 normalize_v3(dst_vert_normals[i_dst]);
623 }
624 }
625 }
626
627 if (chunk_nedges) {
628 /* Adjust edge vertex indices. */
629 edge = &result_edges[c * chunk_nedges];
630 for (i = 0; i < chunk_nedges; i++, edge++) {
631 (*edge) += c * chunk_nverts;
632 }
633 }
634
635 if (chunk_nfaces) {
636 for (i = 0; i < chunk_nfaces; i++) {
637 result_face_offsets[c * chunk_nfaces + i] = result_face_offsets[i] + c * chunk_nloops;
638 }
639 }
640
641 if (chunk_nloops) {
642 /* Adjust loop vertex and edge indices. */
643 const int chunk_corner_start = c * chunk_nloops;
644 for (i = 0; i < chunk_nloops; i++) {
645 result_corner_verts[chunk_corner_start + i] += c * chunk_nverts;
646 result_corner_edges[chunk_corner_start + i] += c * chunk_nedges;
647 }
648 }
649
650 /* Handle merge between chunk n and n-1 */
651 if (use_merge && (c >= 1)) {
652 if (!offset_has_scale && (c >= 2)) {
653 /* Mapping chunk 3 to chunk 2 is a translation of mapping 2 to 1
654 * ... that is except if scaling makes the distance grow */
655 int k;
656 int this_chunk_index = c * chunk_nverts;
657 int prev_chunk_index = (c - 1) * chunk_nverts;
658 for (k = 0; k < chunk_nverts; k++, this_chunk_index++, prev_chunk_index++) {
659 int target = full_doubles_map[prev_chunk_index];
660 if (target != -1) {
661 target += chunk_nverts; /* translate mapping */
662 while (target != -1 && !ELEM(full_doubles_map[target], -1, target)) {
663 /* If target is already mapped, we only follow that mapping if final target remains
664 * close enough from current vert (otherwise no mapping at all). */
665 if (compare_len_v3v3(result_positions[this_chunk_index],
666 result_positions[full_doubles_map[target]],
667 amd->merge_dist))
668 {
669 target = full_doubles_map[target];
670 }
671 else {
672 target = -1;
673 }
674 }
675 }
676 full_doubles_map[this_chunk_index] = target;
677 }
678 }
679 else {
680 dm_mvert_map_doubles(full_doubles_map,
681 result_positions,
682 (c - 1) * chunk_nverts,
683 chunk_nverts,
684 c * chunk_nverts,
685 chunk_nverts,
686 amd->merge_dist);
687 }
688 }
689 }
690
691 /* handle UVs */
692 if (chunk_nloops > 0 && is_zero_v2(amd->uv_offset) == false) {
693 const VectorSet<StringRefNull> uv_map_names = result->uv_map_names();
694 for (i = 0; i < uv_map_names.size(); i++) {
695 bke::SpanAttributeWriter uv_map_attr = result_attributes.lookup_for_write_span<float2>(
696 uv_map_names[i]);
697 float2 *uv_map = uv_map_attr.span.data();
698 uv_map += chunk_nloops;
699 for (c = 1; c < count; c++) {
700 const float uv_offset[2] = {
701 amd->uv_offset[0] * float(c),
702 amd->uv_offset[1] * float(c),
703 };
704 int l_index = chunk_nloops;
705 for (; l_index-- != 0; uv_map++) {
706 (*uv_map)[0] += uv_offset[0];
707 (*uv_map)[1] += uv_offset[1];
708 }
709 }
710 uv_map_attr.finish();
711 }
712 }
713
714 if (!use_merge && !mesh->runtime->subsurf_optimal_display_edges.is_empty()) {
715 const BoundedBitSpan src = mesh->runtime->subsurf_optimal_display_edges;
716
717 result->runtime->subsurf_optimal_display_edges.resize(result->edges_num);
718 MutableBoundedBitSpan dst = result->runtime->subsurf_optimal_display_edges;
719 for (const int i : IndexRange(count)) {
720 dst.slice({i * mesh->edges_num, mesh->edges_num}).copy_from(src);
721 }
722
723 if (start_cap_mesh) {
724 MutableBitSpan cap_bits = dst.slice(
725 {result_nedges - start_cap_nedges - end_cap_nedges, start_cap_mesh->edges_num});
726 if (start_cap_mesh->runtime->subsurf_optimal_display_edges.is_empty()) {
727 cap_bits.set_all(true);
728 }
729 else {
730 cap_bits.copy_from(start_cap_mesh->runtime->subsurf_optimal_display_edges);
731 }
732 }
733 if (end_cap_mesh) {
734 MutableBitSpan cap_bits = dst.slice(
735 {result_nedges - end_cap_nedges, end_cap_mesh->edges_num});
736 if (end_cap_mesh->runtime->subsurf_optimal_display_edges.is_empty()) {
737 cap_bits.set_all(true);
738 }
739 else {
740 cap_bits.copy_from(end_cap_mesh->runtime->subsurf_optimal_display_edges);
741 }
742 }
743 }
744
745 last_chunk_start = (count - 1) * chunk_nverts;
746 last_chunk_nverts = chunk_nverts;
747
748 copy_m4_m4(final_offset, current_offset);
749
750 if (use_merge && (amd->flags & MOD_ARR_MERGEFINAL) && (count > 1)) {
751 /* Merge first and last copies */
752 dm_mvert_map_doubles(full_doubles_map,
753 result_positions,
754 last_chunk_start,
755 last_chunk_nverts,
756 first_chunk_start,
757 first_chunk_nverts,
758 amd->merge_dist);
759 }
760
761 /* start capping */
762 if (start_cap_mesh) {
763 float start_offset[4][4];
764 int start_cap_start = result_nverts - start_cap_nverts - end_cap_nverts;
765 invert_m4_m4(start_offset, offset);
767 start_cap_mesh,
768 start_offset,
769 result_nverts - start_cap_nverts - end_cap_nverts,
770 result_nedges - start_cap_nedges - end_cap_nedges,
771 result_nloops - start_cap_nloops - end_cap_nloops,
772 result_nfaces - start_cap_nfaces - end_cap_nfaces,
773 start_cap_nverts,
774 start_cap_nedges,
775 start_cap_nloops,
776 start_cap_nfaces,
777 vgroup_start_cap_remap,
778 vgroup_start_cap_remap_len,
779 dst_vert_normals);
780 /* Identify doubles with first chunk */
781 if (use_merge) {
782 dm_mvert_map_doubles(full_doubles_map,
783 result_positions,
784 first_chunk_start,
785 first_chunk_nverts,
786 start_cap_start,
787 start_cap_nverts,
788 amd->merge_dist);
789 }
790 }
791
792 if (end_cap_mesh) {
793 float end_offset[4][4];
794 int end_cap_start = result_nverts - end_cap_nverts;
795 mul_m4_m4m4(end_offset, current_offset, offset);
797 end_cap_mesh,
798 end_offset,
799 result_nverts - end_cap_nverts,
800 result_nedges - end_cap_nedges,
801 result_nloops - end_cap_nloops,
802 result_nfaces - end_cap_nfaces,
803 end_cap_nverts,
804 end_cap_nedges,
805 end_cap_nloops,
806 end_cap_nfaces,
807 vgroup_end_cap_remap,
808 vgroup_end_cap_remap_len,
809 dst_vert_normals);
810 /* Identify doubles with last chunk */
811 if (use_merge) {
812 dm_mvert_map_doubles(full_doubles_map,
813 result_positions,
814 last_chunk_start,
815 last_chunk_nverts,
816 end_cap_start,
817 end_cap_nverts,
818 amd->merge_dist);
819 }
820 }
821 /* done capping */
822
823 if (!dst_vert_normals.is_empty()) {
824 bke::mesh_vert_normals_assign(*result, std::move(dst_vert_normals));
825 }
826
827 /* Handle merging */
828 tot_doubles = 0;
829 if (use_merge) {
830 for (i = 0; i < result_nverts; i++) {
831 int new_i = full_doubles_map[i];
832 if (new_i != -1) {
833 /* We have to follow chains of doubles
834 * (merge start/end especially is likely to create some),
835 * those are not supported at all by `geometry::mesh_merge_verts`! */
836 while (!ELEM(full_doubles_map[new_i], -1, new_i)) {
837 new_i = full_doubles_map[new_i];
838 }
839 if (i == new_i) {
840 full_doubles_map[i] = -1;
841 }
842 else {
843 full_doubles_map[i] = new_i;
844 tot_doubles++;
845 }
846 }
847 }
848 if (tot_doubles > 0) {
849 /* Vertex merging expects un-merged vertices to point at themselves rather than being -1. */
850 for (i = 0; i < result_nverts; i++) {
851 if (full_doubles_map[i] == -1) {
852 full_doubles_map[i] = i;
853 }
854 }
855 Mesh *tmp = result;
857 *tmp, Span<int>{full_doubles_map, result->verts_num}, tot_doubles, false);
858 BKE_id_free(nullptr, tmp);
859 }
860 MEM_delete(full_doubles_map);
861 }
862
863 if (vgroup_start_cap_remap) {
864 MEM_delete(vgroup_start_cap_remap);
865 }
866 if (vgroup_end_cap_remap) {
867 MEM_delete(vgroup_end_cap_remap);
868 }
869
870 return result;
871}
872
874{
875 ArrayModifierData *amd = reinterpret_cast<ArrayModifierData *>(md);
876 return arrayModifier_doArray(amd, ctx, mesh);
877}
878
879static bool is_disabled(const Scene * /*scene*/, ModifierData *md, bool /*use_render_params*/)
880{
881 ArrayModifierData *amd = reinterpret_cast<ArrayModifierData *>(md);
882
883 /* The object type check is only needed here in case we have a placeholder
884 * object assigned (because the library containing the curve/mesh is missing).
885 *
886 * In other cases it should be impossible to have a type mismatch.
887 */
888
889 if (amd->curve_ob && amd->curve_ob->type != OB_CURVES_LEGACY) {
890 return true;
891 }
892 if (amd->start_cap && amd->start_cap->type != OB_MESH) {
893 return true;
894 }
895 if (amd->end_cap && amd->end_cap->type != OB_MESH) {
896 return true;
897 }
898
899 return false;
900}
901
902static void panel_draw(const bContext * /*C*/, Panel *panel)
903{
904 ui::Layout &layout = *panel->layout;
905
906 PointerRNA ob_ptr;
908
909 layout.use_property_split_set(true);
910
911 layout.prop(ptr, "fit_type", UI_ITEM_NONE, std::nullopt, ICON_NONE);
912
913 int fit_type = RNA_enum_get(ptr, "fit_type");
914 if (fit_type == MOD_ARR_FIXEDCOUNT) {
915 layout.prop(ptr, "count", UI_ITEM_NONE, std::nullopt, ICON_NONE);
916 }
917 else if (fit_type == MOD_ARR_FITLENGTH) {
918 layout.prop(ptr, "fit_length", UI_ITEM_NONE, std::nullopt, ICON_NONE);
919 }
920 else if (fit_type == MOD_ARR_FITCURVE) {
921 layout.prop(ptr, "curve", UI_ITEM_NONE, std::nullopt, ICON_NONE);
922 }
923
924 modifier_error_message_draw(layout, ptr);
925}
926
927static void relative_offset_header_draw(const bContext * /*C*/, Panel *panel)
928{
929 ui::Layout &layout = *panel->layout;
930
932
933 layout.prop(ptr, "use_relative_offset", UI_ITEM_NONE, std::nullopt, ICON_NONE);
934}
935
936static void relative_offset_draw(const bContext * /*C*/, Panel *panel)
937{
938 ui::Layout &layout = *panel->layout;
939
941
942 layout.use_property_split_set(true);
943
944 ui::Layout &col = layout.column(false);
945
946 col.active_set(RNA_boolean_get(ptr, "use_relative_offset"));
947 col.prop(ptr, "relative_offset_displace", UI_ITEM_NONE, IFACE_("Factor"), ICON_NONE);
948}
949
950static void constant_offset_header_draw(const bContext * /*C*/, Panel *panel)
951{
952 ui::Layout &layout = *panel->layout;
953
955
956 layout.prop(ptr, "use_constant_offset", UI_ITEM_NONE, std::nullopt, ICON_NONE);
957}
958
959static void constant_offset_draw(const bContext * /*C*/, Panel *panel)
960{
961 ui::Layout &layout = *panel->layout;
962
964
965 layout.use_property_split_set(true);
966
967 ui::Layout &col = layout.column(false);
968
969 col.active_set(RNA_boolean_get(ptr, "use_constant_offset"));
970 col.prop(ptr, "constant_offset_displace", UI_ITEM_NONE, IFACE_("Distance"), ICON_NONE);
971}
972
976static void object_offset_header_draw(const bContext * /*C*/, Panel *panel)
977{
978 ui::Layout &layout = *panel->layout;
979
981
982 layout.prop(ptr, "use_object_offset", UI_ITEM_NONE, std::nullopt, ICON_NONE);
983}
984
985static void object_offset_draw(const bContext * /*C*/, Panel *panel)
986{
987 ui::Layout &layout = *panel->layout;
988
990
991 layout.use_property_split_set(true);
992
993 ui::Layout &col = layout.column(false);
994
995 col.active_set(RNA_boolean_get(ptr, "use_object_offset"));
996 col.prop(ptr, "offset_object", UI_ITEM_NONE, IFACE_("Object"), ICON_NONE);
997}
998
999static void symmetry_panel_header_draw(const bContext * /*C*/, Panel *panel)
1000{
1001 ui::Layout &layout = *panel->layout;
1002
1003 PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr);
1004
1005 layout.prop(ptr, "use_merge_vertices", UI_ITEM_NONE, IFACE_("Merge"), ICON_NONE);
1006}
1007
1008static void symmetry_panel_draw(const bContext * /*C*/, Panel *panel)
1009{
1010 ui::Layout &layout = *panel->layout;
1011
1012 PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr);
1013
1014 layout.use_property_split_set(true);
1015
1016 ui::Layout &col = layout.column(false);
1017 col.active_set(RNA_boolean_get(ptr, "use_merge_vertices"));
1018 col.prop(ptr, "merge_threshold", UI_ITEM_NONE, IFACE_("Distance"), ICON_NONE);
1019 col.prop(
1020 ptr, "use_merge_vertices_cap", UI_ITEM_NONE, IFACE_("First and Last Copies"), ICON_NONE);
1021}
1022
1023static void uv_panel_draw(const bContext * /*C*/, Panel *panel)
1024{
1025 ui::Layout &layout = *panel->layout;
1026
1027 PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr);
1028
1029 layout.use_property_split_set(true);
1030
1031 ui::Layout &col = layout.column(true);
1032 col.prop(ptr, "offset_u", ui::ITEM_R_EXPAND, IFACE_("Offset U"), ICON_NONE);
1033 col.prop(ptr, "offset_v", ui::ITEM_R_EXPAND, IFACE_("V"), ICON_NONE);
1034}
1035
1036static void caps_panel_draw(const bContext * /*C*/, Panel *panel)
1037{
1038 ui::Layout &layout = *panel->layout;
1039
1040 PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr);
1041
1042 layout.use_property_split_set(true);
1043
1044 ui::Layout &col = layout.column(false);
1045 col.prop(ptr, "start_cap", UI_ITEM_NONE, IFACE_("Cap Start"), ICON_NONE);
1046 col.prop(ptr, "end_cap", UI_ITEM_NONE, IFACE_("End"), ICON_NONE);
1047}
1048
1049static void panel_register(ARegionType *region_type)
1050{
1052 modifier_subpanel_register(region_type,
1053 "relative_offset",
1054 "",
1057 panel_type);
1058 modifier_subpanel_register(region_type,
1059 "constant_offset",
1060 "",
1063 panel_type);
1065 region_type, "object_offset", "", object_offset_header_draw, object_offset_draw, panel_type);
1067 region_type, "merge", "", symmetry_panel_header_draw, symmetry_panel_draw, panel_type);
1068 modifier_subpanel_register(region_type, "uv", "UVs", nullptr, uv_panel_draw, panel_type);
1069 modifier_subpanel_register(region_type, "caps", "Caps", nullptr, caps_panel_draw, panel_type);
1070}
1071
1073 /*idname*/ "Array",
1074 /*name*/ N_("Array"),
1075 /*struct_name*/ "ArrayModifierData",
1076 /*struct_size*/ sizeof(ArrayModifierData),
1077 /*srna*/ &RNA_ArrayModifier,
1082 /*icon*/ ICON_MOD_ARRAY,
1083
1084 /*copy_data*/ BKE_modifier_copydata_generic,
1085
1086 /*deform_verts*/ nullptr,
1087 /*deform_matrices*/ nullptr,
1088 /*deform_verts_EM*/ nullptr,
1089 /*deform_matrices_EM*/ nullptr,
1090 /*modify_mesh*/ modify_mesh,
1091 /*modify_geometry_set*/ nullptr,
1092
1093 /*init_data*/ init_data,
1094 /*required_data_mask*/ nullptr,
1095 /*free_data*/ nullptr,
1096 /*is_disabled*/ is_disabled,
1097 /*update_depsgraph*/ update_depsgraph,
1098 /*depends_on_time*/ nullptr,
1099 /*depends_on_normals*/ nullptr,
1100 /*foreach_ID_link*/ foreach_ID_link,
1101 /*foreach_tex_link*/ nullptr,
1102 /*free_runtime_data*/ nullptr,
1103 /*panel_register*/ panel_register,
1104 /*blend_write*/ nullptr,
1105 /*blend_read*/ nullptr,
1106 /*foreach_cache*/ nullptr,
1107 /*foreach_working_space_color*/ nullptr,
1108};
1109
1110} // namespace blender
CustomData interface, see also DNA_customdata_types.h.
#define ORIGINDEX_NONE
Functions for dealing with objects and deform verts, used by painting and tools.
#define M_SQRT3
#define mul_m4_series(...)
#define IFACE_(msgid)
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define UI_ITEM_NONE
#define BLI_INLINE
#define INIT_DEFAULT_STRUCT_AFTER(struct_dst, member)
#define ELEM(...)
constexpr IndexRange()=default
constexpr bool is_empty() const
Definition BLI_span.hh:515
constexpr MutableSpan take_front(const int64_t n) const
Definition BLI_span.hh:635
constexpr int64_t size() const
Definition BLI_span.hh:256
int64_t size() const
bool is_empty() const
MutableSpan< T > as_mutable_span()
void reinitialize(const int64_t new_size)
MutableBitSpan slice(const IndexRange range) const
void copy_from(const BitSpan other)
Definition bit_span.cc:66
GAttributeReader lookup(const StringRef name) const
void copy(int src_index, int dst_index, int count) const
GSpanAttributeWriter lookup_or_add_for_write_span(StringRef name, AttrDomain domain, AttrType data_type, const AttributeInit &initializer=AttributeInitDefaultValue())
GSpanAttributeWriter lookup_for_write_span(StringRef name)
constexpr void copy_from(Span< T > values) const
float length(VecOp< float, D >) RET
float3x3 scale(float3x3 mat, float2 scale)
void mesh_vert_normals_assign(Mesh &mesh, Span< float3 > vert_normals)
Mesh * mesh_merge_verts(const Mesh &mesh, Span< int > vert_src_to_target, int removed_verts_num, bool do_mix_data)
BMesh Iterators.
MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
@ UI_SUBPANEL_DATA_EXPAND_1
@ UI_PANEL_DATA_EXPAND_ROOT
MINLINE bool is_zero_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
int RNA_enum_get(PointerRNA *ptr, const char *name)
void BKE_modifier_set_error(const Object *ob, ModifierData *md, const char *format,...) ATTR_PRINTF_FORMAT(3
PointerRNA * modifier_panel_get_property_pointers(Panel *panel, PointerRNA *r_ob_ptr)
static void object_offset_draw(const bContext *, Panel *panel)
Definition MOD_array.cc:985
void DEG_add_special_eval_flag(DepsNodeHandle *handle, ID *id, uint32_t flag)
MINLINE void copy_v3_v3(float r[3], const float a[3])
unsigned int uint
Definition BKE_text.h:55
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
float mat4_to_scale(const float mat[4][4])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
static void dm_mvert_map_doubles(int *doubles_map, const Span< float3 > vert_positions, const int target_start, const int target_verts_num, const int source_start, const int source_verts_num, const float dist)
Definition MOD_array.cc:149
static void init_data(ModifierData *md)
void(*)(void *user_data, Object *ob, ID **idpoin, LibraryForeachIDCallbackFlag cb_flag) IDWalkFunc
static void update_depsgraph(tGraphSliderOp *gso)
static void foreach_ID_link(ModifierData *md, Object *ob, IDWalkFunc walk, void *user_data)
void BKE_mesh_wrapper_ensure_mdata(Mesh *mesh)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
ATTR_WARN_UNUSED_RESULT const BMVert * v
void DEG_add_object_relation(DepsNodeHandle *node_handle, Object *object, eDepsObjectComponentType component, const char *description)
void DEG_add_depends_on_transform_relation(DepsNodeHandle *node_handle, const char *description)
static void caps_panel_draw(const bContext *, Panel *panel)
static void mesh_merge_transform(Mesh *result, Mesh *cap_mesh, const float cap_offset[4][4], uint cap_verts_index, uint cap_edges_index, int cap_loops_index, int cap_faces_index, int cap_nverts, int cap_nedges, int cap_nloops, int cap_nfaces, int *remap, int remap_len, MutableSpan< float3 > dst_vert_normals)
Definition MOD_array.cc:268
static void symmetry_panel_draw(const bContext *, Panel *panel)
void mul_m4_v3(const float M[4][4], float r[3])
Mesh * BKE_modifier_get_evaluated_mesh_from_evaluated_object(Object *ob_eval)
void modifier_error_message_draw(ui::Layout &layout, PointerRNA *ptr)
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
static void symmetry_panel_header_draw(const bContext *, Panel *panel)
Definition MOD_array.cc:999
static void panel_register(ARegionType *region_type)
void BKE_object_defgroup_index_map_apply(struct MDeformVert *dvert, int dvert_len, const int *map, int map_len)
void unit_m4(float m[4][4])
static void constant_offset_draw(const bContext *, Panel *panel)
Definition MOD_array.cc:959
MINLINE bool is_one_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
static Mesh * modify_mesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
Definition MOD_array.cc:873
static void relative_offset_header_draw(const bContext *, Panel *panel)
Definition MOD_array.cc:927
void BKE_id_free(Main *bmain, void *idv)
@ eModifierTypeFlag_SupportsMapping
@ eModifierTypeFlag_AcceptsCVs
@ eModifierTypeFlag_EnableInEditmode
@ eModifierTypeFlag_SupportsEditmode
@ eModifierTypeFlag_AcceptsMesh
@ DAG_EVAL_NEED_CURVE_PATH
void mul_mat3_m4_v3(const float mat[4][4], float r[3])
void mat4_to_size(float size[3], const float M[4][4])
static void svert_from_mvert(SortVertsElem *sv, const Span< float3 > vert_positions, const int i_begin, const int i_end)
Definition MOD_array.cc:129
MINLINE float normalize_v3(float n[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
ModifierTypeInfo modifierType_Array
int * BKE_object_defgroup_index_map_create(struct Object *ob_src, struct Object *ob_dst, int *r_map_len)
static void object_offset_header_draw(const bContext *, Panel *panel)
Definition MOD_array.cc:976
static void constant_offset_header_draw(const bContext *, Panel *panel)
Definition MOD_array.cc:950
static void relative_offset_draw(const bContext *, Panel *panel)
Definition MOD_array.cc:936
PanelType * modifier_panel_register(ARegionType *region_type, ModifierType type, PanelDrawFn draw)
Mesh * BKE_mesh_new_nomain_from_template(const Mesh *me_src, int verts_num, int edges_num, int faces_num, int corners_num)
static void panel_draw(const bContext *, Panel *panel)
static int svert_sum_cmp(const void *e1, const void *e2)
Definition MOD_array.cc:114
PanelType * modifier_subpanel_register(ARegionType *region_type, const char *name, const char *label, PanelDrawFn draw_header, PanelDrawFn draw, PanelType *parent)
bool BKE_mesh_vert_normals_are_dirty(const Mesh *mesh)
float BKE_anim_path_get_length(const struct CurveCache *curve_cache)
void * CustomData_get_layer_for_write(CustomData *data, eCustomDataType type, int totelem)
void copy_m4_m4(float m1[4][4], const float m2[4][4])
static bool is_disabled(const Scene *, ModifierData *md, bool)
BLI_INLINE float sum_v3(const float v[3])
Definition MOD_array.cc:102
static Mesh * arrayModifier_doArray(ArrayModifierData *amd, const ModifierEvalContext *ctx, Mesh *mesh)
Definition MOD_array.cc:377
MINLINE bool compare_len_v3v3(const float v1[3], const float v2[3], float limit) ATTR_WARN_UNUSED_RESULT
static void uv_panel_draw(const bContext *, Panel *panel)
void BKE_modifier_copydata_generic(const ModifierData *md, ModifierData *md_dst, int flag)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
ArrayModifierFitType fit_type
ArrayModifierOffsetType offset_type
const float * anim_path_accum_length
Definition BKE_curve.hh:53
bke::MeshRuntime * runtime
bke::ObjectRuntime * runtime
ui::Layout * layout
void use_property_split_set(bool is_sep)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)
void active_set(bool active)
Layout & column(bool align)
#define N_(msgid)