[Bf-blender-cvs] [6a45b2a] master: Partial Fix T42652: Transform falloff for mesh islands

Campbell Barton noreply at git.blender.org
Thu Nov 27 21:40:23 CET 2014


Commit: 6a45b2a2324277a88edccfcaac2fc2525f7c4ee0
Author: Campbell Barton
Date:   Thu Nov 27 21:37:42 2014 +0100
Branches: master
https://developer.blender.org/rB6a45b2a2324277a88edccfcaac2fc2525f7c4ee0

Partial Fix T42652: Transform falloff for mesh islands

This doesn't currently do anything clever when a single vertex is shared by multiple islands
(uses closest only).

===================================================================

M	source/blender/editors/transform/transform.c
M	source/blender/editors/transform/transform.h
M	source/blender/editors/transform/transform_conversions.c
M	source/blender/editors/transform/transform_generics.c

===================================================================

diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 7e27c11..b0e3343 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -200,6 +200,12 @@ static bool transdata_check_local_center(TransInfo *t, short around)
 	        );
 }
 
+bool transdata_check_local_islands(TransInfo *t, short around)
+{
+	return ((around == V3D_LOCAL) && (
+	        (t->obedit && ELEM(t->obedit->type, OB_MESH))));
+}
+
 /* ************************** SPACE DEPENDANT CODE **************************** */
 
 void setTransformViewMatrices(TransInfo *t)
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index c2891b5..0d824be 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -552,6 +552,7 @@ void special_aftertrans_update(struct bContext *C, TransInfo *t);
 int  special_transform_moving(TransInfo *t);
 
 void transform_autoik_update(TransInfo *t, short mode);
+bool transdata_check_local_islands(TransInfo *t, short around);
 
 int count_set_pose_transflags(int *out_mode, short around, struct Object *ob);
 
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 72a2fef..db29c7c 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -218,6 +218,9 @@ static void set_prop_dist(TransInfo *t, const bool with_dist)
 	float _proj_vec[3];
 	const float *proj_vec = NULL;
 
+	/* support for face-islands */
+	const bool use_island = transdata_check_local_islands(t, t->around);
+
 	if (t->flag & T_PROP_PROJECTED) {
 		if (t->spacetype == SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) {
 			RegionView3D *rv3d = t->ar->regiondata;
@@ -239,7 +242,12 @@ static void set_prop_dist(TransInfo *t, const bool with_dist)
 
 			for (i = 0, td = t->data; i < t->total; i++, td++) {
 				if (td->flag & TD_SELECTED) {
-					sub_v3_v3v3(vec, tob->center, td->center);
+					if (use_island) {
+						sub_v3_v3v3(vec, tob->iloc, td->iloc);
+					}
+					else {
+						sub_v3_v3v3(vec, tob->center, td->center);
+					}
 					mul_m3_v3(tob->mtx, vec);
 
 					if (proj_vec) {
@@ -251,6 +259,10 @@ static void set_prop_dist(TransInfo *t, const bool with_dist)
 					dist_sq = len_squared_v3(vec);
 					if ((tob->rdist == -1.0f) || (dist_sq < SQUARE(tob->rdist))) {
 						tob->rdist = sqrtf(dist_sq);
+						if (use_island) {
+							copy_v3_v3(tob->center, td->center);
+							copy_m3_m3(tob->axismtx, td->axismtx);
+						}
 					}
 				}
 				else {
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 34d64b7..f5d4f34 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -1191,7 +1191,11 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
 		/* exceptional case */
 		if (t->around == V3D_LOCAL) {
 			if (ELEM(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL)) {
-				t->options |= CTX_NO_PET;
+				const bool use_island = transdata_check_local_islands(t, t->around);
+
+				if (!use_island) {
+					t->options |= CTX_NO_PET;
+				}
 			}
 		}




More information about the Bf-blender-cvs mailing list