[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41981] trunk/blender/source/blender/ editors: make it clearer which arguments in transform snap are return values ( no functional change)
Campbell Barton
ideasman42 at gmail.com
Sat Nov 19 01:52:55 CET 2011
Revision: 41981
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41981
Author: campbellbarton
Date: 2011-11-19 00:52:54 +0000 (Sat, 19 Nov 2011)
Log Message:
-----------
make it clearer which arguments in transform snap are return values (no functional change)
Modified Paths:
--------------
trunk/blender/source/blender/editors/include/ED_transform.h
trunk/blender/source/blender/editors/transform/transform_snap.c
Modified: trunk/blender/source/blender/editors/include/ED_transform.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_transform.h 2011-11-19 00:01:10 UTC (rev 41980)
+++ trunk/blender/source/blender/editors/include/ED_transform.h 2011-11-19 00:52:54 UTC (rev 41981)
@@ -183,10 +183,10 @@
#define SNAP_MIN_DISTANCE 30
-int peelObjectsTransForm(struct TransInfo *t, struct ListBase *depth_peels, float mval[2]);
-int peelObjectsContext(struct bContext *C, struct ListBase *depth_peels, float mval[2]);
-int snapObjectsTransform(struct TransInfo *t, float mval[2], int *dist, float *loc, float *no, SnapMode mode);
-int snapObjectsContext(struct bContext *C, float mval[2], int *dist, float *loc, float *no, SnapMode mode);
+int peelObjectsTransForm(struct TransInfo *t, struct ListBase *depth_peels, const float mval[2]);
+int peelObjectsContext(struct bContext *C, struct ListBase *depth_peels, const float mval[2]);
+int snapObjectsTransform(struct TransInfo *t, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode);
+int snapObjectsContext(struct bContext *C, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode);
#endif
Modified: trunk/blender/source/blender/editors/transform/transform_snap.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_snap.c 2011-11-19 00:01:10 UTC (rev 41980)
+++ trunk/blender/source/blender/editors/transform/transform_snap.c 2011-11-19 00:52:54 UTC (rev 41981)
@@ -94,9 +94,9 @@
static void ApplySnapTranslation(TransInfo *t, float vec[3]);
static void ApplySnapRotation(TransInfo *t, float *vec);
-static void ApplySnapResize(TransInfo *t, float *vec);
+static void ApplySnapResize(TransInfo *t, float vec[2]);
-static void CalcSnapGrid(TransInfo *t, float *vec);
+/* static void CalcSnapGrid(TransInfo *t, float *vec); */
static void CalcSnapGeometry(TransInfo *t, float *vec);
static void TargetSnapMedian(TransInfo *t);
@@ -701,7 +701,7 @@
/********************** CALC **************************/
-static void CalcSnapGrid(TransInfo *t, float *UNUSED(vec))
+static void UNUSED_FUNCTION(CalcSnapGrid)(TransInfo *t, float *UNUSED(vec))
{
snapGridAction(t, t->tsnap.snapPoint, BIG_GEARS);
}
@@ -1035,7 +1035,7 @@
}
/*================================================================*/
#ifndef USE_BVH_FACE_SNAP
-static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], float *v4co, float mval[2], float ray_start[3], float ray_start_local[3], float ray_normal_local[3], float obmat[][4], float timat[][3], float *loc, float *no, int *dist, float *depth)
+static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], float *v4co, float mval[2], float ray_start[3], float ray_start_local[3], float ray_normal_local[3], float obmat[][4], float timat[][3], float loc[3], float no[3], int *dist, float *depth)
{
float lambda;
int result;
@@ -1087,7 +1087,9 @@
}
#endif
-static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], short v2no[3], float mval[2], float ray_start[3], float ray_start_local[3], float ray_normal_local[3], float obmat[][4], float timat[][3], float *loc, float *no, int *dist, float *depth)
+static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], short v2no[3], float obmat[][4], float timat[][3],
+ const float ray_start[3], const float ray_start_local[3], const float ray_normal_local[3], const float mval[2],
+ float r_loc[3], float r_no[3], int *r_dist, float *r_depth)
{
float intersect[3] = {0, 0, 0}, ray_end[3], dvec[3];
int result;
@@ -1141,11 +1143,11 @@
* this takes care of series of connected edges a bit slanted w.r.t the viewport
* otherwise, it would stick to the verts of the closest edge and not slide along merrily
* */
- if (new_dist <= *dist && new_depth < *depth * 1.001f)
+ if (new_dist <= *r_dist && new_depth < *r_depth * 1.001f)
{
float n1[3], n2[3];
- *depth = new_depth;
+ *r_depth = new_depth;
retval = 1;
sub_v3_v3v3(edge_loc, v1co, v2co);
@@ -1153,18 +1155,18 @@
mul = dot_v3v3(vec, edge_loc) / dot_v3v3(edge_loc, edge_loc);
- if (no)
+ if (r_no)
{
normal_short_to_float_v3(n1, v1no);
normal_short_to_float_v3(n2, v2no);
- interp_v3_v3v3(no, n2, n1, mul);
- mul_m3_v3(timat, no);
- normalize_v3(no);
+ interp_v3_v3v3(r_no, n2, n1, mul);
+ mul_m3_v3(timat, r_no);
+ normalize_v3(r_no);
}
- copy_v3_v3(loc, location);
+ copy_v3_v3(r_loc, location);
- *dist = new_dist;
+ *r_dist = new_dist;
}
}
}
@@ -1172,7 +1174,9 @@
return retval;
}
-static int snapVertex(ARegion *ar, float vco[3], short vno[3], float mval[2], float ray_start[3], float ray_start_local[3], float ray_normal_local[3], float obmat[][4], float timat[][3], float *loc, float *no, int *dist, float *depth)
+static int snapVertex(ARegion *ar, float vco[3], short vno[3], float obmat[][4], float timat[][3],
+ const float ray_start[3], const float ray_start_local[3], const float ray_normal_local[3], const float mval[2],
+ float r_loc[3], float r_no[3], int *r_dist, float *r_depth)
{
int retval = 0;
float dvec[3];
@@ -1190,33 +1194,35 @@
mul_m4_v3(obmat, location);
- new_depth = len_v3v3(location, ray_start);
+ new_depth = len_v3v3(location, ray_start);
project_int(ar, location, screen_loc);
new_dist = abs(screen_loc[0] - (int)mval[0]) + abs(screen_loc[1] - (int)mval[1]);
- if (new_dist <= *dist && new_depth < *depth)
+ if (new_dist <= *r_dist && new_depth < *r_depth)
{
- *depth = new_depth;
+ *r_depth = new_depth;
retval = 1;
- copy_v3_v3(loc, location);
+ copy_v3_v3(r_loc, location);
- if (no)
+ if (r_no)
{
- normal_short_to_float_v3(no, vno);
- mul_m3_v3(timat, no);
- normalize_v3(no);
+ normal_short_to_float_v3(r_no, vno);
+ mul_m3_v3(timat, r_no);
+ normalize_v3(r_no);
}
- *dist = new_dist;
+ *r_dist = new_dist;
}
}
return retval;
}
-static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], float *loc, float *UNUSED(no), int *dist, float *depth)
+static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm, float obmat[][4],
+ const float ray_start[3], const float ray_normal[3], const float mval[2],
+ float r_loc[3], float *UNUSED(r_no), int *r_dist, float *r_depth)
{
float imat[4][4];
float ray_start_local[3], ray_normal_local[3];
@@ -1241,11 +1247,11 @@
switch (snap_mode)
{
case SCE_SNAP_MODE_VERTEX:
- retval |= snapVertex(ar, eBone->head, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth);
- retval |= snapVertex(ar, eBone->tail, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth);
+ retval |= snapVertex(ar, eBone->head, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
+ retval |= snapVertex(ar, eBone->tail, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
break;
case SCE_SNAP_MODE_EDGE:
- retval |= snapEdge(ar, eBone->head, NULL, eBone->tail, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth);
+ retval |= snapEdge(ar, eBone->head, NULL, eBone->tail, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
break;
}
}
@@ -1267,11 +1273,11 @@
switch (snap_mode)
{
case SCE_SNAP_MODE_VERTEX:
- retval |= snapVertex(ar, head_vec, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth);
- retval |= snapVertex(ar, tail_vec, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth);
+ retval |= snapVertex(ar, head_vec, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
+ retval |= snapVertex(ar, tail_vec, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
break;
case SCE_SNAP_MODE_EDGE:
- retval |= snapEdge(ar, head_vec, NULL, tail_vec, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth);
+ retval |= snapEdge(ar, head_vec, NULL, tail_vec, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
break;
}
}
@@ -1281,7 +1287,9 @@
return retval;
}
-static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh *dm, EditMesh *em, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], float *loc, float *no, int *dist, float *depth)
+static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh *dm, EditMesh *em, float obmat[][4],
+ const float ray_start[3], const float ray_normal[3], const float mval[2],
+ float r_loc[3], float r_no[3], int *r_dist, float *r_depth)
{
int retval = 0;
int totvert = dm->getNumVerts(dm);
@@ -1330,21 +1338,21 @@
bvhtree_from_mesh_faces(&treeData, dm, 0.0f, 4, 6);
hit.index = -1;
- hit.dist = *depth * (*depth == FLT_MAX ? 1.0f : local_scale);
+ hit.dist = *r_depth * (*r_depth == FLT_MAX ? 1.0f : local_scale);
if(treeData.tree && BLI_bvhtree_ray_cast(treeData.tree, ray_start_local, ray_normal_local, 0.0f, &hit, treeData.raycast_callback, &treeData) != -1)
{
- if(hit.dist/local_scale <= *depth) {
- *depth= hit.dist/local_scale;
- copy_v3_v3(loc, hit.co);
- copy_v3_v3(no, hit.no);
+ if(hit.dist/local_scale <= *r_depth) {
+ *r_depth= hit.dist/local_scale;
+ copy_v3_v3(r_loc, hit.co);
+ copy_v3_v3(r_no, hit.no);
/* back to worldspace */
- mul_m4_v3(obmat, loc);
- copy_v3_v3(no, hit.no);
+ mul_m4_v3(obmat, r_loc);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list