Welcome to mirror list, hosted at ThFree Co, Russian Federation.

editmesh_select_similar.c « mesh « editors « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0877172775e55821d32b30b3bd74cc7101ba473e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
/*
 * ***** BEGIN GPL LICENSE BLOCK *****
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * The Original Code is Copyright (C) 2004 Blender Foundation.
 * All rights reserved.
 *
 * The Original Code is: all of this file.
 *
 * Contributor(s): none yet.
 *
 * ***** END GPL LICENSE BLOCK *****
 */

/** \file blender/editors/mesh/editmesh_select_similar.c
 *  \ingroup edmesh
 */

#include "MEM_guardedalloc.h"

#include "BLI_kdtree.h"
#include "BLI_math.h"

#include "BKE_context.h"
#include "BKE_editmesh.h"
#include "BKE_layer.h"
#include "BKE_report.h"

#include "WM_api.h"
#include "WM_types.h"

#include "RNA_access.h"
#include "RNA_define.h"

#include "ED_mesh.h"
#include "ED_screen.h"

#include "mesh_intern.h"  /* own include */

/* -------------------------------------------------------------------- */
/** \name Select Similar (Vert/Edge/Face) Operator - common
 * \{ */

static const EnumPropertyItem prop_similar_compare_types[] = {
	{SIM_CMP_EQ, "EQUAL", 0, "Equal", ""},
	{SIM_CMP_GT, "GREATER", 0, "Greater", ""},
	{SIM_CMP_LT, "LESS", 0, "Less", ""},

	{0, NULL, 0, NULL, NULL}
};

static const EnumPropertyItem prop_similar_types[] = {
	{SIMVERT_NORMAL, "NORMAL", 0, "Normal", ""},
	{SIMVERT_FACE, "FACE", 0, "Amount of Adjacent Faces", ""},
	{SIMVERT_VGROUP, "VGROUP", 0, "Vertex Groups", ""},
	{SIMVERT_EDGE, "EDGE", 0, "Amount of connecting edges", ""},

	{SIMEDGE_LENGTH, "LENGTH", 0, "Length", ""},
	{SIMEDGE_DIR, "DIR", 0, "Direction", ""},
	{SIMEDGE_FACE, "FACE", 0, "Amount of Faces Around an Edge", ""},
	{SIMEDGE_FACE_ANGLE, "FACE_ANGLE", 0, "Face Angles", ""},
	{SIMEDGE_CREASE, "CREASE", 0, "Crease", ""},
	{SIMEDGE_BEVEL, "BEVEL", 0, "Bevel", ""},
	{SIMEDGE_SEAM, "SEAM", 0, "Seam", ""},
	{SIMEDGE_SHARP, "SHARP", 0, "Sharpness", ""},
#ifdef WITH_FREESTYLE
	{SIMEDGE_FREESTYLE, "FREESTYLE_EDGE", 0, "Freestyle Edge Marks", ""},
#endif

	{SIMFACE_MATERIAL, "MATERIAL", 0, "Material", ""},
	{SIMFACE_AREA, "AREA", 0, "Area", ""},
	{SIMFACE_SIDES, "SIDES", 0, "Polygon Sides", ""},
	{SIMFACE_PERIMETER, "PERIMETER", 0, "Perimeter", ""},
	{SIMFACE_NORMAL, "NORMAL", 0, "Normal", ""},
	{SIMFACE_COPLANAR, "COPLANAR", 0, "Co-planar", ""},
	{SIMFACE_SMOOTH, "SMOOTH", 0, "Flat/Smooth", ""},
	{SIMFACE_FACEMAP, "FACE_MAP", 0, "Face-Map", ""},
#ifdef WITH_FREESTYLE
	{SIMFACE_FREESTYLE, "FREESTYLE_FACE", 0, "Freestyle Face Marks", ""},
#endif

	{0, NULL, 0, NULL, NULL}
};

static int UNUSED_FUNCTION(bm_sel_similar_cmp_fl)(const float delta, const float thresh, const int compare)
{
	switch (compare) {
		case SIM_CMP_EQ:
			return (fabsf(delta) <= thresh);
		case SIM_CMP_GT:
			return ((delta + thresh) >= 0.0f);
		case SIM_CMP_LT:
			return ((delta - thresh) <= 0.0f);
		default:
			BLI_assert(0);
			return 0;
	}
}

