[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56748] trunk/blender/source/blender/ editors: change to drag-lock behavior, only use with outliner ( this way layers can be changed all at once)
Campbell Barton
ideasman42 at gmail.com
Mon May 13 08:51:14 CEST 2013
Revision: 56748
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56748
Author: campbellbarton
Date: 2013-05-13 06:51:13 +0000 (Mon, 13 May 2013)
Log Message:
-----------
change to drag-lock behavior, only use with outliner (this way layers can be changed all at once)
Modified Paths:
--------------
trunk/blender/source/blender/editors/include/UI_interface.h
trunk/blender/source/blender/editors/interface/interface_handlers.c
trunk/blender/source/blender/editors/space_outliner/outliner_draw.c
Modified: trunk/blender/source/blender/editors/include/UI_interface.h
===================================================================
--- trunk/blender/source/blender/editors/include/UI_interface.h 2013-05-13 06:23:50 UTC (rev 56747)
+++ trunk/blender/source/blender/editors/include/UI_interface.h 2013-05-13 06:51:13 UTC (rev 56748)
@@ -149,7 +149,7 @@
#define UI_TEXT_RIGHT 1024
#define UI_BUT_NODE_LINK 2048
#define UI_BUT_NODE_ACTIVE 4096
-#define UI_FLAG_UNUSED 8192
+#define UI_BUT_DRAG_LOCK 8192
/* button align flag, for drawing groups together */
#define UI_BUT_ALIGN (UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_RIGHT | UI_BUT_ALIGN_DOWN)
Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_handlers.c 2013-05-13 06:23:50 UTC (rev 56747)
+++ trunk/blender/source/blender/editors/interface/interface_handlers.c 2013-05-13 06:51:13 UTC (rev 56748)
@@ -756,6 +756,7 @@
typedef struct uiDragToggleHandle {
/* init */
+ bool is_init;
bool is_set;
float but_cent_start[2];
eButType but_type_start;
@@ -820,24 +821,31 @@
* Check if we need to initialize the lock axis by finding if the first
* button we mouse over is X or Y aligned, then lock the mouse to that axis after.
*/
- if (drag_info->xy_lock[0] == false && drag_info->xy_lock[1] == false) {
+ if (drag_info->is_init == false) {
/* first store the buttons original coords */
uiBut *but = ui_but_find_mouse_over(ar, xy_input[0], xy_input[1]);
+
if (but) {
- const float but_cent_new[2] = {BLI_rctf_cent_x(&but->rect),
- BLI_rctf_cent_y(&but->rect)};
+ if (but->flag & UI_BUT_DRAG_LOCK) {
+ const float but_cent_new[2] = {BLI_rctf_cent_x(&but->rect),
+ BLI_rctf_cent_y(&but->rect)};
- /* check if this is a different button, chances are high the button wont move about :) */
- if (len_manhattan_v2v2(drag_info->but_cent_start, but_cent_new) > 1.0f) {
- if (fabsf(drag_info->but_cent_start[0] - but_cent_new[0]) <
- fabsf(drag_info->but_cent_start[1] - but_cent_new[1]))
- {
- drag_info->xy_lock[0] = true;
+ /* check if this is a different button, chances are high the button wont move about :) */
+ if (len_manhattan_v2v2(drag_info->but_cent_start, but_cent_new) > 1.0f) {
+ if (fabsf(drag_info->but_cent_start[0] - but_cent_new[0]) <
+ fabsf(drag_info->but_cent_start[1] - but_cent_new[1]))
+ {
+ drag_info->xy_lock[0] = true;
+ }
+ else {
+ drag_info->xy_lock[1] = true;
+ }
+ drag_info->is_init = true;
}
- else {
- drag_info->xy_lock[1] = true;
- }
}
+ else {
+ drag_info->is_init = true;
+ }
}
}
/* done with axis locking */
Modified: trunk/blender/source/blender/editors/space_outliner/outliner_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner_draw.c 2013-05-13 06:23:50 UTC (rev 56747)
+++ trunk/blender/source/blender/editors/space_outliner/outliner_draw.c 2013-05-13 06:51:13 UTC (rev 56748)
@@ -543,18 +543,21 @@
&ptr, "hide", -1, 0, 0, -1, -1,
TIP_("Restrict viewport visibility (Ctrl - Recursive)"));
uiButSetFunc(bt, restrictbutton_view_cb, scene, ob);
+ uiButSetFlag(bt, UI_BUT_DRAG_LOCK);
bt = uiDefIconButR(block, ICONTOG, 0, ICON_RESTRICT_SELECT_OFF,
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), (int)te->ys, UI_UNIT_X, UI_UNIT_Y,
&ptr, "hide_select", -1, 0, 0, -1, -1,
TIP_("Restrict viewport selection (Ctrl - Recursive)"));
uiButSetFunc(bt, restrictbutton_sel_cb, scene, ob);
+ uiButSetFlag(bt, UI_BUT_DRAG_LOCK);
bt = uiDefIconButR(block, ICONTOG, 0, ICON_RESTRICT_RENDER_OFF,
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), (int)te->ys, UI_UNIT_X, UI_UNIT_Y,
&ptr, "hide_render", -1, 0, 0, -1, -1,
TIP_("Restrict rendering (Ctrl - Recursive)"));
uiButSetFunc(bt, restrictbutton_rend_cb, scene, ob);
+ uiButSetFlag(bt, UI_BUT_DRAG_LOCK);
uiBlockSetEmboss(block, UI_EMBOSS);
@@ -570,18 +573,21 @@
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)te->ys, UI_UNIT_X, UI_UNIT_Y,
NULL, 0, 0, 0, 0, TIP_("Restrict/Allow visibility in the 3D View"));
uiButSetFunc(bt, restrictbutton_gr_restrict_view, scene, gr);
+ uiButSetFlag(bt, UI_BUT_DRAG_LOCK);
restrict_bool = group_restrict_flag(gr, OB_RESTRICT_SELECT);
bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_SELECT_ON : ICON_RESTRICT_SELECT_OFF,
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), (int)te->ys, UI_UNIT_X, UI_UNIT_Y,
NULL, 0, 0, 0, 0, TIP_("Restrict/Allow selection in the 3D View"));
uiButSetFunc(bt, restrictbutton_gr_restrict_select, scene, gr);
+ uiButSetFlag(bt, UI_BUT_DRAG_LOCK);
restrict_bool = group_restrict_flag(gr, OB_RESTRICT_RENDER);
bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_RENDER_ON : ICON_RESTRICT_RENDER_OFF,
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), (int)te->ys, UI_UNIT_X, UI_UNIT_Y,
NULL, 0, 0, 0, 0, TIP_("Restrict/Allow renderability"));
uiButSetFunc(bt, restrictbutton_gr_restrict_render, scene, gr);
+ uiButSetFlag(bt, UI_BUT_DRAG_LOCK);
uiBlockSetEmboss(block, UI_EMBOSS);
}
@@ -593,6 +599,7 @@
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)te->ys, UI_UNIT_X,
UI_UNIT_Y, te->directdata, 0, 0, 0, 0, TIP_("Render this RenderLayer"));
uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
+ uiButSetFlag(bt, UI_BUT_DRAG_LOCK);
uiBlockSetEmboss(block, UI_EMBOSS);
}
@@ -607,6 +614,7 @@
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)te->ys, UI_UNIT_X,
UI_UNIT_Y, layflag, 0, 0, 0, 0, TIP_("Render this Pass"));
uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
+ uiButSetFlag(bt, UI_BUT_DRAG_LOCK);
layflag++; /* is lay_xor */
if (ELEM8(passflag, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT,
@@ -615,8 +623,9 @@
bt = uiDefIconButBitI(block, TOG, passflag, 0, (*layflag & passflag) ? ICON_DOT : ICON_BLANK1,
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), (int)te->ys, UI_UNIT_X,
UI_UNIT_Y, layflag, 0, 0, 0, 0, TIP_("Exclude this Pass from Combined"));
+ uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
+ uiButSetFlag(bt, UI_BUT_DRAG_LOCK);
}
- uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
uiBlockSetEmboss(block, UI_EMBOSS);
}
@@ -630,11 +639,13 @@
UI_UNIT_Y, &(md->mode), 0, 0, 0, 0,
TIP_("Restrict/Allow visibility in the 3D View"));
uiButSetFunc(bt, restrictbutton_modifier_cb, scene, ob);
+ uiButSetFlag(bt, UI_BUT_DRAG_LOCK);
bt = uiDefIconButBitI(block, ICONTOGN, eModifierMode_Render, 0, ICON_RESTRICT_RENDER_OFF,
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), (int)te->ys, UI_UNIT_X,
UI_UNIT_Y, &(md->mode), 0, 0, 0, 0, TIP_("Restrict/Allow renderability"));
uiButSetFunc(bt, restrictbutton_modifier_cb, scene, ob);
+ uiButSetFlag(bt, UI_BUT_DRAG_LOCK);
uiBlockSetEmboss(block, UI_EMBOSS);
}
@@ -649,12 +660,14 @@
UI_UNIT_Y, &(bone->flag), 0, 0, 0, 0,
TIP_("Restrict/Allow visibility in the 3D View"));
uiButSetFunc(bt, restrictbutton_bone_visibility_cb, ob->data, bone);
+ uiButSetFlag(bt, UI_BUT_DRAG_LOCK);
bt = uiDefIconButBitI(block, ICONTOG, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF,
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), (int)te->ys, UI_UNIT_X,
UI_UNIT_Y, &(bone->flag), 0, 0, 0, 0,
TIP_("Restrict/Allow selection in the 3D View"));
uiButSetFunc(bt, restrictbutton_bone_select_cb, ob->data, bone);
+ uiButSetFlag(bt, UI_BUT_DRAG_LOCK);
uiBlockSetEmboss(block, UI_EMBOSS);
}
@@ -667,12 +680,14 @@
UI_UNIT_Y, &(ebone->flag), 0, 0, 0, 0,
TIP_("Restrict/Allow visibility in the 3D View"));
uiButSetFunc(bt, restrictbutton_ebone_visibility_cb, NULL, ebone);
+ uiButSetFlag(bt, UI_BUT_DRAG_LOCK);
bt = uiDefIconButBitI(block, ICONTOG, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF,
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), (int)te->ys, UI_UNIT_X,
UI_UNIT_Y, &(ebone->flag), 0, 0, 0, 0,
TIP_("Restrict/Allow selection in the 3D View"));
uiButSetFunc(bt, restrictbutton_ebone_select_cb, NULL, ebone);
+ uiButSetFlag(bt, UI_BUT_DRAG_LOCK);
uiBlockSetEmboss(block, UI_EMBOSS);
}
More information about the Bf-blender-cvs
mailing list