Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_array.c
| Show First 20 Lines • Show All 368 Lines • ▼ Show 20 Lines | static Mesh *arrayModifier_doArray( | ||||
| chunk_nverts = mesh->totvert; | chunk_nverts = mesh->totvert; | ||||
| chunk_nedges = mesh->totedge; | chunk_nedges = mesh->totedge; | ||||
| chunk_nloops = mesh->totloop; | chunk_nloops = mesh->totloop; | ||||
| chunk_npolys = mesh->totpoly; | chunk_npolys = mesh->totpoly; | ||||
| count = amd->count; | count = amd->count; | ||||
| Object *start_cap_ob = DEG_get_evaluated_object(ctx->depsgraph, amd->start_cap); | Object *start_cap_ob = amd->start_cap; | ||||
| if (start_cap_ob && start_cap_ob != ctx->object && start_cap_ob->type == OB_MESH) { | if (start_cap_ob && start_cap_ob != ctx->object && start_cap_ob->type == OB_MESH) { | ||||
| vgroup_start_cap_remap = BKE_object_defgroup_index_map_create( | vgroup_start_cap_remap = BKE_object_defgroup_index_map_create( | ||||
| start_cap_ob, ctx->object, &vgroup_start_cap_remap_len); | start_cap_ob, ctx->object, &vgroup_start_cap_remap_len); | ||||
| start_cap_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(start_cap_ob, false); | start_cap_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(start_cap_ob, false); | ||||
| if (start_cap_mesh) { | if (start_cap_mesh) { | ||||
| start_cap_nverts = start_cap_mesh->totvert; | start_cap_nverts = start_cap_mesh->totvert; | ||||
| start_cap_nedges = start_cap_mesh->totedge; | start_cap_nedges = start_cap_mesh->totedge; | ||||
| start_cap_nloops = start_cap_mesh->totloop; | start_cap_nloops = start_cap_mesh->totloop; | ||||
| start_cap_npolys = start_cap_mesh->totpoly; | start_cap_npolys = start_cap_mesh->totpoly; | ||||
| } | } | ||||
| } | } | ||||
| Object *end_cap_ob = DEG_get_evaluated_object(ctx->depsgraph, amd->end_cap); | Object *end_cap_ob = amd->end_cap; | ||||
| if (end_cap_ob && end_cap_ob != ctx->object && end_cap_ob->type == OB_MESH) { | if (end_cap_ob && end_cap_ob != ctx->object && end_cap_ob->type == OB_MESH) { | ||||
| vgroup_end_cap_remap = BKE_object_defgroup_index_map_create( | vgroup_end_cap_remap = BKE_object_defgroup_index_map_create( | ||||
| end_cap_ob, ctx->object, &vgroup_end_cap_remap_len); | end_cap_ob, ctx->object, &vgroup_end_cap_remap_len); | ||||
| end_cap_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(end_cap_ob, false); | end_cap_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(end_cap_ob, false); | ||||
| if (end_cap_mesh) { | if (end_cap_mesh) { | ||||
| end_cap_nverts = end_cap_mesh->totvert; | end_cap_nverts = end_cap_mesh->totvert; | ||||
| end_cap_nedges = end_cap_mesh->totedge; | end_cap_nedges = end_cap_mesh->totedge; | ||||
| Show All 29 Lines | if (use_offset_ob) { | ||||
| float obinv[4][4]; | float obinv[4][4]; | ||||
| float result_mat[4][4]; | float result_mat[4][4]; | ||||
| if (ctx->object) | if (ctx->object) | ||||
| invert_m4_m4(obinv, ctx->object->obmat); | invert_m4_m4(obinv, ctx->object->obmat); | ||||
| else | else | ||||
| unit_m4(obinv); | unit_m4(obinv); | ||||
| mul_m4_series(result_mat, offset, obinv, DEG_get_evaluated_object(ctx->depsgraph, amd->offset_ob)->obmat); | mul_m4_series(result_mat, offset, obinv, amd->offset_ob->obmat); | ||||
| copy_m4_m4(offset, result_mat); | copy_m4_m4(offset, result_mat); | ||||
| } | } | ||||
| /* Check if there is some scaling. If scaling, then we will not translate mapping */ | /* Check if there is some scaling. If scaling, then we will not translate mapping */ | ||||
| mat4_to_size(scale, offset); | mat4_to_size(scale, offset); | ||||
| offset_has_scale = !is_one_v3(scale); | offset_has_scale = !is_one_v3(scale); | ||||
| if (amd->fit_type == MOD_ARR_FITCURVE && amd->curve_ob != NULL) { | if (amd->fit_type == MOD_ARR_FITCURVE && amd->curve_ob != NULL) { | ||||
| Object *curve_ob = DEG_get_evaluated_object(ctx->depsgraph, amd->curve_ob); | Object *curve_ob = amd->curve_ob; | ||||
| Curve *cu = curve_ob->data; | Curve *cu = curve_ob->data; | ||||
| if (cu) { | if (cu) { | ||||
| CurveCache *curve_cache = curve_ob->runtime.curve_cache; | CurveCache *curve_cache = curve_ob->runtime.curve_cache; | ||||
| if (curve_cache != NULL && curve_cache->path != NULL) { | if (curve_cache != NULL && curve_cache->path != NULL) { | ||||
| float scale_fac = mat4_to_scale(curve_ob->obmat); | float scale_fac = mat4_to_scale(curve_ob->obmat); | ||||
| length = scale_fac * curve_cache->path->totdist; | length = scale_fac * curve_cache->path->totdist; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 328 Lines • Show Last 20 Lines | |||||