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:
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/paint_curve.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_hide.c1
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c17
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_mask.c1
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_proj.c39
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c23
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c2
8 files changed, 27 insertions, 60 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_curve.c b/source/blender/editors/sculpt_paint/paint_curve.c
index af0b828ae39..e2100ceb066 100644
--- a/source/blender/editors/sculpt_paint/paint_curve.c
+++ b/source/blender/editors/sculpt_paint/paint_curve.c
@@ -714,7 +714,7 @@ static int paintcurve_cursor_invoke(bContext *C, wmOperator *UNUSED(op), const w
break;
}
default:
- ED_view3d_cursor3d_update(C, event->mval);
+ ED_view3d_cursor3d_update(C, event->mval, true, V3D_CURSOR_ORIENT_VIEW);
break;
}
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c
index ac5b0624d56..4deec54a5b3 100644
--- a/source/blender/editors/sculpt_paint/paint_hide.c
+++ b/source/blender/editors/sculpt_paint/paint_hide.c
@@ -46,7 +46,6 @@
#include "BKE_pbvh.h"
#include "BKE_ccg.h"
#include "BKE_context.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_mesh.h"
#include "BKE_mesh_runtime.h"
#include "BKE_multires.h"
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 93fa3aac0d7..3c097095ddc 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -46,15 +46,16 @@
#include "IMB_imbuf_types.h"
#include "DNA_brush_types.h"
+#include "DNA_mesh_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "BKE_colorband.h"
#include "BKE_context.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_brush.h"
#include "BKE_main.h"
#include "BKE_material.h"
+#include "BKE_mesh.h"
#include "BKE_node.h"
#include "BKE_paint.h"
#include "BKE_undo_system.h"
@@ -1055,6 +1056,7 @@ static int texture_paint_toggle_poll(bContext *C)
static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
{
struct wmMsgBus *mbus = CTX_wm_message_bus(C);
+ Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
const int mode_flag = OB_MODE_TEXTURE_PAINT;
@@ -1070,14 +1072,13 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
ob->mode &= ~mode_flag;
if (U.glreslimit != 0)
- GPU_free_images();
- GPU_paint_set_mipmap(1);
+ GPU_free_images(bmain);
+ GPU_paint_set_mipmap(bmain, 1);
toggle_paint_cursor(C, 0);
}
else {
bScreen *sc;
- Main *bmain = CTX_data_main(C);
Image *ima = NULL;
ImagePaintSettings *imapaint = &scene->toolsettings->imapaint;
@@ -1122,12 +1123,16 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
BKE_paint_init(bmain, scene, ePaintTextureProjective, PAINT_CURSOR_TEXTURE_PAINT);
if (U.glreslimit != 0)
- GPU_free_images();
- GPU_paint_set_mipmap(0);
+ GPU_free_images(bmain);
+ GPU_paint_set_mipmap(bmain, 0);
toggle_paint_cursor(C, 1);
}
+ Mesh *me = BKE_mesh_from_object(ob);
+ BLI_assert(me != NULL);
+ DEG_id_tag_update(&me->id, DEG_TAG_COPY_ON_WRITE);
+
WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene);
WM_msg_publish_rna_prop(mbus, &ob->id, ob, Object, mode);
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 62bc379241f..bbf1da2d584 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -58,6 +58,7 @@
#include "DNA_brush_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
@@ -65,7 +66,6 @@
#include "BKE_colorband.h"
#include "BKE_context.h"
#include "BKE_colortools.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_idprop.h"
#include "BKE_brush.h"
#include "BKE_image.h"
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index f22e6f514e6..4a338e65d79 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -45,7 +45,6 @@
#include "BKE_pbvh.h"
#include "BKE_ccg.h"
#include "BKE_context.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_multires.h"
#include "BKE_paint.h"
#include "BKE_subsurf.h"
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_proj.c b/source/blender/editors/sculpt_paint/paint_vertex_proj.c
index cacfdc2dbba..602bfe1ab8e 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_proj.c
@@ -28,7 +28,7 @@
* \ingroup edsculpt
*
* Utility functions for getting vertex locations while painting
- * (since they may be instanced multiple times in a DerivedMesh)
+ * (since they may be instanced multiple times in an evaluated mesh)
*/
#include "MEM_guardedalloc.h"
@@ -39,8 +39,9 @@
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
-#include "BKE_DerivedMesh.h"
+#include "BKE_DerivedMesh.h" /* XXX To be removed, only used for DMCoNo struct */
#include "BKE_context.h"
+#include "BKE_mesh_iterators.h"
#include "BKE_mesh_runtime.h"
#include "DEG_depsgraph.h"
@@ -107,24 +108,10 @@ static void vpaint_proj_dm_map_cosnos_init(
struct VertProjHandle *vp_handle)
{
Mesh *me = ob->data;
- DerivedMesh *dm;
+ Mesh *me_eval = mesh_get_eval_final(depsgraph, scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
- dm = mesh_get_derived_final(depsgraph, scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
-
- if (dm->foreachMappedVert) {
- memset(vp_handle->vcosnos, 0, sizeof(DMCoNo) * me->totvert);
- dm->foreachMappedVert(dm, vpaint_proj_dm_map_cosnos_init__map_cb, vp_handle, DM_FOREACH_USE_NORMAL);
- }
- else {
- DMCoNo *v_co_no = vp_handle->vcosnos;
- int a;
- for (a = 0; a < me->totvert; a++, v_co_no++) {
- dm->getVertCo(dm, a, v_co_no->co);
- dm->getVertNo(dm, a, v_co_no->no);
- }
- }
-
- dm->release(dm);
+ memset(vp_handle->vcosnos, 0, sizeof(*vp_handle->vcosnos) * me->totvert);
+ BKE_mesh_foreach_mapped_vert(me_eval, vpaint_proj_dm_map_cosnos_init__map_cb, vp_handle, MESH_FOREACH_USE_NORMAL);
}
@@ -185,21 +172,13 @@ static void vpaint_proj_dm_map_cosnos_update(
Scene *scene = vp_handle->scene;
Object *ob = vp_handle->ob;
Mesh *me = ob->data;
- DerivedMesh *dm;
+ Mesh *me_eval = mesh_get_eval_final(depsgraph, scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
/* quick sanity check - we shouldn't have to run this if there are no modifiers */
BLI_assert(BLI_listbase_is_empty(&ob->modifiers) == false);
- dm = mesh_get_derived_final(depsgraph, scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
-
- /* highly unlikely this will become unavailable once painting starts (perhaps with animated modifiers) */
- if (LIKELY(dm->foreachMappedVert)) {
- copy_vn_fl(vp_handle->dists_sq, me->totvert, FLT_MAX);
-
- dm->foreachMappedVert(dm, vpaint_proj_dm_map_cosnos_update__map_cb, &vp_update, DM_FOREACH_USE_NORMAL);
- }
-
- dm->release(dm);
+ copy_vn_fl(vp_handle->dists_sq, me->totvert, FLT_MAX);
+ BKE_mesh_foreach_mapped_vert(me_eval, vpaint_proj_dm_map_cosnos_update__map_cb, &vp_update, MESH_FOREACH_USE_NORMAL);
}
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
index 7d241835b62..126b3b42e8f 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
@@ -35,8 +35,8 @@
#include "IMB_imbuf_types.h"
#include "IMB_colormanagement.h"
-//#include "DNA_armature_types.h"
#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
#include "DNA_particle_types.h"
#include "DNA_brush_types.h"
#include "DNA_object_types.h"
@@ -46,11 +46,11 @@
#include "RNA_define.h"
#include "RNA_enum_types.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_brush.h"
#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_mesh.h"
+#include "BKE_mesh_iterators.h"
#include "BKE_mesh_mapping.h"
#include "BKE_mesh_runtime.h"
#include "BKE_modifier.h"
@@ -785,31 +785,16 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
ED_view3d_init_mats_rv3d(ob, ar->regiondata);
Mesh *me_eval = mesh_get_eval_final(depsgraph, scene, ob, scene->customdata_mask | CD_MASK_ORIGINDEX);
- int *mv_orig_indices = CustomData_get_layer(&me_eval->vdata, CD_ORIGINDEX);
- MVert *mv = me_eval->mvert;
- /* NULL origindex is valid when wehave no generative modifiers... */
- BLI_assert(mv_orig_indices != NULL || me_eval->totvert == me->totvert);
if (data.is_init) {
data.vert_visit = BLI_BITMAP_NEW(me->totvert, __func__);
- /* TODO add some similar helpers as DM's foreachMappedXXX callbacks, for evaluated mesh? */
- for (int mv_idx = 0; mv_idx < me_eval->totvert; mv_idx++, mv++) {
- const int mv_orig_idx = mv_orig_indices != NULL ? mv_orig_indices[mv_idx] : mv_idx;
- if (mv_orig_idx != ORIGINDEX_NONE) {
- gradientVertInit__mapFunc(&data, mv_orig_idx, mv->co, NULL, NULL);
- }
- }
+ BKE_mesh_foreach_mapped_vert(me_eval, gradientVertInit__mapFunc, &data, MESH_FOREACH_NOP);
MEM_freeN(data.vert_visit);
data.vert_visit = NULL;
}
else {
- for (int mv_idx = 0; mv_idx < me_eval->totvert; mv_idx++, mv++) {
- const int mv_orig_idx = mv_orig_indices != NULL ? mv_orig_indices[mv_idx] : mv_idx;
- if (mv_orig_idx != ORIGINDEX_NONE) {
- gradientVertUpdate__mapFunc(&data, mv_orig_idx, mv->co, NULL, NULL);
- }
- }
+ BKE_mesh_foreach_mapped_vert(me_eval, gradientVertUpdate__mapFunc, &data, MESH_FOREACH_NOP);
}
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 2872ad4fb9c..bc22147b15d 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -561,7 +561,7 @@ static void sculpt_undo_restore_list(bContext *C, ListBase *lb)
else {
BKE_pbvh_search_callback(ss->pbvh, NULL, NULL, update_cb, &rebuild);
}
- BKE_pbvh_update(ss->pbvh, PBVH_UpdateBB | PBVH_UpdateOriginalBB | PBVH_UpdateRedraw, NULL);
+ BKE_pbvh_update(ss->pbvh, PBVH_UpdateBB | PBVH_UpdateOriginalBB | PBVH_UpdateRedraw | PBVH_UpdateNormals, NULL);
if (BKE_sculpt_multires_active(scene, ob)) {
if (rebuild)