static int bm_sel_similar_cmp_i(const int delta, const int compare)
{
	switch (compare) {
		case SIM_CMP_EQ:
			return (delta == 0);
		case SIM_CMP_GT:
			return (delta > 0);
		case SIM_CMP_LT:
			return (delta < 0);
		default:
			BLI_assert(0);
			return 0;
	}
}

/** \} */

/* -------------------------------------------------------------------- */
/** \name Select Similar Face
 * \{ */

static int similar_face_select_exec(bContext *C, wmOperator *op)
{
	/* TODO (dfelinto) port the face modes to multi-object. */
	BKE_report(op->reports, RPT_ERROR, "Select similar not supported for faces at the moment");
	return OPERATOR_CANCELLED;

	Object *ob = CTX_data_edit_object(C);
	BMEditMesh *em = BKE_editmesh_from_object(ob);
	BMOperator bmop;

	/* get the type from RNA */
	const int type = RNA_enum_get(op->ptr, "type");
	const float thresh = RNA_float_get(op->ptr, "threshold");
	const int compare = RNA_enum_get(op->ptr, "compare");

	/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
	EDBM_op_init(em, &bmop, op,
	             "similar_faces faces=%hf type=%i thresh=%f compare=%i",
	             BM_ELEM_SELECT, type, thresh, compare);

	/* execute the operator */
	BMO_op_exec(em->bm, &bmop);

	/* clear the existing selection */
	EDBM_flag_disable_all(em, BM_ELEM_SELECT);

	/* select the output */
	BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true);

	/* finish the operator */
	if (!EDBM_op_finish(em, &bmop, op, true)) {
		return OPERATOR_CANCELLED;
	}

	EDBM_update_generic(em, false, false);

	return OPERATOR_FINISHED;
}

/** \} */

/* -------------------------------------------------------------------- */
/** \name Select Similar Edge
 * \{ */


/**
 * Note: This is not normal, but the edge direction itself and always in
 * a positive quadrant (tries z, y then x).
 * Therefore we need to use the entire object transformation matrix.
 */
static void edge_pos_direction_worldspace_get(Object *ob, BMEdge *edge, float *r_dir)
{
	float v1[3], v2[3];
	copy_v3_v3(v1, edge->v1->co);
	copy_v3_v3(v2, edge->v2->co);

	mul_m4_v3(ob->obmat, v1);
	mul_m4_v3(ob->obmat, v2);

	sub_v3_v3v3(r_dir, v1, v2);
	normalize_v3(r_dir);

	/* Make sure we have a consistent direction that can be checked regardless of
	 * the verts order of the edges. This spares us from storing dir and -dir in the tree. */
	if (fabs(r_dir[2]) < FLT_EPSILON) {
		if (fabs(r_dir[1]) < FLT_EPSILON) {
			if (r_dir[0] < 0.0f) {
				mul_v3_fl(r_dir, -1.0f);
			}
		}
		else if (r_dir[1] < 0.0f) {
			mul_v3_fl(r_dir, -1.0f);
		}
	}
	else if (r_dir[2] < 0.0f) {
		mul_v3_fl(r_dir, -1.0f);
	}
}

/* wrap the above function but do selection flushing edge to face */
static int similar_edge_select_exec(bContext *C, wmOperator *op)
{
	ViewLayer *view_layer = CTX_data_view_layer(C);

	/* get the type from RNA */
	const int type = RNA_enum_get(op->ptr, "type");
	const float thresh = RNA_float_get(op->ptr, "threshold");
	const float thresh_radians = thresh * (float)M_PI + FLT_EPSILON;
	const int compare = RNA_enum_get(op->ptr, "compare");

	if (ELEM(type,
	         SIMEDGE_LENGTH,
	         SIMEDGE_FACE_ANGLE,
	         SIMEDGE_CREASE,
	         SIMEDGE_BEVEL,
	         SIMEDGE_SEAM,
#ifdef WITH_FREESTYLE
	         SIMEDGE_FREESTYLE,
#endif
	         SIMEDGE_SHARP))
	{
		/* TODO (dfelinto) port the edge modes to multi-object. */
		BKE_report(op->reports, RPT_ERROR, "Select similar edge mode not supported at the moment");
		return OPERATOR_CANCELLED;
	}

	int tot_edges_selected_all = 0;
	uint objects_len = 0;
	Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);

	for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
		Object *ob = objects[ob_index];
		BMEditMesh *em = BKE_editmesh_from_object(ob);
		tot_edges_selected_all += em->bm->totedgesel;
	}

	if (tot_edges_selected_all == 0) {
		BKE_report(op->reports, RPT_ERROR, "No edge selected");
		MEM_freeN(objects);
		return OPERATOR_CANCELLED;
	}

	KDTree *tree = NULL;
	GSet *gset = NULL;

	switch (type) {
		case SIMEDGE_DIR:
			tree = BLI_kdtree_new(tot_edges_selected_all);
			break;
		case SIMEDGE_FACE:
			gset = BLI_gset_ptr_new("Select similar edge: face");
			break;
	}

	int tree_index = 0;
	for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
		Object *ob = objects[ob_index];
		BMEditMesh *em = BKE_editmesh_from_object(ob);
		BMesh *bm = em->bm;

		if (bm->totedgesel == 0) {
			continue;
		}

		BMEdge *edge; /* Mesh edge. */
		BMIter iter; /* Selected edges iterator. */

		BM_ITER_MESH (edge, &iter, bm, BM_EDGES_OF_MESH) {
			if (BM_elem_flag_test(edge, BM_ELEM_SELECT)) {
				switch (type) {
					case SIMEDGE_FACE:
						BLI_gset_add(gset, POINTER_FROM_INT(BM_edge_face_count(edge)));
						break;
					case SIMEDGE_DIR:
					{
						float dir[3];
						edge_pos_direction_worldspace_get(ob, edge, dir);
						BLI_kdtree_insert(tree, tree_index++, dir);
						break;
					}
				}
			}
		}
	}

	if (tree != NULL) {
		BLI_kdtree_balance(tree);
	}

	for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
		Object *ob = objects[ob_index];
		BMEditMesh *em = BKE_editmesh_from_object(ob);
		BMesh *bm = em->bm;
		bool changed = false;

		BMEdge *edge; /* Mesh edge. */
		BMIter iter; /* Selected edges iterator. */

		BM_ITER_MESH (edge, &iter, bm, BM_EDGES_OF_MESH) {
			if (!BM_elem_flag_test(edge, BM_ELEM_SELECT)) {
				switch (type) {
					case SIMEDGE_FACE:
					{
						const int num_faces = BM_edge_face_count(edge);
						GSetIterator gs_iter;
						GSET_ITER(gs_iter, gset) {
							const int num_faces_iter = POINTER_AS_INT(BLI_gsetIterator_getKey(&gs_iter));
							const int delta_i = num_faces - num_faces_iter;
							if (bm_sel_similar_cmp_i(delta_i, compare)) {
								BM_edge_select_set(bm, edge, true);
								changed = true;
								break;
							}
						}
						break;
					}
					case SIMEDGE_DIR:
					{
						float dir[3];
						edge_pos_direction_worldspace_get(ob, edge, dir);

						/* We are treating the direction as coordinates, the "nearest" one will
						 * also be the one closest to the intended direction. */
						KDTreeNearest nearest;
						if (BLI_kdtree_find_nearest(tree, dir, &nearest) != -1) {
							if (angle_normalized_v3v3(dir, nearest.co) <= thresh_radians) {
								BM_edge_select_set(bm, edge, true);
								changed = true;
							}
						}
						break;
					}
				}
			}
		}

		if (changed) {
			EDBM_selectmode_flush(em);
			EDBM_update_generic(em, false, false);
		}
	}

	MEM_freeN(objects);
	BLI_kdtree_free(tree);
	if (gset != NULL) {
		BLI_gset_free(gset, NULL);
	}

	return OPERATOR_FINISHED;
}
/** \} */

