Fix T68749: BPY: Deprecate height of popup

`invoke_props_dialog` and `invoke_popup` had a width and a height field. The height field was ignored as the height is determined based on the content. This change removes the field from the BPY + WM_api

Reviewed By: Campbell Barton, Jacques Lucke

Differential Revision: https://developer.blender.org/D6694
This commit is contained in:
Jeroen Bakker 2020-01-28 10:49:05 +01:00
parent e2e2a98573
commit e64166652b
11 changed files with 22 additions and 24 deletions

View File

@ -280,7 +280,7 @@ static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, const wmEven
/* show popup dialog to allow editing of range... */
// FIXME: hardcoded dimensions here are just arbitrary
return WM_operator_props_dialog_popup(C, op, 200, 200);
return WM_operator_props_dialog_popup(C, op, 200);
}
/* For the object with pose/action: create path curves for selected bones

View File

@ -1020,7 +1020,7 @@ static int object_calculate_paths_invoke(bContext *C, wmOperator *op, const wmEv
/* show popup dialog to allow editing of range... */
/* FIXME: hardcoded dimensions here are just arbitrary */
return WM_operator_props_dialog_popup(C, op, 200, 200);
return WM_operator_props_dialog_popup(C, op, 200);
}
/* Calculate/recalculate whole paths (avs.path_sf to avs.path_ef) */
@ -1739,7 +1739,7 @@ static int move_to_collection_invoke(bContext *C, wmOperator *op, const wmEvent
BKE_collection_new_name_get(collection, name);
RNA_property_string_set(op->ptr, prop, name);
return WM_operator_props_dialog_popup(C, op, 200, 100);
return WM_operator_props_dialog_popup(C, op, 200);
}
}
return move_to_collection_exec(C, op);

View File

@ -6732,7 +6732,7 @@ static int texture_paint_add_texture_paint_slot_invoke(bContext *C,
get_default_texture_layer_name_for_object(ob, type, (char *)&imagename, sizeof(imagename));
RNA_string_set(op->ptr, "name", imagename);
return WM_operator_props_dialog_popup(C, op, 300, 100);
return WM_operator_props_dialog_popup(C, op, 300);
}
#define IMA_DEF_NAME N_("Untitled")

View File

@ -2821,7 +2821,7 @@ static int image_new_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e
/* Better for user feedback. */
RNA_string_set(op->ptr, "name", DATA_(IMA_DEF_NAME));
return WM_operator_props_dialog_popup(C, op, 300, 100);
return WM_operator_props_dialog_popup(C, op, 300);
}
static void image_new_draw(bContext *UNUSED(C), wmOperator *op)
@ -3067,7 +3067,7 @@ static int image_scale_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED
RNA_property_int_set_array(op->ptr, prop, size);
BKE_image_release_ibuf(ima, ibuf, NULL);
}
return WM_operator_props_dialog_popup(C, op, 200, 200);
return WM_operator_props_dialog_popup(C, op, 200);
}
static int image_scale_exec(bContext *C, wmOperator *op)
@ -4428,7 +4428,7 @@ static int tile_add_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(ev
RNA_int_set(op->ptr, "count", 1);
RNA_string_set(op->ptr, "label", "");
return WM_operator_props_dialog_popup(C, op, 10 * UI_UNIT_X, 5 * UI_UNIT_Y);
return WM_operator_props_dialog_popup(C, op, 10 * UI_UNIT_X);
}
static void tile_add_draw(bContext *UNUSED(C), wmOperator *op)
@ -4562,7 +4562,7 @@ static int tile_fill_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e
{
initialize_fill_tile(op->ptr, CTX_data_edit_image(C), NULL);
return WM_operator_props_dialog_popup(C, op, 15 * UI_UNIT_X, 5 * UI_UNIT_Y);
return WM_operator_props_dialog_popup(C, op, 15 * UI_UNIT_X);
}
static void tile_fill_draw(bContext *UNUSED(C), wmOperator *op)

View File

@ -642,7 +642,7 @@ static int outliner_id_remap_invoke(bContext *C, wmOperator *op, const wmEvent *
outliner_id_remap_find_tree_element(C, op, &soops->tree, fmval[1]);
}
return WM_operator_props_dialog_popup(C, op, 200, 100);
return WM_operator_props_dialog_popup(C, op, 200);
}
static const EnumPropertyItem *outliner_id_itemf(bContext *C,

View File

@ -3759,7 +3759,7 @@ static int sequencer_enable_proxies_invoke(bContext *C,
wmOperator *op,
const wmEvent *UNUSED(event))
{
return WM_operator_props_dialog_popup(C, op, 200, 100);
return WM_operator_props_dialog_popup(C, op, 200);
}
static int sequencer_enable_proxies_exec(bContext *C, wmOperator *op)

View File

@ -2315,7 +2315,7 @@ static int text_jump_exec(bContext *C, wmOperator *op)
static int text_jump_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
return WM_operator_props_dialog_popup(C, op, 200, 100);
return WM_operator_props_dialog_popup(C, op, 200);
}
void TEXT_OT_jump(wmOperatorType *ot)

