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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2022-01-07 13:26:05 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2022-01-11 13:47:57 +0300
commit9dc9692b09793cda3db9ba59108a81be338b4c4b (patch)
treedde7edbf1b378e167c7005725bca9d528523fd04 /source
parent255727b752c5737644ba14a85ece702b3cd32fba (diff)
Select Similar: hide 'threshold' from UI when not used
When the 'threshold' is not used in the type we are comparing, just hide it. This was obvious for some types (e.g. Materials), but maybe not so on others (e.g. Polygon Sides) and potentionally confusing. Reported by @hitrpr in chat. Differential Revision: https://developer.blender.org/D13760
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/mesh/editmesh_select_similar.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/editors/mesh/editmesh_select_similar.c b/source/blender/editors/mesh/editmesh_select_similar.c
index f2311eb926d..949b12f9a65 100644
--- a/source/blender/editors/mesh/editmesh_select_similar.c
+++ b/source/blender/editors/mesh/editmesh_select_similar.c
@@ -1334,6 +1334,33 @@ static const EnumPropertyItem *select_similar_type_itemf(bContext *C,
return prop_similar_types;
}
+static bool edbm_select_similar_poll_property(const bContext *UNUSED(C),
+ wmOperator *op,
+ const PropertyRNA *prop)
+{
+ const char *prop_id = RNA_property_identifier(prop);
+ const int type = RNA_enum_get(op->ptr, "type");
+
+ /* Only show threshold when it is used. */
+ if (STREQ(prop_id, "threshold")) {
+ if (!ELEM(type,
+ SIMVERT_NORMAL,
+ SIMEDGE_BEVEL,
+ SIMEDGE_CREASE,
+ SIMEDGE_DIR,
+ SIMEDGE_LENGTH,
+ SIMEDGE_FACE_ANGLE,
+ SIMFACE_AREA,
+ SIMFACE_PERIMETER,
+ SIMFACE_NORMAL,
+ SIMFACE_COPLANAR)) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
void MESH_OT_select_similar(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -1347,6 +1374,7 @@ void MESH_OT_select_similar(wmOperatorType *ot)
ot->invoke = WM_menu_invoke;
ot->exec = edbm_select_similar_exec;
ot->poll = ED_operator_editmesh;
+ ot->poll_property = edbm_select_similar_poll_property;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;