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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-31 15:04:16 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-31 18:17:03 +0300
commit692891f69ea42af0ba890f5f92cbd1a3260442c9 (patch)
tree1aeb9469b7a2b26a8a25a09c6045faa51d34944b /source/blender/draw/engines/workbench/workbench_forward.c
parent9899999e944c0d954dbe5a7aa96c8e1680e7b3f8 (diff)
Fix sculpt mode drawing with modifiers still being wrong in some cases
Centralize logic for when to use the PBVH for drawing, fix missing tests in mask drawing, fix missing tests for multiple windows, only do more expensive update for all viewports at end of the stroke.
Diffstat (limited to 'source/blender/draw/engines/workbench/workbench_forward.c')
-rw-r--r--source/blender/draw/engines/workbench/workbench_forward.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c
index 26c4b920382..eccf2b1a0f0 100644
--- a/source/blender/draw/engines/workbench/workbench_forward.c
+++ b/source/blender/draw/engines/workbench/workbench_forward.c
@@ -29,9 +29,10 @@
#include "BLI_string_utils.h"
#include "BLI_utildefines.h"
-#include "BKE_particle.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
+#include "BKE_paint.h"
+#include "BKE_particle.h"
#include "DNA_image_types.h"
#include "DNA_mesh_types.h"
@@ -141,7 +142,7 @@ WORKBENCH_MaterialData *workbench_forward_get_or_create_material_data(WORKBENCH_
ImageUser *iuser,
int color_type,
int interp,
- bool is_sculpt_mode)
+ bool use_sculpt_pbvh)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
WORKBENCH_FORWARD_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
@@ -198,7 +199,7 @@ WORKBENCH_MaterialData *workbench_forward_get_or_create_material_data(WORKBENCH_
material->shgrp = grp;
/* Depth */
- if (workbench_material_determine_color_type(wpd, material->ima, ob, is_sculpt_mode) ==
+ if (workbench_material_determine_color_type(wpd, material->ima, ob, use_sculpt_pbvh) ==
V3D_SHADING_TEXTURE_COLOR) {
material->shgrp_object_outline = DRW_shgroup_create(sh_data->object_outline_texture_sh,
psl->object_outline_pass);
@@ -567,11 +568,11 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
WORKBENCH_MaterialData *material;
if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) {
- const bool is_sculpt_mode = DRW_object_use_pbvh_drawing(ob);
+ const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d);
const int materials_len = MAX2(1, ob->totcol);
const Mesh *me = (ob->type == OB_MESH) ? ob->data : NULL;
- if (!is_sculpt_mode && TEXTURE_DRAWING_ENABLED(wpd) && me && me->mloopuv) {
+ if (!use_sculpt_pbvh && TEXTURE_DRAWING_ENABLED(wpd) && me && me->mloopuv) {
struct GPUBatch **geom_array = DRW_cache_mesh_surface_texpaint_get(ob);
for (int i = 0; i < materials_len; i++) {
Material *mat;
@@ -579,9 +580,9 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
ImageUser *iuser;
int interp;
workbench_material_get_image_and_mat(ob, i + 1, &image, &iuser, &interp, &mat);
- int color_type = workbench_material_determine_color_type(wpd, image, ob, is_sculpt_mode);
+ int color_type = workbench_material_determine_color_type(wpd, image, ob, use_sculpt_pbvh);
material = workbench_forward_get_or_create_material_data(
- vedata, ob, mat, image, iuser, color_type, interp, is_sculpt_mode);
+ vedata, ob, mat, image, iuser, color_type, interp, use_sculpt_pbvh);
DRW_shgroup_call(material->shgrp_object_outline, geom_array[i], ob);
DRW_shgroup_call(material->shgrp, geom_array[i], ob);
}
@@ -592,11 +593,11 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
V3D_SHADING_RANDOM_COLOR,
V3D_SHADING_VERTEX_COLOR)) {
/* No material split needed */
- int color_type = workbench_material_determine_color_type(wpd, NULL, ob, is_sculpt_mode);
+ int color_type = workbench_material_determine_color_type(wpd, NULL, ob, use_sculpt_pbvh);
- if (is_sculpt_mode) {
+ if (use_sculpt_pbvh) {
material = workbench_forward_get_or_create_material_data(
- vedata, ob, NULL, NULL, NULL, color_type, 0, is_sculpt_mode);
+ vedata, ob, NULL, NULL, NULL, color_type, 0, use_sculpt_pbvh);
bool use_vcol = (color_type == V3D_SHADING_VERTEX_COLOR);
/* TODO(fclem) make this call optional */
DRW_shgroup_call_sculpt(material->shgrp_object_outline, ob, false, false, false);
@@ -610,7 +611,7 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
DRW_cache_object_surface_get(ob);
if (geom) {
material = workbench_forward_get_or_create_material_data(
- vedata, ob, NULL, NULL, NULL, color_type, 0, is_sculpt_mode);
+ vedata, ob, NULL, NULL, NULL, color_type, 0, use_sculpt_pbvh);
/* TODO(fclem) make this call optional */
DRW_shgroup_call(material->shgrp_object_outline, geom, ob);
if (!is_wire) {
@@ -621,13 +622,13 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
}
else {
/* Draw material color */
- if (is_sculpt_mode) {
+ if (use_sculpt_pbvh) {
struct DRWShadingGroup **shgrps = BLI_array_alloca(shgrps, materials_len);
for (int i = 0; i < materials_len; ++i) {
struct Material *mat = give_current_material(ob, i + 1);
material = workbench_forward_get_or_create_material_data(
- vedata, ob, mat, NULL, NULL, V3D_SHADING_MATERIAL_COLOR, 0, is_sculpt_mode);
+ vedata, ob, mat, NULL, NULL, V3D_SHADING_MATERIAL_COLOR, 0, use_sculpt_pbvh);
shgrps[i] = material->shgrp;
}
/* TODO(fclem) make this call optional */
@@ -650,7 +651,7 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
Material *mat = give_current_material(ob, i + 1);
material = workbench_forward_get_or_create_material_data(
- vedata, ob, mat, NULL, NULL, V3D_SHADING_MATERIAL_COLOR, 0, is_sculpt_mode);
+ vedata, ob, mat, NULL, NULL, V3D_SHADING_MATERIAL_COLOR, 0, use_sculpt_pbvh);
/* TODO(fclem) make this call optional */
DRW_shgroup_call(material->shgrp_object_outline, mat_geom[i], ob);
if (!is_wire) {