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:
authorColin Basnett <cmbasnett@gmail.com>2022-11-11 22:13:00 +0300
committerColin Basnett <cmbasnett@gmail.com>2022-11-11 22:13:24 +0300
commit1fdaf748bf4a6b65465602aefa36868e69b4c30f (patch)
tree2a2770f82c640e52cdb04d82494a49f98304fdad
parent5671e7a92c397e3558f346cc2796da452f016b17 (diff)
Add poll messages for marker operators
A number of operators were missing poll messages when disabled. These are the following new error messages: 1. "No markers are selected" 2. "Markers are locked" Reviewed By: sybren Differential Revision: https://developer.blender.org/D16403
-rw-r--r--source/blender/editors/animation/anim_markers.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 94746837259..c980fd73342 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -663,11 +663,16 @@ static bool ed_markers_poll_selected_markers(bContext *C)
ListBase *markers = ED_context_get_markers(C);
if (!ED_operator_markers_region_active(C)) {
- return 0;
+ return false;
}
/* check if some marker is selected */
- return ED_markers_get_first_selected(markers) != NULL;
+ if (ED_markers_get_first_selected(markers) == NULL) {
+ CTX_wm_operator_poll_msg_set(C, "No markers are selected");
+ return false;
+ }
+
+ return true;
}
static bool ed_markers_poll_selected_no_locked_markers(bContext *C)
@@ -675,12 +680,22 @@ static bool ed_markers_poll_selected_no_locked_markers(bContext *C)
ListBase *markers = ED_context_get_markers(C);
ToolSettings *ts = CTX_data_tool_settings(C);
- if (ts->lock_markers || !ED_operator_markers_region_active(C)) {
- return 0;
+ if (!ED_operator_markers_region_active(C)) {
+ return false;
+ }
+
+ if (ts->lock_markers) {
+ CTX_wm_operator_poll_msg_set(C, "Markers are locked");
+ return false;
}
/* check if some marker is selected */
- return ED_markers_get_first_selected(markers) != NULL;
+ if (ED_markers_get_first_selected(markers) == NULL) {
+ CTX_wm_operator_poll_msg_set(C, "No markers are selected");
+ return false;
+ }
+
+ return true;
}
/* special poll() which checks if there are any markers at all first */