Merge branch 'master' into blender2.8

This commit is contained in:
2018-07-26 13:50:56 +10:00
16 changed files with 97 additions and 52 deletions

View File

@@ -1382,7 +1382,7 @@ static int gp_convert_layer_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
} }
static bool gp_convert_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop) static bool gp_convert_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop, void *UNUSED(user_data))
{ {
const char *prop_id = RNA_property_identifier(prop); const char *prop_id = RNA_property_identifier(prop);
const bool link_strokes = RNA_boolean_get(ptr, "use_link_strokes"); const bool link_strokes = RNA_boolean_get(ptr, "use_link_strokes");
@@ -1455,7 +1455,7 @@ static void gp_convert_ui(bContext *C, wmOperator *op)
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
/* Main auto-draw call */ /* Main auto-draw call */
uiDefAutoButsRNA(layout, &ptr, gp_convert_draw_check_prop, UI_BUT_LABEL_ALIGN_NONE, false); uiDefAutoButsRNA(layout, &ptr, gp_convert_draw_check_prop, NULL, '\0', false);
} }
void GPENCIL_OT_convert(wmOperatorType *ot) void GPENCIL_OT_convert(wmOperatorType *ot)

View File

@@ -772,7 +772,7 @@ typedef enum {
uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, const char *name, int icon, int x1, int y1, int x2, int y2); uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, const char *name, int icon, int x1, int y1, int x2, int y2);
eAutoPropButsReturn uiDefAutoButsRNA( eAutoPropButsReturn uiDefAutoButsRNA(
uiLayout *layout, struct PointerRNA *ptr, uiLayout *layout, struct PointerRNA *ptr,
bool (*check_prop)(struct PointerRNA *, struct PropertyRNA *), bool (*check_prop)(struct PointerRNA *ptr, struct PropertyRNA *prop, void *user_data), void *user_data,
eButLabelAlign label_align, const bool compact); eButLabelAlign label_align, const bool compact);
/* use inside searchfunc to add items */ /* use inside searchfunc to add items */
@@ -935,6 +935,7 @@ enum {
UI_TEMPLATE_OP_PROPS_SHOW_TITLE = (1 << 0), UI_TEMPLATE_OP_PROPS_SHOW_TITLE = (1 << 0),
UI_TEMPLATE_OP_PROPS_SHOW_EMPTY = (1 << 1), UI_TEMPLATE_OP_PROPS_SHOW_EMPTY = (1 << 1),
UI_TEMPLATE_OP_PROPS_COMPACT = (1 << 2), UI_TEMPLATE_OP_PROPS_COMPACT = (1 << 2),
UI_TEMPLATE_OP_PROPS_HIDE_ADVANCED = (1 << 3),
}; };
/* used for transp checkers */ /* used for transp checkers */
@@ -1085,7 +1086,6 @@ void UI_but_func_operator_search(uiBut *but);
void uiTemplateOperatorSearch(uiLayout *layout); void uiTemplateOperatorSearch(uiLayout *layout);
eAutoPropButsReturn uiTemplateOperatorPropertyButs( eAutoPropButsReturn uiTemplateOperatorPropertyButs(
const struct bContext *C, uiLayout *layout, struct wmOperator *op, const struct bContext *C, uiLayout *layout, struct wmOperator *op,
bool (*check_prop)(struct PointerRNA *, struct PropertyRNA *),
const eButLabelAlign label_align, const short flag); const eButLabelAlign label_align, const short flag);
void uiTemplateHeader3D_mode(uiLayout *layout, struct bContext *C); void uiTemplateHeader3D_mode(uiLayout *layout, struct bContext *C);
void uiTemplateHeader3D(uiLayout *layout, struct bContext *C); void uiTemplateHeader3D(uiLayout *layout, struct bContext *C);

View File

