Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-08-13 13:21:29 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-08-13 13:37:18 +0300
commitf8a499b596b8af46201b86a30c9807ca54363e25 (patch)
tree8ce53c7fb9c598deda0141f3eecf7d316b8c24b1 /source/blender/blenkernel/intern/subdiv_mesh.c
parent33fbc4fbea14a17d71eacf2c152d51518737df35 (diff)
OpenSubdiv: Add stub implementation of C-API
C-API is way smaller than the rest of the code which uses it. So better to conditionally compile stub implementation than to keep adding ifdef everywhere.
Diffstat (limited to 'source/blender/blenkernel/intern/subdiv_mesh.c')
-rw-r--r--source/blender/blenkernel/intern/subdiv_mesh.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/subdiv_mesh.c b/source/blender/blenkernel/intern/subdiv_mesh.c
index bb27cb6a31e..3bc39732118 100644
--- a/source/blender/blenkernel/intern/subdiv_mesh.c
+++ b/source/blender/blenkernel/intern/subdiv_mesh.c
@@ -227,7 +227,7 @@ static void subdiv_mesh_ctx_count(SubdivMeshContext *ctx)
num_polys_per_ptex_get(no_quad_patch_resolution);
}
}
- /* Calculate extra edges createdd by loose edges. */
+ /* Calculate extra vertices createdd by loose edges. */
for (int edge_index = 0; edge_index < coarse_mesh->totedge; edge_index++) {
if (!BLI_BITMAP_TEST_BOOL(ctx->coarse_edges_used_map, edge_index)) {
ctx->num_subdiv_vertices += num_subdiv_vertices_per_coarse_edge;
@@ -2388,7 +2388,18 @@ Mesh *BKE_subdiv_to_mesh(
/* Make sure evaluator is up to date with possible new topology, and that
* is is refined for the new positions of coarse vertices.
*/
- BKE_subdiv_eval_update_from_mesh(subdiv, coarse_mesh);
+ if (!BKE_subdiv_eval_update_from_mesh(subdiv, coarse_mesh)) {
+ /* This could happen in two situations:
+ * - OpenSubdiv is disabled.
+ * - Something totally bad happened, and OpenSubdiv rejected our
+ * topology.
+ * In either way, we can't safely continue.
+ */
+ if (coarse_mesh->totpoly) {
+ BKE_subdiv_stats_end(&subdiv->stats, SUBDIV_STATS_SUBDIV_TO_MESH);
+ return NULL;
+ }
+ }
SubdivMeshContext ctx = {0};
ctx.coarse_mesh = coarse_mesh;
ctx.subdiv = subdiv;