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:
authorTon Roosendaal <ton@blender.org>2005-11-26 15:23:33 +0300
committerTon Roosendaal <ton@blender.org>2005-11-26 15:23:33 +0300
commit63ca05b7b3bec4c9ca60985fb9f9daf61a99d090 (patch)
tree1e3d0457b4f4f5996e00f76bffd0b26e483d814e /source/blender/src/meshtools.c
parent51e70835cc11f088366472848fac2b329e32cd92 (diff)
Four mirrored Weight Paint improvement/fixes:
- If the mirrored group doesn't exist yet, it creates that group now. - Painting on any non-mirror group (not a name complying mirror rules), it will now paint mirrored on the group itself. - The Mesh octree for mirror painting was not created on loading a file in WeightPaint mode, or on exiting Editmode for Mesh. This caused mirror painting to not work always. - Tweaked the threshold calculation for vertices, so it gives fewer misses.
Diffstat (limited to 'source/blender/src/meshtools.c')
-rw-r--r--source/blender/src/meshtools.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/src/meshtools.c b/source/blender/src/meshtools.c
index 2a8ee7570af..1ef7320763c 100644
--- a/source/blender/src/meshtools.c
+++ b/source/blender/src/meshtools.c
@@ -598,7 +598,7 @@ void sort_faces(void)
#define MOC_RES 8
#define MOC_NODE_RES 8
-#define MOC_THRESH 0.0001f
+#define MOC_THRESH 0.0002f
typedef struct MocNode {
struct MocNode *next;
@@ -735,6 +735,9 @@ int mesh_octree_table(Object *ob, float *co, char mode)
static float offs[3], div[3];
if(mode=='u') { /* use table */
+ if(basetable==NULL)
+ mesh_octree_table(ob, NULL, 's');
+
if(basetable) {
Mesh *me= ob->data;
bt= basetable + mesh_octree_get_base_offs(co, offs, div);
@@ -751,7 +754,15 @@ int mesh_octree_table(Object *ob, float *co, char mode)
/* for quick unit coordinate calculus */
VECCOPY(offs, bb->vec[0]);
+ offs[0]+= MOC_THRESH; /* we offset it 1 threshold unit extra */
+ offs[1]+= MOC_THRESH;
+ offs[2]+= MOC_THRESH;
+
VecSubf(div, bb->vec[6], offs);
+ div[0]+= MOC_THRESH; /* and divide with 1 threshold unit more extra (try 8x8 unit grid on paint) */
+ div[1]+= MOC_THRESH;
+ div[2]+= MOC_THRESH;
+
VecMulf(div, 1.0f/MOC_RES);
if(div[0]==0.0f) div[0]= 1.0f;
if(div[1]==0.0f) div[1]= 1.0f;