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/paint_vertex.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 181b32d58fc..158a6a92536 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -29,24 +29,11 @@
* \ingroup edsculpt
*/
-
-#include <math.h>
-#include <string.h>
-
-#ifdef WIN32
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
-#include "BLI_math_color.h"
#include "BLI_memarena.h"
-#include "BLI_utildefines.h"
-#include "BLI_ghash.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
@@ -57,14 +44,12 @@
#include "DNA_scene_types.h"
#include "DNA_brush_types.h"
#include "DNA_object_types.h"
-#include "DNA_meshdata_types.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "BKE_DerivedMesh.h"
-#include "BKE_armature.h"
#include "BKE_action.h"
#include "BKE_brush.h"
#include "BKE_context.h"
@@ -87,7 +72,7 @@
#include "ED_screen.h"
#include "ED_view3d.h"
-#include "paint_intern.h"
+#include "paint_intern.h" /* own include */
/* check if we can do partial updates and have them draw realtime
* (without rebuilding the 'derivedFinal') */
@@ -2135,7 +2120,10 @@ struct WPaintData {
int *indexar;
int vgroup_active;
int vgroup_mirror;
+
+ void *vp_handle;
DMCoNo *vertexcosnos;
+
float wpimat[3][3];
/* variables for auto normalize */
@@ -2244,7 +2232,8 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, const float UNU
}
/* painting on subsurfs should give correct points too, this returns me->totvert amount */
- wpd->vertexcosnos = mesh_get_mapped_verts_nors(scene, ob);
+ wpd->vp_handle = ED_vpaint_proj_handle_create(scene, ob, &wpd->vertexcosnos);
+
wpd->indexar = get_indexarray(me);
copy_wpaint_prev(wp, me->dvert, me->totvert);
@@ -2378,6 +2367,9 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
indexar = NULL;
}
+ /* incase we have modifiers */
+ ED_vpaint_proj_handle_update(wpd->vp_handle, vc->ar, mval);
+
/* make sure each vertex gets treated only once */
/* and calculate filter weight */
totw = 0.0f;
@@ -2516,8 +2508,7 @@ static void wpaint_stroke_done(const bContext *C, struct PaintStroke *stroke)
struct WPaintData *wpd = paint_stroke_mode_data(stroke);
if (wpd) {
- if (wpd->vertexcosnos)
- MEM_freeN(wpd->vertexcosnos);
+ ED_vpaint_proj_handle_free(wpd->vp_handle);
MEM_freeN(wpd->indexar);
if (wpd->vgroup_validmap)
@@ -2750,7 +2741,10 @@ typedef struct VPaintData {
ViewContext vc;
unsigned int paintcol;
int *indexar;
+
+ struct VertProjHandle *vp_handle;
DMCoNo *vertexcosnos;
+
float vpimat[3][3];
/* modify 'me->mcol' directly, since the derived mesh is drawing from this
@@ -2829,7 +2823,8 @@ static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const fl
paint_stroke_set_mode_data(stroke, vpd);
view3d_set_viewcontext(C, &vpd->vc);
- vpd->vertexcosnos = mesh_get_mapped_verts_nors(vpd->vc.scene, ob);
+ vpd->vp_handle = ED_vpaint_proj_handle_create(vpd->vc.scene, ob, &vpd->vertexcosnos);
+
vpd->indexar = get_indexarray(me);
vpd->paintcol = vpaint_get_current_col(vp);
@@ -3027,6 +3022,9 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
swap_m4m4(vc->rv3d->persmat, mat);
+ /* incase we have modifiers */
+ ED_vpaint_proj_handle_update(vpd->vp_handle, vc->ar, mval);
+
/* clear modified tag for blur tool */
if (vpd->mlooptag)
memset(vpd->mlooptag, 0, sizeof(bool) * me->totloop);
@@ -3072,8 +3070,7 @@ static void vpaint_stroke_done(const bContext *C, struct PaintStroke *stroke)
ViewContext *vc = &vpd->vc;
Object *ob = vc->obact;
- if (vpd->vertexcosnos)
- MEM_freeN(vpd->vertexcosnos);
+ ED_vpaint_proj_handle_free(vpd->vp_handle);
MEM_freeN(vpd->indexar);
/* frees prev buffer */