[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41470] trunk/blender/source/blender/ editors/sculpt_paint/sculpt.c: Sculpt cleanup

Nicholas Bishop nicholasbishop at gmail.com
Wed Nov 2 17:02:02 CET 2011


Revision: 41470
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41470
Author:   nicholasbishop
Date:     2011-11-02 16:02:01 +0000 (Wed, 02 Nov 2011)
Log Message:
-----------
Sculpt cleanup

Replace a use of bglMats in sculpt with ED_view3d_* functions().

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	2011-11-02 15:58:56 UTC (rev 41469)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2011-11-02 16:02:01 UTC (rev 41470)
@@ -208,7 +208,8 @@
 
 	int first_time; /* Beginning of stroke may do some things special */
 
-	bglMats *mats;
+	/* from ED_view3d_ob_project_mat_get() */
+	float projection_mat[4][4];
 
 	/* Clean this up! */
 	ViewContext *vc;
@@ -678,7 +679,8 @@
 	}
 	else if(ss->texcache) {
 		float rotation = -mtex->rot;
-		float x, y, point_2d[3];
+		float symm_point[3], point_2d[2];
+		float x, y;
 		float radius;
 
 		/* if the active area is being applied for symmetry, flip it
@@ -686,12 +688,13 @@
 		   position in order to project it. This insures that the 
 		   brush texture will be oriented correctly. */
 
-		flip_coord(point_2d, point, ss->cache->mirror_symmetry_pass);
+		flip_coord(symm_point, point, ss->cache->mirror_symmetry_pass);
 
 		if (ss->cache->radial_symmetry_pass)
-			mul_m4_v3(ss->cache->symm_rot_mat_inv, point_2d);
+			mul_m4_v3(ss->cache->symm_rot_mat_inv, symm_point);
 
-		projectf(ss->cache->mats, point_2d, point_2d);
+		ED_view3d_project_float(ss->cache->vc->ar, symm_point, point_2d,
+					ss->cache->projection_mat);
 
 		/* if fixed mode, keep coordinates relative to mouse */
 		if(mtex->brush_map_mode == MTEX_MAP_MODE_FIXED) {
@@ -2810,8 +2813,6 @@
 {
 	if(cache->face_norms)
 		MEM_freeN(cache->face_norms);
-	if(cache->mats)
-		MEM_freeN(cache->mats);
 	MEM_freeN(cache);
 }
 
@@ -2910,8 +2911,8 @@
 
 	cache->brush = brush;
 
-	cache->mats = MEM_callocN(sizeof(bglMats), "sculpt bglMats");
-	view3d_get_transformation(vc->ar, vc->rv3d, vc->obact, cache->mats);
+	/* cache projection matrix */
+	ED_view3d_ob_project_mat_get(cache->vc->rv3d, ob, cache->projection_mat);
 
 	ED_view3d_global_to_vector(cache->vc->rv3d, cache->vc->rv3d->twmat[3], cache->true_view_normal);
 	/* Initialize layer brush displacements and persistent coords */




More information about the Bf-blender-cvs mailing list