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:
authorNicholas Bishop <nicholasbishop@gmail.com>2007-04-16 09:57:06 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2007-04-16 09:57:06 +0400
commit7fe8ea861ac083f500ea698a7e0154885dacec2c (patch)
treeab50cd8ef11f019acc6a3e13d00398c9260db8c5 /source/blender/src/sculptmode.c
parent29932487c433395f2ef52206be6c419f9021ca7e (diff)
== Sculpt Mode ==
Fix for bug #6556, Sculpt draw/inflate brush strength is dependent on object scale value Added a scaling factor to brushes that adjusts for objects which have been scaled. Usually this means that the vertex locations are also scaled up or down.
Diffstat (limited to 'source/blender/src/sculptmode.c')
-rw-r--r--source/blender/src/sculptmode.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/source/blender/src/sculptmode.c b/source/blender/src/sculptmode.c
index 8dcfa586631..2d21802d548 100644
--- a/source/blender/src/sculptmode.c
+++ b/source/blender/src/sculptmode.c
@@ -135,6 +135,10 @@ typedef struct EditData {
char flip;
short mouse[2];
+ /* Adjust brush strength along each axis
+ to adjust for object scaling */
+ float scale[3];
+
/* View normals */
vec3f up, right, out;
@@ -492,9 +496,9 @@ void do_draw_brush(const EditData *e, const ListBase* active_verts)
while(node){
float *co= me->mvert[node->Index].co;
- const float val[3]= {co[0]+area_normal.x*node->Fade,
- co[1]+area_normal.y*node->Fade,
- co[2]+area_normal.z*node->Fade};
+ const float val[3]= {co[0]+area_normal.x*node->Fade*e->scale[0],
+ co[1]+area_normal.y*node->Fade*e->scale[1],
+ co[2]+area_normal.z*node->Fade*e->scale[2]};
sculpt_clip(e, co, val);
@@ -626,9 +630,9 @@ void do_layer_brush(EditData *e, const ListBase *active_verts)
}
{
- const float val[3]= {e->layer_store[node->Index].x+area_normal.x * *disp,
- e->layer_store[node->Index].y+area_normal.y * *disp,
- e->layer_store[node->Index].z+area_normal.z * *disp};
+ const float val[3]= {e->layer_store[node->Index].x+area_normal.x * *disp*e->scale[0],
+ e->layer_store[node->Index].y+area_normal.y * *disp*e->scale[1],
+ e->layer_store[node->Index].z+area_normal.z * *disp*e->scale[2]};
sculpt_clip(e, co, val);
}
}
@@ -651,6 +655,9 @@ void do_inflate_brush(const EditData *e, const ListBase *active_verts)
add[1]= no[1]/ 32767.0f;
add[2]= no[2]/ 32767.0f;
VecMulf(add, node->Fade);
+ add[0]*= e->scale[0];
+ add[1]*= e->scale[1];
+ add[2]*= e->scale[2];
VecAddf(add, add, co);
sculpt_clip(e, co, add);
@@ -1669,6 +1676,11 @@ void sculpt(void)
e.layer_disps= NULL;
e.layer_store= NULL;
+ /* Set scaling adjustment */
+ e.scale[0]= 1.0f / ob->size[0];
+ e.scale[1]= 1.0f / ob->size[1];
+ e.scale[2]= 1.0f / ob->size[2];
+
/* Capture original copy */
if(sd->draw_flag & SCULPTDRAW_FAST)
glAccum(GL_LOAD, 1);