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
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2021-07-30 17:27:52 +0300
committerJulian Eisel <julian@blender.org>2021-07-30 17:43:05 +0300
commit3b2a6bf8e8f87c2d1a8927637c562502af8083b9 (patch)
tree309bc6937901d40c3368c5a8921ac0d406cd2c06 /source/blender/editors/space_userpref
parent3316e28418a2ce624c61324d8d3fd284afabf71b (diff)
UI: Don't show Windows file association operator in search on other OSes
The Windows-specific "Register File Association" operator would show in the search menu of other platforms. Decided to not disable it at compile-time, like we do it with "Toggle System Console" (another Windows-only operator), because that would require workarounds for the translation tools. Instead the operator poll function always returns false on unsupported platforms now.
Diffstat (limited to 'source/blender/editors/space_userpref')
-rw-r--r--source/blender/editors/space_userpref/userpref_ops.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/editors/space_userpref/userpref_ops.c b/source/blender/editors/space_userpref/userpref_ops.c
index 79f5d1818cb..63506678b70 100644
--- a/source/blender/editors/space_userpref/userpref_ops.c
+++ b/source/blender/editors/space_userpref/userpref_ops.c
@@ -197,6 +197,17 @@ static void PREFERENCES_OT_asset_library_remove(wmOperatorType *ot)
/** \name Associate File Type Operator (Windows only)
* \{ */
+static bool associate_blend_poll(bContext *C)
+{
+#ifdef WIN32
+ UNUSED_VARS(C);
+ return true;
+#else
+ CTX_wm_operator_poll_msg_set(C, "Windows-only operator");
+ return false;
+#endif
+}
+
static int associate_blend_exec(bContext *UNUSED(C), wmOperator *op)
{
#ifdef WIN32
@@ -212,7 +223,8 @@ static int associate_blend_exec(bContext *UNUSED(C), wmOperator *op)
return OPERATOR_CANCELLED;
}
#else
- BKE_report(op->reports, RPT_WARNING, "Operator Not supported");
+ UNUSED_VARS(op);
+ BLI_assert_unreachable();
return OPERATOR_CANCELLED;
#endif
}
@@ -226,6 +238,7 @@ static void PREFERENCES_OT_associate_blend(struct wmOperatorType *ot)
/* api callbacks */
ot->exec = associate_blend_exec;
+ ot->poll = associate_blend_poll;
}
/** \} */