Commit: 2e15618f498c5a64c012f559bbb95273e729999a Author: Luca Rood Date: Sun Dec 11 20:10:01 2016 -0200 Branches: master https://developer.blender.org/rB2e15618f498c5a64c012f559bbb95273e729999a
Fix T50216: Missing checks caused data transfer segfault Data transfer was not checking if the required geometry existed, thus causing a segfault when it didn't. This adds the required checks, and reports errors if geometry is missing. This also replaces instances of the words "polygon" and "loop" in error messages with "face" and "corner" respectively, to be consistent with the rest of the existing UI. Reviewed By: mont29 Differential Revision: http://developer.blender.org/D2410 =================================================================== M source/blender/blenkernel/intern/data_transfer.c =================================================================== diff --git a/source/blender/blenkernel/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c index 839673c..3bc09c0 100644 --- a/source/blender/blenkernel/intern/data_transfer.c +++ b/source/blender/blenkernel/intern/data_transfer.c @@ -1205,6 +1205,18 @@ bool BKE_object_data_transfer_dm( "'Topology' mapping cannot be used in this case"); 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"); + continue; + } if (ELEM(0, num_verts_dst, num_verts_src)) { BKE_report(reports, RPT_ERROR, "Source or destination meshes do not have any vertices, cannot transfer vertex data"); @@ -1253,6 +1265,12 @@ bool BKE_object_data_transfer_dm( "'Topology' mapping cannot be used in this case"); 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; + } if (ELEM(0, num_edges_dst, num_edges_src)) { BKE_report(reports, RPT_ERROR, "Source or destination meshes do not have any edges, cannot transfer edge data"); @@ -1312,9 +1330,15 @@ bool BKE_object_data_transfer_dm( "'Topology' mapping cannot be used in this case"); 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)) { 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; } @@ -1370,9 +1394,15 @@ bool BKE_object_data_transfer_dm( "'Topology' mapping cannot be used in this case"); 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)) { 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; } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs