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-31 18:08:29 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-08-31 18:08:29 +0300
commit7f36fb458cbea8083d3b863da18e1cfb1fc04e1f (patch)
tree4d9f19950433d55d99fc4c0fbbc5c3056f0fa143 /source/blender/editors/sculpt_paint/paint_vertex.c
parentfede95aa68774d920478928a02858f96897e1fda (diff)
parent8a3b548cb2b2c7a05a4d0a1c613f788d38a04e85 (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_vertex.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c54
1 files changed, 31 insertions, 23 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index edbe3caf333..c50df664a6a 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1651,7 +1651,8 @@ static void do_wpaint_brush_blur_task_cb_ex(
{
SculptThreadedTaskData *data = userdata;
SculptSession *ss = data->ob->sculpt;
- CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh);
+ const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh);
+ const bool has_grids = (pbvh_type == PBVH_GRIDS);
const struct SculptVertexPaintGeomMap *gmap = &ss->mode.wpaint.gmap;
const Brush *brush = data->brush;
@@ -1678,8 +1679,8 @@ static void do_wpaint_brush_blur_task_cb_ex(
if (sculpt_brush_test_sq_fn(&test, vd.co)) {
/* For grid based pbvh, take the vert whose loop coopresponds to the current grid.
* Otherwise, take the current vert. */
- const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
- const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f;
+ const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
+ const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
const char v_flag = data->me->mvert[v_index].flag;
/* If the vertex is selected */
if (!(use_face_sel || use_vert_sel) || v_flag & SELECT) {
@@ -1742,7 +1743,8 @@ static void do_wpaint_brush_smear_task_cb_ex(
{
SculptThreadedTaskData *data = userdata;
SculptSession *ss = data->ob->sculpt;
- CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh);
+ const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh);
+ const bool has_grids = (pbvh_type == PBVH_GRIDS);
const struct SculptVertexPaintGeomMap *gmap = &ss->mode.wpaint.gmap;
const Brush *brush = data->brush;
@@ -1774,8 +1776,8 @@ static void do_wpaint_brush_smear_task_cb_ex(
if (sculpt_brush_test_sq_fn(&test, vd.co)) {
/* For grid based pbvh, take the vert whose loop cooresponds to the current grid.
* Otherwise, take the current vert. */
- const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
- const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f;
+ const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
+ const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
const MVert *mv_curr = &data->me->mvert[v_index];
/* If the vertex is selected */
@@ -1851,7 +1853,8 @@ static void do_wpaint_brush_draw_task_cb_ex(
{
SculptThreadedTaskData *data = userdata;
SculptSession *ss = data->ob->sculpt;
- CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh);
+ const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh);
+ const bool has_grids = (pbvh_type == PBVH_GRIDS);
const Scene *scene = CTX_data_scene(data->C);
const Brush *brush = data->brush;
@@ -1880,8 +1883,8 @@ static void do_wpaint_brush_draw_task_cb_ex(
/* Note: grids are 1:1 with corners (aka loops).
* For multires, take the vert whose loop cooresponds to the current grid.
* Otherwise, take the current vert. */
- const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
- const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f;
+ const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
+ const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
const char v_flag = data->me->mvert[v_index].flag;
/* If the vertex is selected */
@@ -1924,7 +1927,8 @@ static void do_wpaint_brush_calc_average_weight_cb_ex(
SculptThreadedTaskData *data = userdata;
SculptSession *ss = data->ob->sculpt;
StrokeCache *cache = ss->cache;
- CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh);
+ const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh);
+ const bool has_grids = (pbvh_type == PBVH_GRIDS);
const bool use_normal = vwpaint_use_normal(data->vp);
const bool use_face_sel = (data->me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
@@ -1949,8 +1953,8 @@ static void do_wpaint_brush_calc_average_weight_cb_ex(
const float angle_cos = (use_normal && vd.no) ?
dot_vf3vs3(sculpt_normal_frontface, vd.no) : 1.0f;
if (angle_cos > 0.0 && BKE_brush_curve_strength(data->brush, sqrtf(test.dist), cache->radius) > 0.0) {
- const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
- // const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f;
+ const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
+ // const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
const char v_flag = data->me->mvert[v_index].flag;
/* If the vertex is selected. */
@@ -2569,7 +2573,8 @@ static void do_vpaint_brush_calc_average_color_cb_ex(
{
SculptThreadedTaskData *data = userdata;
SculptSession *ss = data->ob->sculpt;
- CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh);
+ const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh);
+ const bool has_grids = (pbvh_type == PBVH_GRIDS);
const struct SculptVertexPaintGeomMap *gmap = &ss->mode.vpaint.gmap;
StrokeCache *cache = ss->cache;
@@ -2591,7 +2596,7 @@ static void do_vpaint_brush_calc_average_color_cb_ex(
{
/* Test to see if the vertex coordinates are within the spherical brush region. */
if (sculpt_brush_test_sq_fn(&test, vd.co)) {
- const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
+ const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
if (BKE_brush_curve_strength(data->brush, 0.0, cache->radius) > 0.0) {
/* If the vertex is selected for painting. */
const MVert *mv = &data->me->mvert[v_index];
@@ -2633,7 +2638,8 @@ static void do_vpaint_brush_draw_task_cb_ex(
{
SculptThreadedTaskData *data = userdata;
SculptSession *ss = data->ob->sculpt;
- CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh);
+ const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh);
+ const bool has_grids = (pbvh_type == PBVH_GRIDS);
const struct SculptVertexPaintGeomMap *gmap = &ss->mode.vpaint.gmap;
const Brush *brush = data->brush;
@@ -2661,8 +2667,8 @@ static void do_vpaint_brush_draw_task_cb_ex(
/* Note: Grids are 1:1 with corners (aka loops).
* For grid based pbvh, take the vert whose loop cooresponds to the current grid.
* Otherwise, take the current vert. */
- const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
- const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f;
+ const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
+ const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
const MVert *mv = &data->me->mvert[v_index];
/* If the vertex is selected for painting. */
@@ -2727,7 +2733,8 @@ static void do_vpaint_brush_blur_task_cb_ex(
{
SculptThreadedTaskData *data = userdata;
SculptSession *ss = data->ob->sculpt;
- CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh);
+ const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh);
+ const bool has_grids = (pbvh_type == PBVH_GRIDS);
Scene *scene = CTX_data_scene(data->C);
const struct SculptVertexPaintGeomMap *gmap = &ss->mode.vpaint.gmap;
@@ -2754,8 +2761,8 @@ static void do_vpaint_brush_blur_task_cb_ex(
if (sculpt_brush_test_sq_fn(&test, vd.co)) {
/* For grid based pbvh, take the vert whose loop cooresponds to the current grid.
* Otherwise, take the current vert. */
- const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
- const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f;
+ const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
+ const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
const MVert *mv = &data->me->mvert[v_index];
/* If the vertex is selected for painting. */
@@ -2838,7 +2845,8 @@ static void do_vpaint_brush_smear_task_cb_ex(
{
SculptThreadedTaskData *data = userdata;
SculptSession *ss = data->ob->sculpt;
- CCGDerivedMesh *ccgdm = BKE_pbvh_get_ccgdm(ss->pbvh);
+ const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh);
+ const bool has_grids = (pbvh_type == PBVH_GRIDS);
Scene *scene = CTX_data_scene(data->C);
const struct SculptVertexPaintGeomMap *gmap = &ss->mode.vpaint.gmap;
@@ -2871,8 +2879,8 @@ static void do_vpaint_brush_smear_task_cb_ex(
if (sculpt_brush_test_sq_fn(&test, vd.co)) {
/* For grid based pbvh, take the vert whose loop cooresponds to the current grid.
* Otherwise, take the current vert. */
- const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
- const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f;
+ const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
+ const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
const MVert *mv_curr = &data->me->mvert[v_index];
/* if the vertex is selected for painting. */