Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/data_transfer.c
| Show First 20 Lines • Show All 1,199 Lines • ▼ Show 20 Lines | if (DT_DATATYPE_IS_VERT(dtdata_type)) { | ||||
| const int num_verts_src = dm_src->getNumVerts(dm_src); | const int num_verts_src = dm_src->getNumVerts(dm_src); | ||||
| if ((map_vert_mode == MREMAP_MODE_TOPOLOGY) && (num_verts_dst != num_verts_src)) { | if ((map_vert_mode == MREMAP_MODE_TOPOLOGY) && (num_verts_dst != num_verts_src)) { | ||||
| BKE_report(reports, RPT_ERROR, | BKE_report(reports, RPT_ERROR, | ||||
| "Source and destination meshes do not have the same amount of vertices, " | "Source and destination meshes do not have the same amount of vertices, " | ||||
| "'Topology' mapping cannot be used in this case"); | "'Topology' mapping cannot be used in this case"); | ||||
| continue; | continue; | ||||
| } | } | ||||
| if ((map_vert_mode & MREMAP_USE_EDGE) && (dm_src->getNumEdges(dm_src) == 0)) { | |||||
| BKE_report(reports, RPT_ERROR, | |||||
| "Source mesh doesn't have any edges, " | |||||
| "None of the 'Edge' mappings can be used in this case"); | |||||
| continue; | |||||
| } | |||||
| if ((map_vert_mode & MREMAP_USE_POLY) && (dm_src->getNumPolys(dm_src) == 0)) { | |||||
| BKE_report(reports, RPT_ERROR, | |||||
| "Source mesh doesn't have any faces, " | |||||
| "None of the 'Face' mappings can be used in this case"); | |||||
mont29: Let’s stick to the word 'polygon', as in the other error messages here. | |||||
| continue; | |||||
| } | |||||
| if (ELEM(0, num_verts_dst, num_verts_src)) { | if (ELEM(0, num_verts_dst, num_verts_src)) { | ||||
| BKE_report(reports, RPT_ERROR, | BKE_report(reports, RPT_ERROR, | ||||
| "Source or destination meshes do not have any vertices, cannot transfer vertex data"); | "Source or destination meshes do not have any vertices, cannot transfer vertex data"); | ||||
| continue; | continue; | ||||
| } | } | ||||
| BKE_mesh_remap_calc_verts_from_dm( | BKE_mesh_remap_calc_verts_from_dm( | ||||
| map_vert_mode, space_transform, max_distance, ray_radius, | map_vert_mode, space_transform, max_distance, ray_radius, | ||||
| Show All 32 Lines | if (DT_DATATYPE_IS_EDGE(dtdata_type)) { | ||||
| const int num_edges_src = dm_src->getNumEdges(dm_src); | const int num_edges_src = dm_src->getNumEdges(dm_src); | ||||
| if ((map_edge_mode == MREMAP_MODE_TOPOLOGY) && (num_edges_dst != num_edges_src)) { | if ((map_edge_mode == MREMAP_MODE_TOPOLOGY) && (num_edges_dst != num_edges_src)) { | ||||
| BKE_report(reports, RPT_ERROR, | BKE_report(reports, RPT_ERROR, | ||||
| "Source and destination meshes do not have the same amount of edges, " | "Source and destination meshes do not have the same amount of edges, " | ||||
| "'Topology' mapping cannot be used in this case"); | "'Topology' mapping cannot be used in this case"); | ||||
| continue; | continue; | ||||
| } | } | ||||
| if ((map_edge_mode & MREMAP_USE_POLY) && (dm_src->getNumPolys(dm_src) == 0)) { | |||||
| BKE_report(reports, RPT_ERROR, | |||||
| "Source mesh doesn't have any faces, " | |||||
| "None of the 'Face' mappings can be used in this case"); | |||||
| continue; | |||||
| } | |||||
Not Done Inline ActionsNot needed, number of edges in src and dst is checked below anyway. mont29: Not needed, number of edges in src and dst is checked below anyway. | |||||
| if (ELEM(0, num_edges_dst, num_edges_src)) { | if (ELEM(0, num_edges_dst, num_edges_src)) { | ||||
| BKE_report(reports, RPT_ERROR, | BKE_report(reports, RPT_ERROR, | ||||
| "Source or destination meshes do not have any edges, cannot transfer edge data"); | "Source or destination meshes do not have any edges, cannot transfer edge data"); | ||||
| continue; | continue; | ||||
Not Done Inline ActionsLet’s stick to the word 'polygon', as in the other error messages here. mont29: Let’s stick to the word 'polygon', as in the other error messages here. | |||||
| } | } | ||||
| BKE_mesh_remap_calc_edges_from_dm( | BKE_mesh_remap_calc_edges_from_dm( | ||||
| map_edge_mode, space_transform, max_distance, ray_radius, | map_edge_mode, space_transform, max_distance, ray_radius, | ||||
| verts_dst, num_verts_dst, edges_dst, num_edges_dst, dirty_nors_dst, | verts_dst, num_verts_dst, edges_dst, num_edges_dst, dirty_nors_dst, | ||||
| dm_src, &geom_map[EDATA]); | dm_src, &geom_map[EDATA]); | ||||
| geom_map_init[EDATA] = true; | geom_map_init[EDATA] = true; | ||||
| } | } | ||||
| Show All 39 Lines | if (DT_DATATYPE_IS_LOOP(dtdata_type)) { | ||||
| const int num_loops_src = dm_src->getNumLoops(dm_src); | const int num_loops_src = dm_src->getNumLoops(dm_src); | ||||
| if ((map_loop_mode == MREMAP_MODE_TOPOLOGY) && (num_loops_dst != num_loops_src)) { | if ((map_loop_mode == MREMAP_MODE_TOPOLOGY) && (num_loops_dst != num_loops_src)) { | ||||
| BKE_report(reports, RPT_ERROR, | BKE_report(reports, RPT_ERROR, | ||||
| "Source and destination meshes do not have the same amount of face corners, " | "Source and destination meshes do not have the same amount of face corners, " | ||||
| "'Topology' mapping cannot be used in this case"); | "'Topology' mapping cannot be used in this case"); | ||||
| continue; | continue; | ||||
| } | } | ||||
| if ((map_loop_mode & MREMAP_USE_EDGE) && (dm_src->getNumEdges(dm_src) == 0)) { | |||||
| BKE_report(reports, RPT_ERROR, | |||||
| "Source mesh doesn't have any edges, " | |||||
| "None of the 'Edge' mappings can be used in this case"); | |||||
| continue; | |||||
| } | |||||
| if (ELEM(0, num_loops_dst, num_loops_src)) { | if (ELEM(0, num_loops_dst, num_loops_src)) { | ||||
| BKE_report(reports, RPT_ERROR, | BKE_report(reports, RPT_ERROR, | ||||
| "Source or destination meshes do not have any polygons, cannot transfer loop data"); | "Source or destination meshes do not have any faces, cannot transfer corner data"); | ||||
| continue; | continue; | ||||
| } | } | ||||
| BKE_mesh_remap_calc_loops_from_dm( | BKE_mesh_remap_calc_loops_from_dm( | ||||
| map_loop_mode, space_transform, max_distance, ray_radius, | map_loop_mode, space_transform, max_distance, ray_radius, | ||||
| verts_dst, num_verts_dst, edges_dst, num_edges_dst, | verts_dst, num_verts_dst, edges_dst, num_edges_dst, | ||||
| loops_dst, num_loops_dst, polys_dst, num_polys_dst, | loops_dst, num_loops_dst, polys_dst, num_polys_dst, | ||||
| ldata_dst, pdata_dst, | ldata_dst, pdata_dst, | ||||
| (me_dst->flag & ME_AUTOSMOOTH) != 0, me_dst->smoothresh, dirty_nors_dst, | (me_dst->flag & ME_AUTOSMOOTH) != 0, me_dst->smoothresh, dirty_nors_dst, | ||||
Not Done Inline ActionsNot needed, number of polys in src and dst is checked below anyway. mont29: Not needed, number of polys in src and dst is checked below anyway. | |||||
| dm_src, (me_src->flag & ME_AUTOSMOOTH) != 0, me_src->smoothresh, | dm_src, (me_src->flag & ME_AUTOSMOOTH) != 0, me_src->smoothresh, | ||||
| island_callback, islands_handling_precision, &geom_map[LDATA]); | island_callback, islands_handling_precision, &geom_map[LDATA]); | ||||
| geom_map_init[LDATA] = true; | geom_map_init[LDATA] = true; | ||||
| } | } | ||||
| if (mdef && vg_idx != -1 && !weights[LDATA]) { | if (mdef && vg_idx != -1 && !weights[LDATA]) { | ||||
| weights[LDATA] = MEM_mallocN(sizeof(*weights[LDATA]) * (size_t)num_loops_dst, __func__); | weights[LDATA] = MEM_mallocN(sizeof(*weights[LDATA]) * (size_t)num_loops_dst, __func__); | ||||
| BKE_defvert_extract_vgroup_to_loopweights( | BKE_defvert_extract_vgroup_to_loopweights( | ||||
| Show All 30 Lines | if (DT_DATATYPE_IS_POLY(dtdata_type)) { | ||||
| const int num_polys_src = dm_src->getNumPolys(dm_src); | const int num_polys_src = dm_src->getNumPolys(dm_src); | ||||
| if ((map_poly_mode == MREMAP_MODE_TOPOLOGY) && (num_polys_dst != num_polys_src)) { | if ((map_poly_mode == MREMAP_MODE_TOPOLOGY) && (num_polys_dst != num_polys_src)) { | ||||
| BKE_report(reports, RPT_ERROR, | BKE_report(reports, RPT_ERROR, | ||||
| "Source and destination meshes do not have the same amount of faces, " | "Source and destination meshes do not have the same amount of faces, " | ||||
| "'Topology' mapping cannot be used in this case"); | "'Topology' mapping cannot be used in this case"); | ||||
| continue; | continue; | ||||
| } | } | ||||
| if ((map_poly_mode & MREMAP_USE_EDGE) && (dm_src->getNumEdges(dm_src) == 0)) { | |||||
| BKE_report(reports, RPT_ERROR, | |||||
| "Source mesh doesn't have any edges, " | |||||
| "None of the 'Edge' mappings can be used in this case"); | |||||
| continue; | |||||
| } | |||||
| if (ELEM(0, num_polys_dst, num_polys_src)) { | if (ELEM(0, num_polys_dst, num_polys_src)) { | ||||
| BKE_report(reports, RPT_ERROR, | BKE_report(reports, RPT_ERROR, | ||||
| "Source or destination meshes do not have any polygons, cannot transfer poly data"); | "Source or destination meshes do not have any faces, cannot transfer face data"); | ||||
| continue; | continue; | ||||
| } | } | ||||
| BKE_mesh_remap_calc_polys_from_dm( | BKE_mesh_remap_calc_polys_from_dm( | ||||
| map_poly_mode, space_transform, max_distance, ray_radius, | map_poly_mode, space_transform, max_distance, ray_radius, | ||||
| verts_dst, num_verts_dst, loops_dst, num_loops_dst, | verts_dst, num_verts_dst, loops_dst, num_loops_dst, | ||||
| polys_dst, num_polys_dst, pdata_dst, dirty_nors_dst, | polys_dst, num_polys_dst, pdata_dst, dirty_nors_dst, | ||||
| dm_src, &geom_map[PDATA]); | dm_src, &geom_map[PDATA]); | ||||
| geom_map_init[PDATA] = true; | geom_map_init[PDATA] = true; | ||||
| } | } | ||||
| if (mdef && vg_idx != -1 && !weights[PDATA]) { | if (mdef && vg_idx != -1 && !weights[PDATA]) { | ||||
| weights[PDATA] = MEM_mallocN(sizeof(*weights[PDATA]) * (size_t)num_polys_dst, __func__); | weights[PDATA] = MEM_mallocN(sizeof(*weights[PDATA]) * (size_t)num_polys_dst, __func__); | ||||
| BKE_defvert_extract_vgroup_to_polyweights( | BKE_defvert_extract_vgroup_to_polyweights( | ||||
| mdef, vg_idx, num_verts_dst, loops_dst, num_loops_dst, | mdef, vg_idx, num_verts_dst, loops_dst, num_loops_dst, | ||||
Not Done Inline ActionsNot needed, number of polys in src and dst is checked below anyway. mont29: Not needed, number of polys in src and dst is checked below anyway. | |||||
| polys_dst, num_polys_dst, weights[PDATA], invert_vgroup); | polys_dst, num_polys_dst, weights[PDATA], invert_vgroup); | ||||
| } | } | ||||
| if (data_transfer_layersmapping_generate( | if (data_transfer_layersmapping_generate( | ||||
| &lay_map, ob_src, ob_dst, dm_src, dm_dst, me_dst, ME_POLY, | &lay_map, ob_src, ob_dst, dm_src, dm_dst, me_dst, ME_POLY, | ||||
| cddata_type, mix_mode, mix_factor, weights[PDATA], | cddata_type, mix_mode, mix_factor, weights[PDATA], | ||||
| num_polys_dst, use_create, use_delete, fromlayers, tolayers, space_transform)) | num_polys_dst, use_create, use_delete, fromlayers, tolayers, space_transform)) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines | |||||
Let’s stick to the word 'polygon', as in the other error messages here.