@@ -1542,11 +1542,6 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
/************************ Redo Buttons Template *************************/ /************************ Redo Buttons Template *************************/
static bool template_operator_redo_property_buts_poll(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
return (RNA_property_tags(prop) & OP_PROP_TAG_ADVANCED) == 0;
}
static void template_operator_redo_property_buts_draw( static void template_operator_redo_property_buts_draw(
const bContext *C, wmOperator *op, const bContext *C, wmOperator *op,
uiLayout *layout, int layout_flags, uiLayout *layout, int layout_flags,
@@ -1560,8 +1555,9 @@ static void template_operator_redo_property_buts_draw(
else { else {
/* Might want to make label_align adjustable somehow. */ /* Might want to make label_align adjustable somehow. */
eAutoPropButsReturn return_info = uiTemplateOperatorPropertyButs( eAutoPropButsReturn return_info = uiTemplateOperatorPropertyButs(
C, layout, op, r_has_advanced ? template_operator_redo_property_buts_poll : NULL, C, layout, op,
UI_BUT_LABEL_ALIGN_NONE, layout_flags); UI_BUT_LABEL_ALIGN_NONE,
layout_flags | (r_has_advanced ? UI_TEMPLATE_OP_PROPS_HIDE_ADVANCED : 0));
if (return_info & UI_PROP_BUTS_ANY_FAILED_CHECK) { if (return_info & UI_PROP_BUTS_ANY_FAILED_CHECK) {
if (r_has_advanced) { if (r_has_advanced) {
*r_has_advanced = true; *r_has_advanced = true;
@@ -3948,13 +3944,30 @@ static void ui_layout_operator_buts__reset_cb(bContext *UNUSED(C), void *op_pt,
} }
#endif #endif
struct uiTemplateOperatorPropertyPollParam {
const bContext *C;
wmOperator *op;
short flag;
};
static bool ui_layout_operator_buts_poll_property(
struct PointerRNA *UNUSED(ptr), struct PropertyRNA *prop, void *user_data)
{
struct uiTemplateOperatorPropertyPollParam *params = user_data;
if ((params->flag & UI_TEMPLATE_OP_PROPS_HIDE_ADVANCED) &&
(RNA_property_tags(prop) & OP_PROP_TAG_ADVANCED))
{
return false;
}
return params->op->type->poll_property(params->C, params->op, prop);
}
/** /**
* Draw Operator property buttons for redoing execution with different settings. * 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. * This function does not initialize the layout, functions can be called on the layout before and after.
*/ */
eAutoPropButsReturn uiTemplateOperatorPropertyButs( eAutoPropButsReturn uiTemplateOperatorPropertyButs(
const bContext *C, uiLayout *layout, wmOperator *op, const bContext *C, uiLayout *layout, wmOperator *op,
bool (*check_prop)(struct PointerRNA *, struct PropertyRNA *),
const eButLabelAlign label_align, const short flag) const eButLabelAlign label_align, const short flag)
{ {
uiBlock *block = uiLayoutGetBlock(layout); uiBlock *block = uiLayoutGetBlock(layout);
@@ -4013,13 +4026,32 @@ eAutoPropButsReturn uiTemplateOperatorPropertyButs(
else { else {
wmWindowManager *wm = CTX_wm_manager(C); wmWindowManager *wm = CTX_wm_manager(C);
PointerRNA ptr; PointerRNA ptr;
struct uiTemplateOperatorPropertyPollParam user_data = {.C = C, .op = op, .flag = flag};
#if 0
static bool template_operator_redo_property_buts_poll(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
}
#endif
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
uiLayoutSetPropSep(layout, true); uiLayoutSetPropSep(layout, true);
/* main draw call */ /* main draw call */
return_info = uiDefAutoButsRNA(layout, &ptr, check_prop, label_align, (flag & UI_TEMPLATE_OP_PROPS_COMPACT)); return_info = uiDefAutoButsRNA(
layout, &ptr,
op->type->poll_property ? ui_layout_operator_buts_poll_property : NULL,
op->type->poll_property ? &user_data : NULL,
label_align, (flag & UI_TEMPLATE_OP_PROPS_COMPACT));
if ((return_info & UI_PROP_BUTS_NONE_ADDED) && (flag & UI_TEMPLATE_OP_PROPS_SHOW_EMPTY)) { if ((return_info & UI_PROP_BUTS_NONE_ADDED) && (flag & UI_TEMPLATE_OP_PROPS_SHOW_EMPTY)) {
uiItemL(layout, IFACE_("No Properties"), ICON_NONE); uiItemL(layout, IFACE_("No Properties"), ICON_NONE);

View File

@@ -159,7 +159,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
*/ */
eAutoPropButsReturn uiDefAutoButsRNA( eAutoPropButsReturn uiDefAutoButsRNA(
uiLayout *layout, PointerRNA *ptr, uiLayout *layout, PointerRNA *ptr,
bool (*check_prop)(PointerRNA *, PropertyRNA *), bool (*check_prop)(PointerRNA *ptr, PropertyRNA *prop, void *user_data), void *user_data,
const eButLabelAlign label_align, const bool compact) const eButLabelAlign label_align, const bool compact)
{ {
eAutoPropButsReturn return_info = UI_PROP_BUTS_NONE_ADDED; eAutoPropButsReturn return_info = UI_PROP_BUTS_NONE_ADDED;
@@ -174,7 +174,7 @@ eAutoPropButsReturn uiDefAutoButsRNA(
if (flag & PROP_HIDDEN) { if (flag & PROP_HIDDEN) {
continue; continue;
} }
if (check_prop && check_prop(ptr, prop) == 0) { if (check_prop && check_prop(ptr, prop, user_data) == 0) {
return_info |= UI_PROP_BUTS_ANY_FAILED_CHECK; return_info |= UI_PROP_BUTS_ANY_FAILED_CHECK;
continue; continue;
} }

View File

@@ -6001,7 +6001,7 @@ static int edbm_sort_elements_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
} }
static bool edbm_sort_elements_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop) static bool edbm_sort_elements_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop, void *UNUSED(user_data))
{ {
const char *prop_id = RNA_property_identifier(prop); const char *prop_id = RNA_property_identifier(prop);
const int action = RNA_enum_get(ptr, "type"); const int action = RNA_enum_get(ptr, "type");
@@ -6034,7 +6034,7 @@ static void edbm_sort_elements_ui(bContext *C, wmOperator *op)
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
/* Main auto-draw call. */ /* Main auto-draw call. */
uiDefAutoButsRNA(layout, &ptr, edbm_sort_elements_draw_check_prop, UI_BUT_LABEL_ALIGN_NONE, false); uiDefAutoButsRNA(layout, &ptr, edbm_sort_elements_draw_check_prop, NULL, UI_BUT_LABEL_ALIGN_NONE, false);
} }
void MESH_OT_sort_elements(wmOperatorType *ot) void MESH_OT_sort_elements(wmOperatorType *ot)

View File

@@ -450,7 +450,7 @@ static bool data_transfer_poll(bContext *C)
} }
/* Used by both OBJECT_OT_data_transfer and OBJECT_OT_datalayout_transfer */ /* Used by both OBJECT_OT_data_transfer and OBJECT_OT_datalayout_transfer */
static bool data_transfer_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop) static bool data_transfer_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop, void *UNUSED(user_data))
{ {
PropertyRNA *prop_other; PropertyRNA *prop_other;
@@ -522,7 +522,7 @@ static void data_transfer_ui(bContext *C, wmOperator *op)
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
/* Main auto-draw call */ /* Main auto-draw call */
uiDefAutoButsRNA(layout, &ptr, data_transfer_draw_check_prop, UI_BUT_LABEL_ALIGN_NONE, false); uiDefAutoButsRNA(layout, &ptr, data_transfer_draw_check_prop, NULL, '\0', false);
} }
/* transfers weight from active to selected */ /* transfers weight from active to selected */

View File

@@ -947,7 +947,7 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent
return OPERATOR_INTERFACE; return OPERATOR_INTERFACE;
} }
static bool parent_set_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop) static bool parent_set_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop, void *UNUSED(user_data))
{ {
const char *prop_id = RNA_property_identifier(prop); const char *prop_id = RNA_property_identifier(prop);
const int type = RNA_enum_get(ptr, "type"); const int type = RNA_enum_get(ptr, "type");
@@ -972,7 +972,7 @@ static void parent_set_ui(bContext *C, wmOperator *op)
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
/* Main auto-draw call. */ /* Main auto-draw call. */
uiDefAutoButsRNA(layout, &ptr, parent_set_draw_check_prop, UI_BUT_LABEL_ALIGN_NONE, false); uiDefAutoButsRNA(layout, &ptr, parent_set_draw_check_prop, NULL, UI_BUT_LABEL_ALIGN_NONE, false);
} }
void OBJECT_OT_parent_set(wmOperatorType *ot) void OBJECT_OT_parent_set(wmOperatorType *ot)

View File

@@ -247,7 +247,7 @@ static void screenshot_cancel(bContext *UNUSED(C), wmOperator *op)
screenshot_data_free(op); screenshot_data_free(op);
} }
static bool screenshot_draw_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop) static bool screenshot_draw_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop, void *UNUSED(user_data))
{ {
const char *prop_id = RNA_property_identifier(prop); const char *prop_id = RNA_property_identifier(prop);
@@ -266,7 +266,7 @@ static void screenshot_draw(bContext *UNUSED(C), wmOperator *op)
/* main draw call */ /* main draw call */
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
uiDefAutoButsRNA(layout, &ptr, screenshot_draw_check_prop, UI_BUT_LABEL_ALIGN_NONE, false); uiDefAutoButsRNA(layout, &ptr, screenshot_draw_check_prop, NULL, UI_BUT_LABEL_ALIGN_NONE, false);
} }
static bool screenshot_poll(bContext *C) static bool screenshot_poll(bContext *C)

View File

@@ -482,7 +482,7 @@ static int sound_mixdown_invoke(bContext *C, wmOperator *op, const wmEvent *even
#ifdef WITH_AUDASPACE #ifdef WITH_AUDASPACE
static bool sound_mixdown_draw_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop) static bool sound_mixdown_draw_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop, void *UNUSED(user_data))
{ {
const char *prop_id = RNA_property_identifier(prop); const char *prop_id = RNA_property_identifier(prop);
return !(STREQ(prop_id, "filepath") || return !(STREQ(prop_id, "filepath") ||
@@ -635,7 +635,7 @@ static void sound_mixdown_draw(bContext *C, wmOperator *op)
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
/* main draw call */ /* main draw call */
uiDefAutoButsRNA(layout, &ptr, sound_mixdown_draw_check_prop, UI_BUT_LABEL_ALIGN_NONE, false); uiDefAutoButsRNA(layout, &ptr, sound_mixdown_draw_check_prop, NULL, UI_BUT_LABEL_ALIGN_NONE, false);
} }
#endif // WITH_AUDASPACE #endif // WITH_AUDASPACE

View File

@@ -43,6 +43,7 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "RNA_access.h" #include "RNA_access.h"
#include "RNA_define.h"
#include "ED_fileselect.h" #include "ED_fileselect.h"
@@ -71,25 +72,28 @@ static void file_panel_operator_header(const bContext *C, Panel *pa)
BLI_strncpy(pa->drawname, RNA_struct_ui_name(op->type->srna), sizeof(pa->drawname)); BLI_strncpy(pa->drawname, RNA_struct_ui_name(op->type->srna), sizeof(pa->drawname));
} }
static bool file_panel_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
const char *prop_id = RNA_property_identifier(prop);
return !(STREQ(prop_id, "filepath") ||
STREQ(prop_id, "directory") ||
STREQ(prop_id, "filename")
);
}
static void file_panel_operator(const bContext *C, Panel *pa) static void file_panel_operator(const bContext *C, Panel *pa)
{ {
SpaceFile *sfile = CTX_wm_space_file(C); SpaceFile *sfile = CTX_wm_space_file(C);
wmOperator *op = sfile->op; wmOperator *op = sfile->op;
// int empty = 1, flag;
UI_block_func_set(uiLayoutGetBlock(pa->layout), file_draw_check_cb, NULL, NULL); UI_block_func_set(uiLayoutGetBlock(pa->layout), file_draw_check_cb, NULL, NULL);
uiTemplateOperatorPropertyButs(C, pa->layout, op, file_panel_check_prop, UI_BUT_LABEL_ALIGN_NONE, /* Hack: temporary hide.*/
UI_TEMPLATE_OP_PROPS_SHOW_EMPTY); const char *hide[3] = {"filepath", "directory", "filename"};
for (int i = 0; i < ARRAY_SIZE(hide); i++) {
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "filepath");
RNA_def_property_flag(prop, PROP_HIDDEN);
}
uiTemplateOperatorPropertyButs(
C, pa->layout, op, UI_BUT_LABEL_ALIGN_NONE,
UI_TEMPLATE_OP_PROPS_SHOW_EMPTY);
for (int i = 0; i < ARRAY_SIZE(hide); i++) {
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "filepath");
RNA_def_property_clear_flag(prop, PROP_HIDDEN);
}
UI_block_func_set(uiLayoutGetBlock(pa->layout), NULL, NULL, NULL); UI_block_func_set(uiLayoutGetBlock(pa->layout), NULL, NULL, NULL);
} }

