[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60626] trunk/blender/source/blender: re-enable activating the text input field for new popup dialog boxes,
Campbell Barton
ideasman42 at gmail.com
Wed Oct 9 16:35:26 CEST 2013
Revision: 60626
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60626
Author: campbellbarton
Date: 2013-10-09 14:35:25 +0000 (Wed, 09 Oct 2013)
Log Message:
-----------
re-enable activating the text input field for new popup dialog boxes,
I'd disabled this for 2.68 since it caused bug [#36109].
This fix now only enabled text activation for popups. (so the toolbar textboxes are skipped)
Modified Paths:
--------------
trunk/blender/source/blender/editors/animation/anim_markers.c
trunk/blender/source/blender/editors/armature/pose_lib.c
trunk/blender/source/blender/editors/interface/interface_layout.c
trunk/blender/source/blender/windowmanager/WM_api.h
trunk/blender/source/blender/windowmanager/intern/wm_operators.c
Modified: trunk/blender/source/blender/editors/animation/anim_markers.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_markers.c 2013-10-09 08:46:02 UTC (rev 60625)
+++ trunk/blender/source/blender/editors/animation/anim_markers.c 2013-10-09 14:35:25 UTC (rev 60626)
@@ -1380,7 +1380,7 @@
RNA_string_set(op->ptr, "name", marker->name);
/* now see if the operator is usable */
- return ed_markers_opwrap_invoke_custom(C, op, event, WM_operator_props_popup);
+ return ed_markers_opwrap_invoke_custom(C, op, event, WM_operator_props_popup_confirm);
}
static void MARKER_OT_rename(wmOperatorType *ot)
Modified: trunk/blender/source/blender/editors/armature/pose_lib.c
===================================================================
--- trunk/blender/source/blender/editors/armature/pose_lib.c 2013-10-09 08:46:02 UTC (rev 60625)
+++ trunk/blender/source/blender/editors/armature/pose_lib.c 2013-10-09 14:35:25 UTC (rev 60626)
@@ -638,7 +638,7 @@
}
/* part to sync with other similar operators... */
- return WM_operator_props_popup(C, op, event);
+ return WM_operator_props_popup_confirm(C, op, event);
}
static int poselib_rename_exec(bContext *C, wmOperator *op)
Modified: trunk/blender/source/blender/editors/interface/interface_layout.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_layout.c 2013-10-09 08:46:02 UTC (rev 60625)
+++ trunk/blender/source/blender/editors/interface/interface_layout.c 2013-10-09 14:35:25 UTC (rev 60626)
@@ -3091,20 +3091,25 @@
/* set various special settings for buttons */
{
+ uiBlock *block = uiLayoutGetBlock(layout);
+ const bool is_popup = (block->flag & UI_BLOCK_KEEP_OPEN) != 0;
uiBut *but;
+
- for (but = uiLayoutGetBlock(layout)->buttons.first; but; but = but->next) {
+ for (but = block->buttons.first; but; but = but->next) {
/* no undo for buttons for operator redo panels */
uiButClearFlag(but, UI_BUT_UNDO);
-#if 0 /* broken, causes freedback loop, see [#36109] */
+ /* only for popups, see [#36109] */
+
/* if button is operator's default property, and a text-field, enable focus for it
* - this is used for allowing operators with popups to rename stuff with fewer clicks
*/
- if ((but->rnaprop == op->type->prop) && (but->type == TEX)) {
- uiButSetFocusOnEnter(CTX_wm_window(C), but);
+ if (is_popup) {
+ if ((but->rnaprop == op->type->prop) && (but->type == TEX)) {
+ uiButSetFocusOnEnter(CTX_wm_window(C), but);
+ }
}
-#endif
}
}
}
Modified: trunk/blender/source/blender/windowmanager/WM_api.h
===================================================================
--- trunk/blender/source/blender/windowmanager/WM_api.h 2013-10-09 08:46:02 UTC (rev 60625)
+++ trunk/blender/source/blender/windowmanager/WM_api.h 2013-10-09 14:35:25 UTC (rev 60626)
@@ -198,6 +198,7 @@
/* poll callback, context checks */
int WM_operator_winactive (struct bContext *C);
/* invoke callback, exec + redo popup */
+int WM_operator_props_popup_confirm(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
int WM_operator_props_popup_call(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
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);
Modified: trunk/blender/source/blender/windowmanager/intern/wm_operators.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_operators.c 2013-10-09 08:46:02 UTC (rev 60625)
+++ trunk/blender/source/blender/windowmanager/intern/wm_operators.c 2013-10-09 14:35:25 UTC (rev 60626)
@@ -1433,7 +1433,8 @@
* For use by #WM_operator_props_popup_call, #WM_operator_props_popup only.
*
* \note operator menu needs undo flag enabled , for redo callback */
-static int wm_operator_props_popup_ex(bContext *C, wmOperator *op, const int do_call)
+static int wm_operator_props_popup_ex(bContext *C, wmOperator *op,
+ const bool do_call, const bool do_redo)
{
if ((op->type->flag & OPTYPE_REGISTER) == 0) {
BKE_reportf(op->reports, RPT_ERROR,
@@ -1443,7 +1444,7 @@
/* 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 (!(U.uiflag & USER_GLOBALUNDO))
+ if (!do_redo || !(U.uiflag & USER_GLOBALUNDO))
return WM_operator_props_dialog_popup(C, op, 15 * UI_UNIT_X, UI_UNIT_Y);
uiPupBlockEx(C, wm_block_create_redo, NULL, wm_block_redo_cancel_cb, op);
@@ -1454,18 +1455,26 @@
return OPERATOR_RUNNING_MODAL;
}
+/* Same as WM_operator_props_popup but don't use operator redo.
+ * just wraps WM_operator_props_dialog_popup.
+ */
+int WM_operator_props_popup_confirm(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
+{
+ return wm_operator_props_popup_ex(C, op, false, false);
+}
+
/* Same as WM_operator_props_popup but call the operator first,
* This way - the button values correspond to the result of the operator.
* Without this, first access to a button will make the result jump,
* see [#32452] */
int WM_operator_props_popup_call(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
- return wm_operator_props_popup_ex(C, op, TRUE);
+ return wm_operator_props_popup_ex(C, op, true, true);
}
int WM_operator_props_popup(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
- return wm_operator_props_popup_ex(C, op, FALSE);
+ return wm_operator_props_popup_ex(C, op, false, true);
}
int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, int height)
More information about the Bf-blender-cvs
mailing list