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:
authorJulian Eisel <eiseljulian@gmail.com>2017-03-10 17:03:06 +0300
committerJulian Eisel <eiseljulian@gmail.com>2017-03-10 17:24:53 +0300
commit8e303aae255be2ef45d5818af046de7c22312aa4 (patch)
tree115b700e7b797645a6796dabcc2eae4ac51ed66f /source/blender/editors/space_outliner/outliner_draw.c
parentb3bb4a6936313a1358428ab95b0df96c93c9cd34 (diff)
Support drag & drop of collections across multiple hierarchy levels
Two issues are remaining, they'll be fixed separately: * Graphical feedback when dragging within the master collection is wrong * There's some bug where collections swap places instead, Dalai will investigate
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_draw.c')
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c37
1 files changed, 8 insertions, 29 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 0ba60b21aa7..0b119b5d247 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1520,34 +1520,14 @@ static void outliner_draw_tree_element(
}
}
-/**
- * Count how many visible childs (and open grandchilds, great-grandchilds, ...) \a te has.
- */
-static int outliner_count_visible_childs(const SpaceOops *soops, const TreeElement *te)
-{
- TreeStoreElem *tselem = TREESTORE(te);
- int current_count = 0;
-
- if (TSELEM_OPEN(tselem, soops)) {
- for (TreeElement *te_child = te->subtree.first; te_child; te_child = te_child->next) {
- current_count += outliner_count_visible_childs(soops, te_child);
- current_count++;
- }
- }
-
- return current_count;
-}
-
-static void outliner_draw_tree_element_floating(const SpaceOops *soops, const ARegion *ar,
- const TreeElement *te_floating)
+static void outliner_draw_tree_element_floating(
+ const ARegion *ar, const TreeElement *te_floating)
{
const TreeElement *te_insert = te_floating->drag_data->insert_handle;
- const ListBase *lb_parent = te_floating->parent ? &te_floating->parent->subtree : &soops->tree;
- const TreeElement *te_insert_fallback = te_insert ? te_insert : lb_parent->first;
const int line_width = 2;
unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT);
- int coord_y = (te_insert ? te_insert->ys : (te_insert_fallback->ys + UI_UNIT_Y)) - (int)(line_width * 0.5f);
+ int coord_y = te_insert->ys;
unsigned char col[4];
if (te_insert == te_floating) {
@@ -1555,15 +1535,14 @@ static void outliner_draw_tree_element_floating(const SpaceOops *soops, const AR
return;
}
- if (te_insert) {
- coord_y -= UI_UNIT_Y * outliner_count_visible_childs(soops, te_insert);
- }
-
UI_GetThemeColorShade4ubv(TH_BACK, -40, col);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
glEnable(GL_BLEND);
- if (!te_insert || (te_floating->drag_data->insert_type == TE_INSERT_AFTER)) {
+ if (ELEM(te_floating->drag_data->insert_type, TE_INSERT_BEFORE, TE_INSERT_AFTER)) {
+ if (te_floating->drag_data->insert_type == TE_INSERT_BEFORE) {
+ coord_y += UI_UNIT_Y;
+ }
immUniformColor4ubv(col);
glLineWidth(line_width);
@@ -1793,7 +1772,7 @@ static void outliner_draw_tree(
startx, &starty, te_edit, &te_floating);
}
if (te_floating) {
- outliner_draw_tree_element_floating(soops, ar, te_floating);
+ outliner_draw_tree_element_floating(ar, te_floating);
}
if (has_restrict_icons) {