View File

@@ -1410,7 +1410,7 @@ static int image_open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
return OPERATOR_RUNNING_MODAL; return OPERATOR_RUNNING_MODAL;
} }
static bool image_open_draw_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop) static bool image_open_draw_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop, void *UNUSED(user_data))
{ {
const char *prop_id = RNA_property_identifier(prop); const char *prop_id = RNA_property_identifier(prop);
@@ -1429,7 +1429,7 @@ static void image_open_draw(bContext *UNUSED(C), wmOperator *op)
/* main draw call */ /* main draw call */
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
uiDefAutoButsRNA(layout, &ptr, image_open_draw_check_prop, UI_BUT_LABEL_ALIGN_NONE, false); uiDefAutoButsRNA(layout, &ptr, image_open_draw_check_prop, NULL, UI_BUT_LABEL_ALIGN_NONE, false);
/* image template */ /* image template */
RNA_pointer_create(NULL, &RNA_ImageFormatSettings, imf, &imf_ptr); RNA_pointer_create(NULL, &RNA_ImageFormatSettings, imf, &imf_ptr);
@@ -2124,7 +2124,7 @@ static void image_save_as_cancel(bContext *UNUSED(C), wmOperator *op)
image_save_as_free(op); image_save_as_free(op);
} }
static bool image_save_as_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop) static bool image_save_as_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop, void *UNUSED(user_data))
{ {
const char *prop_id = RNA_property_identifier(prop); const char *prop_id = RNA_property_identifier(prop);
@@ -2149,7 +2149,7 @@ static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op)
/* main draw call */ /* main draw call */
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
uiDefAutoButsRNA(layout, &ptr, image_save_as_draw_check_prop, UI_BUT_LABEL_ALIGN_NONE, false); uiDefAutoButsRNA(layout, &ptr, image_save_as_draw_check_prop, NULL, UI_BUT_LABEL_ALIGN_NONE, false);
/* multiview template */ /* multiview template */
if (is_multiview) if (is_multiview)

View File

@@ -627,7 +627,7 @@ static void sequencer_add_cancel(bContext *UNUSED(C), wmOperator *op)
op->customdata = NULL; op->customdata = NULL;
} }
static bool sequencer_add_draw_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop) static bool sequencer_add_draw_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop, void *UNUSED(user_data))
{ {
const char *prop_id = RNA_property_identifier(prop); const char *prop_id = RNA_property_identifier(prop);
@@ -693,7 +693,7 @@ static void sequencer_add_draw(bContext *UNUSED(C), wmOperator *op)
/* main draw call */ /* main draw call */
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
uiDefAutoButsRNA(layout, &ptr, sequencer_add_draw_check_prop, UI_BUT_LABEL_ALIGN_NONE, false); uiDefAutoButsRNA(layout, &ptr, sequencer_add_draw_check_prop, NULL, UI_BUT_LABEL_ALIGN_NONE, false);
/* image template */ /* image template */
RNA_pointer_create(NULL, &RNA_ImageFormatSettings, imf, &imf_ptr); RNA_pointer_create(NULL, &RNA_ImageFormatSettings, imf, &imf_ptr);

View File

@@ -800,7 +800,7 @@ bool RNA_struct_bl_idname_ok_or_report(struct ReportList *reports, const char *i
/* Property Information */ /* Property Information */
const char *RNA_property_identifier(PropertyRNA *prop); const char *RNA_property_identifier(const PropertyRNA *prop);
const char *RNA_property_description(PropertyRNA *prop); const char *RNA_property_description(PropertyRNA *prop);
PropertyType RNA_property_type(PropertyRNA *prop); PropertyType RNA_property_type(PropertyRNA *prop);

View File

@@ -975,7 +975,7 @@ bool RNA_struct_bl_idname_ok_or_report(ReportList *reports, const char *identifi
/* Property Information */ /* Property Information */
const char *RNA_property_identifier(PropertyRNA *prop) const char *RNA_property_identifier(const PropertyRNA *prop)
{ {
return rna_ensure_property_identifier(prop); return rna_ensure_property_identifier(prop);
} }

View File

@@ -585,6 +585,12 @@ typedef struct wmOperatorType {
* that the operator might still fail to execute even if this return true */ * that the operator might still fail to execute even if this return true */
bool (*poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT; bool (*poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT;
/* Use to check of properties should be displayed in auto-generated UI.
* Use 'check' callback to enforce refreshing. */
bool (*poll_property)(
const struct bContext *C, struct wmOperator *op,
const PropertyRNA *prop) ATTR_WARN_UNUSED_RESULT;
/* optional panel for redo and repeat, autogenerated if not set */ /* optional panel for redo and repeat, autogenerated if not set */
void (*ui)(struct bContext *, struct wmOperator *); void (*ui)(struct bContext *, struct wmOperator *);

View File

@@ -1043,15 +1043,17 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
if (op->type->flag & OPTYPE_MACRO) { if (op->type->flag & OPTYPE_MACRO) {
for (op = op->macro.first; op; op = op->next) { for (op = op->macro.first; op; op = op->next) {
uiTemplateOperatorPropertyButs(C, layout, op, NULL, UI_BUT_LABEL_ALIGN_SPLIT_COLUMN, uiTemplateOperatorPropertyButs(
UI_TEMPLATE_OP_PROPS_SHOW_TITLE); C, layout, op, UI_BUT_LABEL_ALIGN_SPLIT_COLUMN,
UI_TEMPLATE_OP_PROPS_SHOW_TITLE);
if (op->next) if (op->next)
uiItemS(layout); uiItemS(layout);
} }
} }
else { else {
uiTemplateOperatorPropertyButs(C, layout, op, NULL, UI_BUT_LABEL_ALIGN_SPLIT_COLUMN, uiTemplateOperatorPropertyButs(
UI_TEMPLATE_OP_PROPS_SHOW_TITLE); C, layout, op, UI_BUT_LABEL_ALIGN_SPLIT_COLUMN,
UI_TEMPLATE_OP_PROPS_SHOW_TITLE);
} }
UI_block_bounds_set_popup(block, 4, 0, 0); UI_block_bounds_set_popup(block, 4, 0, 0);
@@ -1120,8 +1122,9 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData)
layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style); layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style);
uiTemplateOperatorPropertyButs(C, layout, op, NULL, UI_BUT_LABEL_ALIGN_SPLIT_COLUMN, uiTemplateOperatorPropertyButs(
UI_TEMPLATE_OP_PROPS_SHOW_TITLE); C, layout, op, UI_BUT_LABEL_ALIGN_SPLIT_COLUMN,
UI_TEMPLATE_OP_PROPS_SHOW_TITLE);
/* clear so the OK button is left alone */ /* clear so the OK button is left alone */
UI_block_func_set(block, NULL, NULL, NULL); UI_block_func_set(block, NULL, NULL, NULL);
@@ -1160,7 +1163,7 @@ static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData)
layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style); layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style);
/* since ui is defined the auto-layout args are not used */ /* since ui is defined the auto-layout args are not used */
uiTemplateOperatorPropertyButs(C, layout, op, NULL, UI_BUT_LABEL_ALIGN_COLUMN, 0); uiTemplateOperatorPropertyButs(C, layout, op, UI_BUT_LABEL_ALIGN_COLUMN, 0);
UI_block_func_set(block, NULL, NULL, NULL); UI_block_func_set(block, NULL, NULL, NULL);