Commit: b557ceb2c1544d1b5b584a0bf7bb5028b818fd2c
Author: Julian Eisel
Date:   Sun Oct 16 15:33:00 2016 +0200
Branches: blender2.8
https://developer.blender.org/rBb557ceb2c1544d1b5b584a0bf7bb5028b818fd2c

Merge branch 'master' into blender2.8

Conflicts:
        source/blender/editors/space_outliner/outliner_draw.c
        source/blender/editors/space_outliner/outliner_edit.c
        source/blender/editors/space_outliner/outliner_intern.h
        source/blender/editors/space_outliner/outliner_select.c

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



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

diff --cc source/blender/editors/space_outliner/outliner_draw.c
index 7306afc,33a5a7c..edda90a
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@@ -1408,19 -1412,16 +1406,19 @@@ static void outliner_draw_iconrow(bCont
  }
  
  /* closed tree element */
- static void outliner_set_coord_tree_element(SpaceOops *soops, TreeElement 
*te, int startx, int starty)
+ static void outliner_set_coord_tree_element(TreeElement *te, int startx, int 
starty)
  {
        TreeElement *ten;
 -      
 -      /* store coord and continue, we need coordinates for elements outside 
view too */
 -      te->xs = startx;
 -      te->ys = starty;
 -      
 +
 +      /* closed items may be displayed in row of parent, don't change their 
coordinate! */
 +      if ((te->flag & TE_ICONROW) == 0) {
 +              /* store coord and continue, we need coordinates for elements 
outside view too */
 +              te->xs = startx;
 +              te->ys = starty;
 +      }
 +
        for (ten = te->subtree.first; ten; ten = ten->next) {
-               outliner_set_coord_tree_element(soops, ten, startx + UI_UNIT_X, 
starty);
+               outliner_set_coord_tree_element(ten, startx + UI_UNIT_X, 
starty);
        }
  }
  
