diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-05-29 12:24:25 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-06-01 11:24:18 +0400 |
commit | edfd989e864f2c87d2bbceef1acf88bbb46db497 (patch) | |
tree | 95b0ca9d7eb437eaa1e509a7c4276ab33c769fd2 | |
parent | c641baa0479236ed366d55f673f36ad426ab8f7d (diff) |
Fix T40315: Boolean modifier with Freestyle edges.
The helper function `make_freestyle_edge_mark_hash()` was referring to the
original mesh to determine Freestyle edge marks for individual derived mesh edges.
This is no longer necessary now that derived meshes deliver CD_FREESTYLE_EDGE
and CD_FREESTYLE_FACE layers of their own. The reference of the original mesh
was also inappropriate since the edges coming from one of the operands of a boolean
modifier don't have proper CD_ORIGINDEX values but ORIGINDEX_NONE's.
Many thanks to Sergey Sharybin for patch contributions and discussions.
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 6 | ||||
-rw-r--r-- | source/blender/render/intern/source/convertblender.c | 27 |
2 files changed, 12 insertions, 21 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 3ea535ef97a..745088aced2 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2907,6 +2907,12 @@ void BKE_object_handle_update_ex(EvaluationContext *eval_ctx, { BMEditMesh *em = (ob == scene->obedit) ? BKE_editmesh_from_object(ob) : NULL; uint64_t data_mask = scene->customdata_mask | CD_MASK_BAREMESH; +#ifdef WITH_FREESTYLE + /* make sure Freestyle edge/face marks appear in DM for render (see T40315) */ + if (eval_ctx->for_render) { + data_mask |= CD_MASK_FREESTYLE_EDGE | CD_MASK_FREESTYLE_FACE; + } +#endif if (em) { makeDerivedMesh(scene, ob, em, data_mask, 0); /* was CD_MASK_BAREMESH */ } diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 3cbbebb069e..b28d1debfec 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -3063,36 +3063,21 @@ static void add_volume(Render *re, ObjectRen *obr, Material *ma) } #ifdef WITH_FREESTYLE -static EdgeHash *make_freestyle_edge_mark_hash(Mesh *me, DerivedMesh *dm) +static EdgeHash *make_freestyle_edge_mark_hash(DerivedMesh *dm) { EdgeHash *edge_hash= NULL; FreestyleEdge *fed; MEdge *medge; int totedge, a; - const int *index; medge = dm->getEdgeArray(dm); totedge = dm->getNumEdges(dm); - index = dm->getEdgeDataArray(dm, CD_ORIGINDEX); - fed = CustomData_get_layer(&me->edata, CD_FREESTYLE_EDGE); + fed = dm->getEdgeDataArray(dm, CD_FREESTYLE_EDGE); if (fed) { edge_hash = BLI_edgehash_new(__func__); - if (!index) { - if (me->totedge == totedge) { - for (a = 0; a < me->totedge; a++) { - if (fed[a].flag & FREESTYLE_EDGE_MARK) { - BLI_edgehash_insert(edge_hash, medge[a].v1, medge[a].v2, medge + a); - } - } - } - } - else { - for (a = 0; a < totedge; a++) { - if (index[a] == ORIGINDEX_NONE) - continue; - if (fed[index[a]].flag & FREESTYLE_EDGE_MARK) - BLI_edgehash_insert(edge_hash, medge[a].v1, medge[a].v2, medge+a); - } + for (a = 0; a < totedge; a++) { + if (fed[a].flag & FREESTYLE_EDGE_MARK) + BLI_edgehash_insert(edge_hash, medge[a].v1, medge[a].v2, medge+a); } } return edge_hash; @@ -3272,7 +3257,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset) EdgeHash *edge_hash; /* create a hash table of Freestyle edge marks */ - edge_hash = make_freestyle_edge_mark_hash(me, dm); + edge_hash = make_freestyle_edge_mark_hash(dm); #endif /* store customdata names, because DerivedMesh is freed */ |