[Bf-blender-cvs] [77c126dd4c8] blender2.8: Fix T57553: Python operator popup size does not follow UI scale and DPI.

Brecht Van Lommel noreply at git.blender.org
Thu Nov 1 12:33:39 CET 2018


Commit: 77c126dd4c819a4ad92bb7895af4593831cb2daf
Author: Brecht Van Lommel
Date:   Thu Nov 1 12:23:33 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB77c126dd4c819a4ad92bb7895af4593831cb2daf

Fix T57553: Python operator popup size does not follow UI scale and DPI.

Make it the convention to multiply by scaling factor inside the function, so
Python scripts that didn't add DPI scale start working correctly.

===================================================================

M	source/blender/editors/armature/pose_edit.c
M	source/blender/editors/object/object_edit.c
M	source/blender/editors/sculpt_paint/paint_image_proj.c
M	source/blender/editors/space_image/image_ops.c
M	source/blender/editors/space_sequencer/sequencer_edit.c
M	source/blender/editors/space_text/text_ops.c
M	source/blender/windowmanager/intern/wm_operators.c

===================================================================

diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index e60fb37b8b0..b10afa3a6de 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -289,7 +289,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, 10 * UI_UNIT_X, 10 * UI_UNIT_Y);
+	return WM_operator_props_dialog_popup(C, op, 200, 200);
 }
 
 /* For the object with pose/action: create path curves for selected bones
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 89eea4c1b64..a934f298583 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1279,7 +1279,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, 10 * UI_UNIT_X, 10 * UI_UNIT_Y);
+	return WM_operator_props_dialog_popup(C, op, 200, 200);
 }
 
 /* Calculate/recalculate whole paths (avs.path_sf to avs.path_ef) */
@@ -2044,7 +2044,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, 10 * UI_UNIT_X, 5 * UI_UNIT_Y);
+				return WM_operator_props_dialog_popup(C, op, 200, 100);
 			}
 		}
 		return move_to_collection_exec(C, op);
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index fea0819fb27..5f1fb8c5146 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -5881,7 +5881,7 @@ static int texture_paint_add_texture_paint_slot_invoke(bContext *C, wmOperator *
 	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, 15 * UI_UNIT_X, 5 * UI_UNIT_Y);
+	return WM_operator_props_dialog_popup(C, op, 300, 100);
 }
 
 #define IMA_DEF_NAME N_("Untitled")
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index ba984c33e47..b161de9f472 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -2488,7 +2488,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, 15 * UI_UNIT_X, 5 * UI_UNIT_Y);
+	return WM_operator_props_dialog_popup(C, op, 300, 100);
 }
 
 static void image_new_draw(bContext *UNUSED(C), wmOperator *op)
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 38abfe909a6..a1819e9ac3a 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -3525,7 +3525,7 @@ void SEQUENCER_OT_rebuild_proxy(wmOperatorType *ot)
 
 static int sequencer_enable_proxies_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
 {
-	return WM_operator_props_dialog_popup(C, op, 10 * UI_UNIT_X, 5 * UI_UNIT_Y);
+	return WM_operator_props_dialog_popup(C, op, 200, 100);
 }
 
 static int sequencer_enable_proxies_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 28eb4572a1a..8d8d98135e5 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -1949,7 +1949,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, 10 * UI_UNIT_X, 5 * UI_UNIT_Y);
+	return WM_operator_props_dialog_popup(C, op, 200, 100);
 
 }
 
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 3be213796d8..6c9cbbcee57 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1241,7 +1241,7 @@ static int wm_operator_props_popup_ex(bContext *C, wmOperator *op,
 	/* 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, 15 * UI_UNIT_X, UI_UNIT_Y);
+		return WM_operator_props_dialog_popup(C, op, 300, 20);
 
 	UI_popup_block_ex(C, wm_block_create_redo, NULL, wm_block_redo_cancel_cb, op, op);
 
@@ -1280,8 +1280,8 @@ int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, int h
 	wmOpPopUp *data = MEM_callocN(sizeof(wmOpPopUp), "WM_operator_props_dialog_popup");
 
 	data->op = op;
-	data->width = width;
-	data->height = height;
+	data->width = width * U.dpi_fac;
+	data->height = height * U.dpi_fac;
 	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 */
@@ -1322,7 +1322,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, 9 * UI_UNIT_X, UI_UNIT_Y);
+	return WM_operator_props_dialog_popup(C, op, 180, 20);
 }
 
 static void WM_OT_debug_menu(wmOperatorType *ot)



More information about the Bf-blender-cvs mailing list