View File

@ -634,7 +634,6 @@ static void rna_generic_op_invoke(FunctionRNA *func, int flag)
if (flag & WM_GEN_INVOKE_SIZE) {
RNA_def_int(func, "width", 300, 0, INT_MAX, "", "Width of the popup", 0, INT_MAX);
RNA_def_int(func, "height", 20, 0, INT_MAX, "", "Height of the popup", 0, INT_MAX);
}
if (flag & WM_GEN_INVOKE_RETURN) {

View File

@ -378,12 +378,9 @@ int WM_operator_props_popup_call(struct bContext *C,
int WM_operator_props_popup(struct bContext *C,
struct wmOperator *op,
const struct wmEvent *event);
int WM_operator_props_dialog_popup(struct bContext *C,
struct wmOperator *op,
int width,
int height);
int WM_operator_props_dialog_popup(struct bContext *C, struct wmOperator *op, int width);
int WM_operator_redo_popup(struct bContext *C, struct wmOperator *op);
int WM_operator_ui_popup(struct bContext *C, struct wmOperator *op, int width, int height);
int WM_operator_ui_popup(struct bContext *C, struct wmOperator *op, int width);
int WM_operator_confirm_message_ex(struct bContext *C,
struct wmOperator *op,

View File

@ -1500,12 +1500,13 @@ static void wm_operator_ui_popup_ok(struct bContext *C, void *arg, int retval)
MEM_freeN(data);
}
int WM_operator_ui_popup(bContext *C, wmOperator *op, int width, int height)
int WM_operator_ui_popup(bContext *C, wmOperator *op, int width)
{
wmOpPopUp *data = MEM_callocN(sizeof(wmOpPopUp), "WM_operator_ui_popup");
data->op = op;
data->width = width * U.dpi_fac;
data->height = height * U.dpi_fac;
/* Actual used height depends on the content. */
data->height = 0;
data->free_op = true; /* if this runs and gets registered we may want not to free it */
UI_popup_block_ex(C, wm_operator_ui_create, NULL, wm_operator_ui_popup_cancel, data, op);
return OPERATOR_RUNNING_MODAL;
@ -1541,7 +1542,7 @@ static int wm_operator_props_popup_ex(bContext *C,
/* if we don't have global undo, we can't do undo push for automatic redo,
* so we require manual OK clicking in this popup */
if (!do_redo || !(U.uiflag & USER_GLOBALUNDO)) {
return WM_operator_props_dialog_popup(C, op, 300, 20);
return WM_operator_props_dialog_popup(C, op, 300);
}
UI_popup_block_ex(C, wm_block_create_redo, NULL, wm_block_redo_cancel_cb, op, op);
@ -1577,13 +1578,14 @@ int WM_operator_props_popup(bContext *C, wmOperator *op, const wmEvent *UNUSED(e
return wm_operator_props_popup_ex(C, op, false, true);
}
int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, int height)
int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width)
{
wmOpPopUp *data = MEM_callocN(sizeof(wmOpPopUp), "WM_operator_props_dialog_popup");
data->op = op;
data->width = width * U.dpi_fac;
data->height = height * U.dpi_fac;
/* Actual height depends on the content. */
data->height = 0;
data->free_op = true; /* if this runs and gets registered we may want not to free it */
/* op is not executed until popup OK but is clicked */
@ -1634,7 +1636,7 @@ static int wm_debug_menu_exec(bContext *C, wmOperator *op)
static int wm_debug_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
RNA_int_set(op->ptr, "debug_value", G.debug_value);
return WM_operator_props_dialog_popup(C, op, 180, 20);
return WM_operator_props_dialog_popup(C, op, 180);
}
static void WM_OT_debug_menu(wmOperatorType *ot)

View File

@ -469,7 +469,7 @@ int wm_stereo3d_set_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(ev
return wm_stereo3d_set_exec(C, op);
}
else {
return WM_operator_props_dialog_popup(C, op, 250, 100);
return WM_operator_props_dialog_popup(C, op, 250);
}
}