/* -------------------------------------------------------------------- */
/** \name Select Similar Vert
 * \{ */

static int similar_vert_select_exec(bContext *C, wmOperator *op)
{
	ViewLayer *view_layer = CTX_data_view_layer(C);

	/* get the type from RNA */
	const int type = RNA_enum_get(op->ptr, "type");
	const float thresh = RNA_float_get(op->ptr, "threshold");
	const float thresh_radians = thresh * (float)M_PI + FLT_EPSILON;
	const int compare = RNA_enum_get(op->ptr, "compare");

	if (type == SIMVERT_VGROUP) {
		BKE_report(op->reports, RPT_ERROR, "Select similar vertex groups not supported at the moment.");
		return OPERATOR_CANCELLED;
	}

	int tot_verts_selected_all = 0;
	uint objects_len = 0;
	Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);

	for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
		Object *ob = objects[ob_index];
		BMEditMesh *em = BKE_editmesh_from_object(ob);
		tot_verts_selected_all += em->bm->totvertsel;
	}

	if (tot_verts_selected_all == 0) {
		BKE_report(op->reports, RPT_ERROR, "No vertex selected");
		MEM_freeN(objects);
		return OPERATOR_CANCELLED;
	}

	KDTree *tree = NULL;
	GSet *gset = NULL;

	switch (type) {
		case SIMVERT_NORMAL:
			tree = BLI_kdtree_new(tot_verts_selected_all);
			break;
		case SIMVERT_EDGE:
		case SIMVERT_FACE:
			gset = BLI_gset_ptr_new("Select similar vertex: edge/face");
			break;
	}

	int normal_tree_index = 0;
	for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
		Object *ob = objects[ob_index];
		BMEditMesh *em = BKE_editmesh_from_object(ob);
		BMesh *bm = em->bm;
		invert_m4_m4(ob->imat, ob->obmat);

		if (bm->totvertsel == 0) {
			continue;
		}

		BMVert *vert; /* Mesh vertex. */
		BMIter iter; /* Selected verts iterator. */

		BM_ITER_MESH (vert, &iter, bm, BM_VERTS_OF_MESH) {
			if (BM_elem_flag_test(vert, BM_ELEM_SELECT)) {
				switch (type) {
					case SIMVERT_FACE:
						BLI_gset_add(gset, POINTER_FROM_INT(BM_vert_face_count(vert)));
						break;
					case SIMVERT_EDGE:
						BLI_gset_add(gset, POINTER_FROM_INT(BM_vert_edge_count(vert)));
						break;
					case SIMVERT_NORMAL:
					{
						float normal[3];
						copy_v3_v3(normal, vert->no);
						mul_transposed_mat3_m4_v3(ob->imat, normal);
						normalize_v3(normal);

						BLI_kdtree_insert(tree, normal_tree_index++, normal);
						break;
					}
				}
			}
		}
	}

	/* Remove duplicated entries. */
	if (tree != NULL) {
		BLI_kdtree_balance(tree);
	}

	/* Run .the BM operators. */
	for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
		Object *ob = objects[ob_index];
		BMEditMesh *em = BKE_editmesh_from_object(ob);
		BMesh *bm = em->bm;
		bool changed = false;

		BMVert *vert; /* Mesh vertex. */
		BMIter iter; /* Selected verts iterator. */

		BM_ITER_MESH (vert, &iter, bm, BM_VERTS_OF_MESH) {
			if (!BM_elem_flag_test(vert, BM_ELEM_SELECT)) {
				switch (type) {
					case SIMVERT_EDGE:
					{
						const int num_edges = BM_vert_edge_count(vert);
						GSetIterator gs_iter;
						GSET_ITER(gs_iter, gset) {
							const int num_edges_iter = POINTER_AS_INT(BLI_gsetIterator_getKey(&gs_iter));
							const int delta_i = num_edges - num_edges_iter;
							if (bm_sel_similar_cmp_i(delta_i, compare)) {
								BM_vert_select_set(bm, vert, true);
								changed = true;
								break;
							}
						}
						break;
					}
					case SIMVERT_FACE:
					{
						const int num_faces = BM_vert_face_count(vert);
						GSetIterator gs_iter;
						GSET_ITER(gs_iter, gset) {
							const int num_faces_iter = POINTER_AS_INT(BLI_gsetIterator_getKey(&gs_iter));
							const int delta_i = num_faces - num_faces_iter;
							if (bm_sel_similar_cmp_i(delta_i, compare)) {
								BM_vert_select_set(bm, vert, true);
								changed = true;
								break;
							}
						}
						break;
					}
					case SIMVERT_NORMAL:
					{
						float normal[3];
						copy_v3_v3(normal, vert->no);
						mul_transposed_mat3_m4_v3(ob->imat, normal);
						normalize_v3(normal);

						/* We are treating the normals as coordinates, the "nearest" one will
						 * also be the one closest to the angle. */
						KDTreeNearest nearest;
						if (BLI_kdtree_find_nearest(tree, normal, &nearest) != -1) {
							if (angle_normalized_v3v3(normal, nearest.co) <= thresh_radians) {
								BM_vert_select_set(bm, vert, true);
								changed = true;
							}
						}
						break;
					}
				}
			}
		}

		if (changed) {
			EDBM_selectmode_flush(em);
			EDBM_update_generic(em, false, false);
		}
	}

	MEM_freeN(objects);
	BLI_kdtree_free(tree);
	if (gset != NULL) {
		BLI_gset_free(gset, NULL);
	}

	return OPERATOR_FINISHED;
}
/** \} */

