Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-02-08 02:34:01 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-02-08 02:42:26 +0400
commit127330d6cadd107d645acd8d97d2f15a75798bf1 (patch)
tree31cfaef14fb33d7a8e8abc8a09cc9dd5464f410a /source/blender/editors/interface/interface.c
parentff0ceb9926d23d1af37c2a09fa90abf28b482556 (diff)
UI: multi-drag number button editing
clicking and dragging down edits multiple number buttons at once. (patch D270)
Diffstat (limited to 'source/blender/editors/interface/interface.c')
-rw-r--r--source/blender/editors/interface/interface.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 8ad96b4f325..fb0b0351453 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -584,7 +584,7 @@ static void ui_but_update_linklines(uiBlock *block, uiBut *oldbut, uiBut *newbut
static bool ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut **but_p, uiBut **but_old_p)
{
/* flags from the buttons we want to refresh, may want to add more here... */
- const int flag_copy = UI_BUT_REDALERT;
+ const int flag_copy = UI_BUT_REDALERT | UI_BUT_DRAG_MULTI;
const int drawflag_copy = 0; /* None currently. */
uiBlock *oldblock = block->oldblock;
@@ -676,6 +676,8 @@ static bool ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBu
/* note: if layout hasn't been applied yet, it uses old button pointers... */
}
else {
+ but->flag = (but->flag & ~flag_copy) | (oldbut->flag & flag_copy);
+
/* ensures one button can get activated, and in case the buttons
* draw are the same this gives O(1) lookup for each button */
BLI_remlink(&oldblock->buttons, oldbut);
@@ -1577,6 +1579,32 @@ bool ui_is_but_unit(const uiBut *but)
return true;
}
+/**
+ * Check if this button is similar enough to be grouped with another.
+ */
+bool ui_is_but_compatible(const uiBut *but_a, const uiBut *but_b)
+{
+ if (but_a->type != but_b->type)
+ return false;
+ if (but_a->pointype != but_b->pointype)
+ return false;
+
+ if (but_a->rnaprop) {
+ if (but_a->rnapoin.type != but_b->rnapoin.type)
+ return false;
+ if (but_a->rnapoin.data != but_b->rnapoin.data)
+ return false;
+ if (but_a->rnapoin.id.data != but_b->rnapoin.id.data)
+ return false;
+ if (RNA_property_type(but_a->rnaprop) != RNA_property_type(but_b->rnaprop))
+ return false;
+ if (RNA_property_subtype(but_a->rnaprop) != RNA_property_subtype(but_b->rnaprop))
+ return false;
+ }
+
+ return true;
+}
+
bool ui_is_but_rna_valid(uiBut *but)
{
if (but->rnaprop == NULL || RNA_struct_contains_property(&but->rnapoin, but->rnaprop)) {