[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55343] trunk/blender/source/blender/ editors/sculpt_paint/sculpt.c: Fix sculpt view normal for transformed objects
Nicholas Bishop
nicholasbishop at gmail.com
Sat Mar 16 18:45:58 CET 2013
Revision: 55343
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55343
Author: nicholasbishop
Date: 2013-03-16 17:45:58 +0000 (Sat, 16 Mar 2013)
Log Message:
-----------
Fix sculpt view normal for transformed objects
Patch from Antony Riakiotakis, thanks!
Fixes [#34641] "Front Faces Only" option in SculptMode behaves weird
projects.blender.org/tracker/?func=detail&aid=34641&group_id=9&atid=498
Modified Paths:
--------------
trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c 2013-03-16 17:33:16 UTC (rev 55342)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c 2013-03-16 17:45:58 UTC (rev 55343)
@@ -3661,6 +3661,7 @@
Brush *brush = paint_brush(&sd->paint);
ViewContext *vc = paint_stroke_view_context(op->customdata);
Object *ob = CTX_data_active_object(C);
+ float rot[3][3], scale[3], loc[3];
int i;
int mode;
@@ -3725,7 +3726,12 @@
/* cache projection matrix */
ED_view3d_ob_project_mat_get(cache->vc->rv3d, ob, cache->projection_mat);
+ mat4_to_loc_rot_size(loc, rot, scale, ob->obmat);
+ /* transposing an orthonormal matrix inverts */
+ transpose_m3(rot);
ED_view3d_global_to_vector(cache->vc->rv3d, cache->vc->rv3d->twmat[3], cache->true_view_normal);
+ /* This takes care of rotated mesh. Instead of rotating every normal, we inverse rotate view normal. */
+ mul_m3_v3(rot, cache->true_view_normal);
/* Initialize layer brush displacements and persistent coords */
if (brush->sculpt_tool == SCULPT_TOOL_LAYER) {
/* not supported yet for multires or dynamic topology */
More information about the Bf-blender-cvs
mailing list