/* -------------------------------------------------------------------- */
/** \name Select Similar Operator
 * \{ */

static int edbm_select_similar_exec(bContext *C, wmOperator *op)
{
	ToolSettings *ts = CTX_data_tool_settings(C);
	PropertyRNA *prop = RNA_struct_find_property(op->ptr, "threshold");

	const int type = RNA_enum_get(op->ptr, "type");

	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 const EnumPropertyItem *select_similar_type_itemf(
        bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop),
        bool *r_free)
{
	Object *obedit;

	if (!C) /* needed for docs and i18n tools */
		return prop_similar_types;

	obedit = CTX_data_edit_object(C);

	if (obedit && obedit->type == OB_MESH) {
		EnumPropertyItem *item = NULL;
		int a, totitem = 0;
		BMEditMesh *em = BKE_editmesh_from_object(obedit);

		if (em->selectmode & SCE_SELECT_VERTEX) {
			for (a = SIMVERT_NORMAL; a < SIMEDGE_LENGTH; a++) {
				RNA_enum_items_add_value(&item, &totitem, prop_similar_types, a);
			}
		}
		else if (em->selectmode & SCE_SELECT_EDGE) {
			for (a = SIMEDGE_LENGTH; a < SIMFACE_MATERIAL; a++) {
				RNA_enum_items_add_value(&item, &totitem, prop_similar_types, a);
			}
		}
		else if (em->selectmode & SCE_SELECT_FACE) {
#ifdef WITH_FREESTYLE
			const int a_end = SIMFACE_FREESTYLE;
#else
			const int a_end = SIMFACE_FACEMAP;
#endif
			for (a = SIMFACE_MATERIAL; a <= a_end; a++) {
				RNA_enum_items_add_value(&item, &totitem, prop_similar_types, a);
			}
		}
		RNA_enum_item_end(&item, &totitem);

		*r_free = true;

		return item;
	}

	return prop_similar_types;
}

void MESH_OT_select_similar(wmOperatorType *ot)
{
	PropertyRNA *prop;

	/* identifiers */
	ot->name = "Select Similar";
	ot->idname = "MESH_OT_select_similar";
	ot->description = "Select similar vertices, edges or faces by property types";

	/* api callbacks */
	ot->invoke = WM_menu_invoke;
	ot->exec = edbm_select_similar_exec;
	ot->poll = ED_operator_editmesh;

	/* flags */
	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;

	/* 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_enum(ot->srna, "compare", prop_similar_compare_types, SIM_CMP_EQ, "Compare", "");

	RNA_def_float(ot->srna, "threshold", 0.0f, 0.0f, 1.0f, "Threshold", "", 0.0f, 1.0f);
}

/** \} */