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-09-18 18:09:08 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-09-18 18:09:08 +0300
commit9bf3e0299b18d65cf0da77a7a0a8a907055a3328 (patch)
tree7464274008c6a71b31bb14915c556ecd05cca9ae /source/blender/blenkernel/intern/multires.c
parent41c039d6e90d7182042ec5f22386b8cf941c187f (diff)
Subdiv: CCG, initial grids stitching implementation
Currently is only working on an "inner" grid boundaries. Need to implement averaging across face edges.
Diffstat (limited to 'source/blender/blenkernel/intern/multires.c')
-rw-r--r--source/blender/blenkernel/intern/multires.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 4dd64e3d8b2..e8b1a5faa67 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -1338,20 +1338,29 @@ void multires_modifier_update_hidden(DerivedMesh *dm)
void multires_stitch_grids(Object *ob)
{
- /* utility for smooth brush */
- if (ob && ob->derivedFinal) {
- CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)ob->derivedFinal;
- CCGFace **faces;
- int totface;
-
- if (ccgdm->pbvh) {
- BKE_pbvh_get_grid_updates(ccgdm->pbvh, false, (void ***)&faces, &totface);
-
- if (totface) {
- ccgSubSurf_stitchFaces(ccgdm->ss, 0, faces, totface);
- MEM_freeN(faces);
- }
- }
+ if (ob == NULL) {
+ return;
+ }
+ SculptSession *sculpt_session = ob->sculpt;
+ if (sculpt_session == NULL) {
+ return;
+ }
+ PBVH *pbvh = sculpt_session->pbvh;
+ SubdivCCG *subdiv_ccg = sculpt_session->subdiv_ccg;
+ if (pbvh == NULL || subdiv_ccg == NULL) {
+ return;
+ }
+ BLI_assert(BKE_pbvh_type(pbvh) == PBVH_GRIDS);
+ /* NOTE: Currently CCG does not keep track of faces, making it impossible
+ * to use BKE_pbvh_get_grid_updates().
+ */
+ CCGFace **faces;
+ int num_faces;
+ BKE_pbvh_get_grid_updates(pbvh, false, (void ***)&faces, &num_faces);
+ if (num_faces) {
+ /* TODO(sergey): Only aveerage actually affected faces. */
+ BKE_subdiv_ccg_average_grids(subdiv_ccg);
+ MEM_freeN(faces);
}
}