[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45052] trunk/blender/source/blender/ editors/mesh/bmesh_select.c: fix [#30617] regression: select similar no threshold

Campbell Barton ideasman42 at gmail.com
Wed Mar 21 08:49:13 CET 2012


Revision: 45052
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45052
Author:   campbellbarton
Date:     2012-03-21 07:49:05 +0000 (Wed, 21 Mar 2012)
Log Message:
-----------
fix [#30617] regression: select similar no threshold

Modified Paths:
--------------
    trunk/blender/source/blender/editors/mesh/bmesh_select.c

Modified: trunk/blender/source/blender/editors/mesh/bmesh_select.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/bmesh_select.c	2012-03-21 06:33:31 UTC (rev 45051)
+++ trunk/blender/source/blender/editors/mesh/bmesh_select.c	2012-03-21 07:49:05 UTC (rev 45052)
@@ -699,9 +699,8 @@
 
 	/* get the type from RNA */
 	int type = RNA_enum_get(op->ptr, "type");
+	float thresh = RNA_float_get(op->ptr, "threshold");
 
-	float thresh = CTX_data_tool_settings(C)->select_thresh;
-
 	/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
 	EDBM_InitOpf(em, &bmop, op, "similarfaces faces=%hf type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
 
@@ -740,9 +739,8 @@
 
 	/* get the type from RNA */
 	int type = RNA_enum_get(op->ptr, "type");
+	float thresh = RNA_float_get(op->ptr, "threshold");
 
-	float thresh = CTX_data_tool_settings(C)->select_thresh;
-
 	/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
 	EDBM_InitOpf(em, &bmop, op, "similaredges edges=%he type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
 
@@ -784,7 +782,7 @@
 	BMOperator bmop;
 	/* get the type from RNA */
 	int type = RNA_enum_get(op->ptr, "type");
-	float thresh = CTX_data_tool_settings(C)->select_thresh;
+	float thresh = RNA_float_get(op->ptr, "threshold");
 
 	/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
 	EDBM_InitOpf(em, &bmop, op, "similarverts verts=%hv type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
@@ -815,14 +813,21 @@
 
 static int select_similar_exec(bContext *C, wmOperator *op)
 {
+	ToolSettings *ts = CTX_data_tool_settings(C);
+	PropertyRNA *prop = RNA_struct_find_property(op->ptr, "threshold");
+
 	int type = RNA_enum_get(op->ptr, "type");
 
-	if (type < 100)
-		return similar_vert_select_exec(C, op);
-	else if (type < 200)
-		return similar_edge_select_exec(C, op);
-	else
-		return similar_face_select_exec(C, op);
+	if (!RNA_property_is_set(op->ptr, prop)) {
+		RNA_property_float_set(op->ptr, prop, ts->select_thresh);
+	}
+	else {
+		ts->select_thresh = RNA_property_float_get(op->ptr, prop);
+	}
+
+	if      (type < 100) return similar_vert_select_exec(C, op);
+	else if (type < 200) return similar_edge_select_exec(C, op);
+	else                 return similar_face_select_exec(C, op);
 }
 
 static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop),
@@ -880,6 +885,8 @@
 	/* properties */
 	prop = ot->prop = RNA_def_enum(ot->srna, "type", prop_similar_types, SIMVERT_NORMAL, "Type", "");
 	RNA_def_enum_funcs(prop, select_similar_type_itemf);
+
+	RNA_def_float(ot->srna, "threshold", 0.0, 0.0, 1.0, "Threshold", "", 0.01, 1.0);
 }
 
 /* ***************************************************** */




More information about the Bf-blender-cvs mailing list