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:
authorBastien Montagne <montagne29@wanadoo.fr>2018-10-09 18:31:04 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-10-09 18:32:10 +0300
commit6d6e3869ce52085bbd4351de96cbc0e6b51b974b (patch)
tree08d9e1b1a0ad476c0c37dacc3f1065d6d636d15d /source/blender/editors/sculpt_paint/paint_utils.c
parentb0b547bd1e2c5e1fe3abb509aae6d274143fd213 (diff)
Fix T57122: Sample color during texture painting not working.
Stupid +1/-1 fiddling of mat indices (between MPolys and object...). Initial investigation and patch by @dfelinto, thx.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_utils.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index aca563c5eab..9057c3b0609 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -53,6 +53,7 @@
#include "BKE_customdata.h"
#include "BKE_image.h"
#include "BKE_material.h"
+#include "BKE_mesh_runtime.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_report.h"
@@ -285,13 +286,15 @@ static void imapaint_tri_weights(
/* compute uv coordinates of mouse in face */
static void imapaint_pick_uv(Mesh *me_eval, Scene *scene, Object *ob_eval, unsigned int faceindex, const int xy[2], float uv[2])
{
- const int tottri = me_eval->runtime.looptris.len;
int i, findex;
float p[2], w[3], absw, minabsw;
float matrix[4][4], proj[4][4];
GLint view[4];
const eImagePaintMode mode = scene->toolsettings->imapaint.mode;
- const MLoopTri *lt = me_eval->runtime.looptris.array;
+
+ const MLoopTri *lt = BKE_mesh_runtime_looptri_ensure(me_eval);
+ const int tottri = me_eval->runtime.looptris.len;
+
const MVert *mvert = me_eval->mvert;
const MPoly *mpoly = me_eval->mpoly;
const MLoop *mloop = me_eval->mloop;
@@ -327,7 +330,7 @@ static void imapaint_pick_uv(Mesh *me_eval, Scene *scene, Object *ob_eval, unsig
const Material *ma;
const TexPaintSlot *slot;
- ma = give_current_material(ob_eval, mp->mat_nr);
+ ma = give_current_material(ob_eval, mp->mat_nr + 1);
slot = &ma->texpaintslot[ma->paint_active_slot];
if (!(slot && slot->uvname &&