@@@ -1911,9 -1887,9 +1909,9 @@@ void draw_outliner(const bContext *C
        if (ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) {
                /* draw rna buttons */
                outliner_draw_rnacols(ar, sizex_rna);
-               outliner_draw_rnabuts(block, scene, ar, soops, sizex_rna, 
&soops->tree);
+               outliner_draw_rnabuts(block, ar, soops, sizex_rna, 
&soops->tree);
        }
 -      else if ((soops->outlinevis == SO_ID_ORPHANS) && !(soops->flag & 
SO_HIDE_RESTRICTCOLS)) {
 +      else if ((soops->outlinevis == SO_ID_ORPHANS) && has_restrict_icons) {
                /* draw user toggle columns */
                outliner_draw_restrictcols(ar);
                outliner_draw_userbuts(block, ar, soops, &soops->tree);
diff --cc source/blender/editors/space_outliner/outliner_edit.c
index 87e6be7,345ac35..4dcdcc6
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@@ -150,95 -148,8 +148,95 @@@ TreeElement *outliner_dropzone_find(con
        return NULL;
  }
  
 +/**
 + * Try to find an item under y-coordinate \a view_co_y (view-space).
 + * \note Recursive
 + */
 +TreeElement *outliner_find_item_at_y(const SpaceOops *soops, const ListBase 
*tree, float view_co_y)
 +{
 +      for (TreeElement *te_iter = tree->first; te_iter; te_iter = 
te_iter->next) {
 +              if (view_co_y < (te_iter->ys + UI_UNIT_Y)) {
 +                      if (view_co_y > te_iter->ys) {
 +                              /* co_y is inside this element */
 +                              return te_iter;
 +                      }
 +                      else if (TSELEM_OPEN(te_iter->store_elem, soops)) {
 +                              /* co_y is lower than current element, possibly 
inside children */
 +                              TreeElement *te_sub = 
outliner_find_item_at_y(soops, &te_iter->subtree, view_co_y);
 +                              if (te_sub) {
 +                                      return te_sub;
 +                              }
 +                      }
 +              }
 +      }
 +
 +      return NULL;
 +}
 +
 +/**
 + * Collapsed items can show their children as click-able icons. This function 
tries to find
 + * such an icon that represents the child item at x-coordinate \a view_co_x 
(view-space).
 + *
 + * \return a hovered child item or \a parent_te (if no hovered child found).
 + */
 +TreeElement *outliner_find_item_at_x_in_row(const SpaceOops *soops, const 
TreeElement *parent_te, float view_co_x)
 +{
 +      if (!TSELEM_OPEN(TREESTORE(parent_te), soops)) { /* if parent_te is 
opened, it doesn't show childs in row */
 +              /* no recursion, items can only display their direct children 
in the row */
 +              for (TreeElement *child_te = parent_te->subtree.first;
 +                   child_te && view_co_x >= child_te->xs; /* don't look 
further if co_x is smaller than child position*/
 +                   child_te = child_te->next)
 +              {
 +                      if ((child_te->flag & TE_ICONROW) && (view_co_x > 
child_te->xs) && (view_co_x < child_te->xend)) {
 +                              return child_te;
 +                      }
 +              }
 +      }
 +
 +      /* return parent if no child is hovered */
 +      return (TreeElement *)parent_te;
 +}
 +
 +
  /* ************************************************************** */
 -/* Click Activated */
 +
 +/* Highlight --------------------------------------------------- */
 +
 +static int outliner_highlight_update(bContext *C, wmOperator *UNUSED(op), 
const wmEvent *event)
 +{
 +      ARegion *ar = CTX_wm_region(C);
 +      SpaceOops *soops = CTX_wm_space_outliner(C);
 +      const float my = UI_view2d_region_to_view_y(&ar->v2d, event->mval[1]);
 +
 +      TreeElement *hovered_te = outliner_find_item_at_y(soops, &soops->tree, 
my);
 +      bool changed = false;
 +
 +      if (!hovered_te || !(hovered_te->store_elem->flag & TSE_HIGHLIGHTED)) {
-               changed = outliner_set_flag(soops, &soops->tree, 
TSE_HIGHLIGHTED, false);
++              changed = outliner_set_flag(&soops->tree, TSE_HIGHLIGHTED, 
false);
 +              if (hovered_te) {
 +                      hovered_te->store_elem->flag |= TSE_HIGHLIGHTED;
 +                      changed = true;
 +              }
 +      }
 +
 +      if (changed) {
 +              soops->storeflag |= SO_TREESTORE_REDRAW; /* only needs to 
redraw, no rebuild */
 +              ED_region_tag_redraw(ar);
 +      }
 +
 +      return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH);
 +}
 +
 +void OUTLINER_OT_highlight_update(wmOperatorType *ot)
 +{
 +      ot->name = "Update Highlight";
 +      ot->idname = "OUTLINER_OT_highlight_update";
 +      ot->description = "Update the item highlight based on the current mouse 
position";
 +
 +      ot->invoke = outliner_highlight_update;
 +
 +      ot->poll = ED_operator_outliner_active;
 +}
  
  /* Toggle Open/Closed ------------------------------------------- */
  
@@@ -829,34 -740,17 +827,34 @@@ int outliner_has_one_flag(ListBase *lb
        return 0;
  }
  
 -void outliner_set_flag(ListBase *lb, short flag, short set)
 +/**
 + * Set or unset \a flag for all outliner elements in \a lb and sub-trees.
 + * \return if any flag was modified.
 + */
- bool outliner_set_flag(SpaceOops *soops, ListBase *lb, short flag, short set)
++bool outliner_set_flag(ListBase *lb, short flag, short set)
  {
        TreeElement *te;
        TreeStoreElem *tselem;
 -      
 +      bool changed = false;
 +      bool has_flag;
 +
        for (te = lb->first; te; te = te->next) {
                tselem = TREESTORE(te);
 -              if (set == 0) tselem->flag &= ~flag;
 -              else tselem->flag |= flag;
 -              outliner_set_flag(&te->subtree, flag, set);
 +              has_flag = (tselem->flag & flag);
 +              if (set == 0) {
 +                      if (has_flag) {
 +                              tselem->flag &= ~flag;
 +                              changed = true;
 +                      }
 +              }
 +              else if (!has_flag){
 +                      tselem->flag |= flag;
 +                      changed = true;
 +              }
-               changed |= outliner_set_flag(soops, &te->subtree, flag, set);
++              changed |= outliner_set_flag(&te->subtree, flag, set);
        }
 +
 +      return changed;
  }
  
  /* Restriction Columns ------------------------------- */
diff --cc source/blender/editors/space_outliner/outliner_intern.h
index db61463,ccc52f2..c5dfbf1
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@@ -170,8 -166,8 +170,8 @@@ void outliner_do_object_operation
  
  int common_restrict_check(struct bContext *C, struct Object *ob);
  
- int outliner_has_one_flag(struct SpaceOops *soops, ListBase *lb, short flag, 
const int curlevel);
- bool outliner_set_flag(struct SpaceOops *soops, ListBase *lb, short flag, 
short set);
+ int outliner_has_one_flag(ListBase *lb, short flag, const int curlevel);
 -void outliner_set_flag(ListBase *lb, short flag, short set);
++bool outliner_set_flag(ListBase *lb, short flag, short set);
  
  void object_toggle_visibility_cb(
          struct bContext *C, struct ReportList *reports, struct Scene *scene,
diff --cc source/blender/editors/space_outliner/outliner_select.c
index 635c792,89df471..101ad23
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@@ -821,115 -886,110 +821,115 @@@ eOLDrawState tree_element_type_active
  
  /* ================================================ */
  
 -static bool do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, 
SpaceOops *soops,
 -                                      TreeElement *te, bool extend, bool 
recursive, const float mval[2])
 +static void outliner_item_activate(
 +        bContext *C, SpaceOops *soops, TreeElement *te,
 +        const bool extend, const bool recursive)
  {
 -      
 -      if (mval[1] > te->ys && mval[1] < te->ys + UI_UNIT_Y) {
 -              TreeStoreElem *tselem = TREESTORE(te);
 -              bool openclose = false;
 -              
 -              /* open close icon */
 -              if ((te->flag & TE_ICONROW) == 0) {               // hidden 
icon, no open/close
 -                      if (mval[0] > te->xs && mval[0] < te->xs + UI_UNIT_X)
 -                              openclose = true;
 -              }
 -              
 -              if (openclose) {
 -                      /* all below close/open? */
 -                      if (extend) {
 -                              tselem->flag &= ~TSE_CLOSED;
 -                              outliner_set_flag(&te->subtree, TSE_CLOSED, 
!outliner_has_one_flag(&te->subtree, TSE_CLOSED, 1));
 -                      }
 -                      else {
 -                              if (tselem->flag & TSE_CLOSED) tselem->flag &= 
~TSE_CLOSED;
 -                              else tselem->flag |= TSE_CLOSED;
 -                              
 +      Scene *scene = CTX_data_scene(C);
 +      TreeStoreElem *tselem = TREESTORE(te);
 +
 +      /* always makes active object, except for some specific types.
 +       * Note about TSE_EBONE: In case of a same ID_AR datablock shared among 
several objects, we do not want
 +       * to switch out of edit mode (see T48328 for details). */
 +      if (!ELEM(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP, 
TSE_EBONE)) {
 +              tree_element_set_active_object(C, scene, soops, te,
 +                                             (extend && tselem->type == 0) ? 
OL_SETSEL_EXTEND : OL_SETSEL_NORMAL,
 +                                             recursive && tselem->type == 0);
 +      }
 +
 +      if (tselem->type == 0) { // the lib blocks
 +              /* editmode? */
 +              if (te->idcode == ID_SCE) {
 +                      if (scene != (Scene *)tselem->id) {
 +                              ED_screen_set_scene(C, CTX_wm_screen(C), (Scene 
*)tselem->id);
                        }
 -                      
 -                      return true;
                }
 -              /* name and first icon */
 -              else if (mval[0] > te->xs + UI_UNIT_X && mval[0] < te->xend) {
 -                      
 -                      /* always makes active object, except for some specific 
types.
 -                       * Note about TSE_EBONE: In case of a same ID_AR 
datablock shared among several objects, we do not want
 -                       * to switch out of edit mode (see T48328 for details). 
*/
 -                      if (!ELEM(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, 
TSE_SEQUENCE_DUP, TSE_EBONE)) {
 -                              tree_element_set_active_object(C, scene, soops, 
te,
 -                                                             (extend

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to