diff options
author | Julian Eisel <julian@blender.org> | 2021-07-30 17:27:52 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-07-30 17:43:05 +0300 |
commit | 3b2a6bf8e8f87c2d1a8927637c562502af8083b9 (patch) | |
tree | 309bc6937901d40c3368c5a8921ac0d406cd2c06 | |
parent | 3316e28418a2ce624c61324d8d3fd284afabf71b (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.
-rw-r--r-- | source/blender/editors/space_userpref/userpref_ops.c | 15 |
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; } /** \} */ |