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:
Diffstat (limited to 'source/blender/editors/interface/interface_templates.c')
-rw-r--r--source/blender/editors/interface/interface_templates.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index daee0d3af3f..9d05819dd6a 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -3549,13 +3549,24 @@ static void ui_layout_operator_buts__reset_cb(bContext *UNUSED(C), void *op_pt,
}
#endif
+struct uiTemplateOperatorPropertyPollParam {
+ const bContext *C;
+ wmOperator *op;
+};
+
+static bool ui_layout_operator_buts_poll_property(
+ struct PointerRNA *UNUSED(ptr), struct PropertyRNA *prop, void *user_data)
+{
+ struct uiTemplateOperatorPropertyPollParam *params = user_data;
+ return params->op->type->poll_property(params->C, params->op, prop);
+}
+
/**
* Draw Operator property buttons for redoing execution with different settings.
* This function does not initialize the layout, functions can be called on the layout before and after.
*/
void uiTemplateOperatorPropertyButs(
const bContext *C, uiLayout *layout, wmOperator *op,
- bool (*check_prop)(struct PointerRNA *, struct PropertyRNA *),
const char label_align, const short flag)
{
if (!op->properties) {
@@ -3611,11 +3622,16 @@ void uiTemplateOperatorPropertyButs(
wmWindowManager *wm = CTX_wm_manager(C);
PointerRNA ptr;
int empty;
+ struct uiTemplateOperatorPropertyPollParam user_data = {.C = C, .op = op};
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
/* main draw call */
- empty = uiDefAutoButsRNA(layout, &ptr, check_prop, label_align) == 0;
+ empty = uiDefAutoButsRNA(
+ layout, &ptr,
+ op->type->poll_property ? ui_layout_operator_buts_poll_property : NULL,
+ op->type->poll_property ? &user_data : NULL,
+ label_align) == 0;
if (empty && (flag & UI_TEMPLATE_OP_PROPS_SHOW_EMPTY)) {
uiItemL(layout, IFACE_("No Properties"), ICON_NONE);