Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_array.c
| Context not available. | |||||
| #include "BKE_library_query.h" | #include "BKE_library_query.h" | ||||
| #include "BKE_modifier.h" | #include "BKE_modifier.h" | ||||
| #include "BKE_mesh.h" | #include "BKE_mesh.h" | ||||
| #include "BKE_object_deform.h" | |||||
| #include "MOD_util.h" | #include "MOD_util.h" | ||||
| Context not available. | |||||
| static void dm_merge_transform( | static void dm_merge_transform( | ||||
| DerivedMesh *result, DerivedMesh *cap_dm, float cap_offset[4][4], | DerivedMesh *result, DerivedMesh *cap_dm, float cap_offset[4][4], | ||||
| unsigned int cap_verts_index, unsigned int cap_edges_index, int cap_loops_index, int cap_polys_index, | unsigned int cap_verts_index, unsigned int cap_edges_index, int cap_loops_index, int cap_polys_index, | ||||
| int cap_nverts, int cap_nedges, int cap_nloops, int cap_npolys) | int cap_nverts, int cap_nedges, int cap_nloops, int cap_npolys, int *remap, int remap_size) | ||||
mont29: should be `int *remap` | |||||
| { | { | ||||
| int *index_orig; | int *index_orig; | ||||
| int i; | int i; | ||||
| Context not available. | |||||
| MEdge *me; | MEdge *me; | ||||
| MLoop *ml; | MLoop *ml; | ||||
| MPoly *mp; | MPoly *mp; | ||||
| MDeformVert *dvert; | |||||
Done Inline ActionsConvention for naming is dvert campbellbarton: Convention for naming is `dvert` | |||||
| /* needed for subsurf so arrays are allocated */ | /* needed for subsurf so arrays are allocated */ | ||||
| cap_dm->getVertArray(cap_dm); | cap_dm->getVertArray(cap_dm); | ||||
| Context not available. | |||||
| mv->flag = mv->bweight = 0; | mv->flag = mv->bweight = 0; | ||||
| } | } | ||||
| /* remap the vertex groups if necessary */ | |||||
| dvert = DM_get_vert_data(result, cap_verts_index, CD_MDEFORMVERT); | |||||
| if (dvert != NULL) { | |||||
| BKE_object_defgroup_index_map_apply(dvert, cap_nverts, remap, remap_size); | |||||
| } | |||||
| /* adjust cap edge vertex indices */ | /* adjust cap edge vertex indices */ | ||||
| me = CDDM_get_edges(result) + cap_edges_index; | me = CDDM_get_edges(result) + cap_edges_index; | ||||
| for (i = 0; i < cap_nedges; i++, me++) { | for (i = 0; i < cap_nedges; i++, me++) { | ||||
Not Done Inline ActionsIt should be freed, since order isn't important, it can be swap with the last item, then realloc'd to a smaller array after remapping is done for this vertex. campbellbarton: It should be freed, since order isn't important, it can be swap with the last item, then… | |||||
Not Done Inline ActionsCan use single call to: defgroup_name_index campbellbarton: Can use single call to: `defgroup_name_index` | |||||
| Context not available. | |||||
| DerivedMesh *result, *start_cap_dm = NULL, *end_cap_dm = NULL; | DerivedMesh *result, *start_cap_dm = NULL, *end_cap_dm = NULL; | ||||
| int *vgroup_start_cap_remap = NULL; | |||||
| int vgroup_start_cap_remap_size = 0; | |||||
| int *vgroup_end_cap_remap = NULL; | |||||
| int vgroup_end_cap_remap_size = 0; | |||||
| chunk_nverts = dm->getNumVerts(dm); | chunk_nverts = dm->getNumVerts(dm); | ||||
| chunk_nedges = dm->getNumEdges(dm); | chunk_nedges = dm->getNumEdges(dm); | ||||
| chunk_nloops = dm->getNumLoops(dm); | chunk_nloops = dm->getNumLoops(dm); | ||||
| Context not available. | |||||
| count = amd->count; | count = amd->count; | ||||
| if (amd->start_cap && amd->start_cap != ob && amd->start_cap->type == OB_MESH) { | if (amd->start_cap && amd->start_cap != ob && amd->start_cap->type == OB_MESH) { | ||||
| vgroup_start_cap_remap = BKE_object_defgroup_index_map_create(amd->start_cap, ob, &vgroup_start_cap_remap_size); | |||||
| start_cap_dm = get_dm_for_modifier(amd->start_cap, flag); | start_cap_dm = get_dm_for_modifier(amd->start_cap, flag); | ||||
| if (start_cap_dm) { | if (start_cap_dm) { | ||||
| start_cap_nverts = start_cap_dm->getNumVerts(start_cap_dm); | start_cap_nverts = start_cap_dm->getNumVerts(start_cap_dm); | ||||
| Context not available. | |||||
| } | } | ||||
| } | } | ||||
| if (amd->end_cap && amd->end_cap != ob && amd->end_cap->type == OB_MESH) { | if (amd->end_cap && amd->end_cap != ob && amd->end_cap->type == OB_MESH) { | ||||
| vgroup_end_cap_remap = BKE_object_defgroup_index_map_create(amd->end_cap, ob, &vgroup_end_cap_remap_size); | |||||
| end_cap_dm = get_dm_for_modifier(amd->end_cap, flag); | end_cap_dm = get_dm_for_modifier(amd->end_cap, flag); | ||||
| if (end_cap_dm) { | if (end_cap_dm) { | ||||
| end_cap_nverts = end_cap_dm->getNumVerts(end_cap_dm); | end_cap_nverts = end_cap_dm->getNumVerts(end_cap_dm); | ||||
| Context not available. | |||||
| result_nedges - start_cap_nedges - end_cap_nedges, | result_nedges - start_cap_nedges - end_cap_nedges, | ||||
| result_nloops - start_cap_nloops - end_cap_nloops, | result_nloops - start_cap_nloops - end_cap_nloops, | ||||
| result_npolys - start_cap_npolys - end_cap_npolys, | result_npolys - start_cap_npolys - end_cap_npolys, | ||||
| start_cap_nverts, start_cap_nedges, start_cap_nloops, start_cap_npolys); | start_cap_nverts, start_cap_nedges, start_cap_nloops, start_cap_npolys, | ||||
| vgroup_start_cap_remap, vgroup_start_cap_remap_size); | |||||
| /* Identify doubles with first chunk */ | /* Identify doubles with first chunk */ | ||||
| if (use_merge) { | if (use_merge) { | ||||
| dm_mvert_map_doubles( | dm_mvert_map_doubles( | ||||
| Context not available. | |||||
| result_nedges - end_cap_nedges, | result_nedges - end_cap_nedges, | ||||
| result_nloops - end_cap_nloops, | result_nloops - end_cap_nloops, | ||||
| result_npolys - end_cap_npolys, | result_npolys - end_cap_npolys, | ||||
| end_cap_nverts, end_cap_nedges, end_cap_nloops, end_cap_npolys); | end_cap_nverts, end_cap_nedges, end_cap_nloops, end_cap_npolys, | ||||
| vgroup_end_cap_remap, vgroup_end_cap_remap_size); | |||||
| /* Identify doubles with last chunk */ | /* Identify doubles with last chunk */ | ||||
| if (use_merge) { | if (use_merge) { | ||||
| dm_mvert_map_doubles( | dm_mvert_map_doubles( | ||||
| Context not available. | |||||
| result->dirty |= DM_DIRTY_NORMALS; | result->dirty |= DM_DIRTY_NORMALS; | ||||
| } | } | ||||
| if (vgroup_start_cap_remap) { | |||||
| MEM_freeN(vgroup_start_cap_remap); | |||||
| } | |||||
| if (vgroup_end_cap_remap) { | |||||
| MEM_freeN(vgroup_end_cap_remap); | |||||
| } | |||||
| return result; | return result; | ||||
| } | } | ||||
| Context not available. | |||||
should be int *remap