use booleans for operator check functions.
This commit is contained in:
@@ -220,7 +220,7 @@ static int screenshot_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
|
|||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int screenshot_check(bContext *UNUSED(C), wmOperator *op)
|
static bool screenshot_check(bContext *UNUSED(C), wmOperator *op)
|
||||||
{
|
{
|
||||||
ScreenshotData *scd = op->customdata;
|
ScreenshotData *scd = op->customdata;
|
||||||
return WM_operator_filesel_ensure_ext_imtype(op, &scd->im_format);
|
return WM_operator_filesel_ensure_ext_imtype(op, &scd->im_format);
|
||||||
|
|||||||
@@ -1441,7 +1441,7 @@ static int image_save_as_exec(bContext *C, wmOperator *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int image_save_as_check(bContext *UNUSED(C), wmOperator *op)
|
static bool image_save_as_check(bContext *UNUSED(C), wmOperator *op)
|
||||||
{
|
{
|
||||||
ImageFormatData *imf = op->customdata;
|
ImageFormatData *imf = op->customdata;
|
||||||
return WM_operator_filesel_ensure_ext_imtype(op, imf);
|
return WM_operator_filesel_ensure_ext_imtype(op, imf);
|
||||||
|
|||||||
@@ -955,7 +955,7 @@ static int operator_execute(bContext *C, wmOperator *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* same as execute() but no return value */
|
/* same as execute() but no return value */
|
||||||
static int operator_check(bContext *C, wmOperator *op)
|
static bool operator_check(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
extern FunctionRNA rna_Operator_check_func;
|
extern FunctionRNA rna_Operator_check_func;
|
||||||
|
|
||||||
@@ -963,7 +963,7 @@ static int operator_check(bContext *C, wmOperator *op)
|
|||||||
ParameterList list;
|
ParameterList list;
|
||||||
FunctionRNA *func;
|
FunctionRNA *func;
|
||||||
void *ret;
|
void *ret;
|
||||||
int result;
|
bool result;
|
||||||
|
|
||||||
RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
|
RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
|
||||||
func = &rna_Operator_check_func; /* RNA_struct_find_function(&opr, "check"); */
|
func = &rna_Operator_check_func; /* RNA_struct_find_function(&opr, "check"); */
|
||||||
@@ -973,7 +973,7 @@ static int operator_check(bContext *C, wmOperator *op)
|
|||||||
op->type->ext.call(C, &opr, func, &list);
|
op->type->ext.call(C, &opr, func, &list);
|
||||||
|
|
||||||
RNA_parameter_get_lookup(&list, "result", &ret);
|
RNA_parameter_get_lookup(&list, "result", &ret);
|
||||||
result = *(int *)ret;
|
result = (*(int *)ret) != 0;
|
||||||
|
|
||||||
RNA_parameter_list_free(&list);
|
RNA_parameter_list_free(&list);
|
||||||
|
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ int WM_enum_search_invoke(struct bContext *C, struct wmOperator *op, const str
|
|||||||
int WM_operator_confirm (struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
|
int WM_operator_confirm (struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
|
||||||
/* invoke callback, file selector "filepath" unset + exec */
|
/* invoke callback, file selector "filepath" unset + exec */
|
||||||
int WM_operator_filesel (struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
|
int WM_operator_filesel (struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
|
||||||
int WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFormatData *im_format);
|
bool WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFormatData *im_format);
|
||||||
/* poll callback, context checks */
|
/* poll callback, context checks */
|
||||||
int WM_operator_winactive (struct bContext *C);
|
int WM_operator_winactive (struct bContext *C);
|
||||||
/* invoke callback, exec + redo popup */
|
/* invoke callback, exec + redo popup */
|
||||||
|
|||||||
@@ -531,7 +531,7 @@ typedef struct wmOperatorType {
|
|||||||
* is changed. It can correct its own properties or report errors for
|
* is changed. It can correct its own properties or report errors for
|
||||||
* invalid settings in exceptional cases.
|
* invalid settings in exceptional cases.
|
||||||
* Boolean return value, True denotes a change has been made and to redraw */
|
* Boolean return value, True denotes a change has been made and to redraw */
|
||||||
int (*check)(struct bContext *, struct wmOperator *);
|
bool (*check)(struct bContext *, struct wmOperator *);
|
||||||
|
|
||||||
/* for modal temporary operators, initially invoke is called. then
|
/* for modal temporary operators, initially invoke is called. then
|
||||||
* any further events are handled in modal. if the operation is
|
* any further events are handled in modal. if the operation is
|
||||||
|
|||||||
@@ -1038,7 +1038,7 @@ int WM_operator_filesel(bContext *C, wmOperator *op, const wmEvent *UNUSED(event
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFormatData *im_format)
|
bool WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFormatData *im_format)
|
||||||
{
|
{
|
||||||
PropertyRNA *prop;
|
PropertyRNA *prop;
|
||||||
char filepath[FILE_MAX];
|
char filepath[FILE_MAX];
|
||||||
@@ -2400,7 +2400,7 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* function used for WM_OT_save_mainfile too */
|
/* function used for WM_OT_save_mainfile too */
|
||||||
static int blend_save_check(bContext *UNUSED(C), wmOperator *op)
|
static bool blend_save_check(bContext *UNUSED(C), wmOperator *op)
|
||||||
{
|
{
|
||||||
char filepath[FILE_MAX];
|
char filepath[FILE_MAX];
|
||||||
RNA_string_get(op->ptr, "filepath", filepath);
|
RNA_string_get(op->ptr, "filepath", filepath);
|
||||||
|
|||||||
Reference in New Issue
Block a user