[Bf-blender-cvs] [0eb4d9445a4] soc-2020-outliner: Merge branch 'master' into soc-2020-outliner

Nathan Craddock noreply at git.blender.org
Sun Jun 21 01:02:07 CEST 2020


Commit: 0eb4d9445a49f45f590fea354313f4da8d64468b
Author: Nathan Craddock
Date:   Sat Jun 20 16:39:09 2020 -0600
Branches: soc-2020-outliner
https://developer.blender.org/rB0eb4d9445a49f45f590fea354313f4da8d64468b

Merge branch 'master' into soc-2020-outliner

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



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

diff --cc source/blender/editors/space_outliner/outliner_select.c
index a9a65989c19,8ec542e80a0..987d69756be
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@@ -1136,206 -1141,8 +1136,200 @@@ eOLDrawState tree_element_type_active(b
    return OL_DRAWSEL_NONE;
  }
  
 +static void outliner_set_properties_tab(bContext *C, TreeElement *te, TreeStoreElem *tselem)
 +{
 +  PointerRNA ptr;
 +
 +  /* ID Types */
 +  if (tselem->type == 0) {
 +    RNA_id_pointer_create(tselem->id, &ptr);
 +
 +    switch (te->idcode) {
 +      case ID_SCE:
 +        ED_buttons_set_context(C, &ptr, BCONTEXT_SCENE);
 +        break;
 +      case ID_OB:
 +        ED_buttons_set_context(C, &ptr, BCONTEXT_OBJECT);
 +        break;
 +      case ID_ME:
 +      case ID_CU:
 +      case ID_MB:
 +      case ID_IM:
 +      case ID_LT:
 +      case ID_LA:
 +      case ID_CA:
 +      case ID_KE:
 +      case ID_SPK:
 +      case ID_AR:
 +      case ID_GD:
 +      case ID_LP:
 +      case ID_HA:
 +      case ID_PT:
 +      case ID_VO:
 +        ED_buttons_set_context(C, &ptr, BCONTEXT_DATA);
 +        break;
 +      case ID_MA:
 +        ED_buttons_set_context(C, &ptr, BCONTEXT_MATERIAL);
 +        break;
 +      case ID_WO:
 +        ED_buttons_set_context(C, &ptr, BCONTEXT_WORLD);
 +        break;
 +    }
 +  }
 +  else {
 +    switch (tselem->type) {
 +      case TSE_DEFGROUP_BASE:
 +      case TSE_DEFGROUP:
 +        RNA_id_pointer_create(tselem->id, &ptr);
 +        ED_buttons_set_context(C, &ptr, BCONTEXT_DATA);
 +        break;
 +      case TSE_CONSTRAINT_BASE:
 +      case TSE_CONSTRAINT: {
 +        RNA_id_pointer_create(tselem->id, &ptr);
 +        bool is_bone_constraint = false;
 +
 +        /* Check if parent is a bone */
 +        te = te->parent;
 +        while (te) {
 +          tselem = TREESTORE(te);
 +          if (tselem->type == TSE_POSE_CHANNEL) {
 +            bPoseChannel *pchan = (bPoseChannel *)te->directdata;
 +            RNA_pointer_create(tselem->id, &RNA_PoseBone, pchan, &ptr);
 +
 +            is_bone_constraint = true;
 +            break;
 +          }
 +          te = te->parent;
 +        }
 +        if (is_bone_constraint) {
 +          ED_buttons_set_context(C, &ptr, BCONTEXT_BONE_CONSTRAINT);
 +        }
 +        else {
 +          ED_buttons_set_context(C, &ptr, BCONTEXT_CONSTRAINT);
 +        }
 +        break;
 +      }
 +      case TSE_MODIFIER_BASE:
 +      case TSE_MODIFIER:
 +        RNA_id_pointer_create(tselem->id, &ptr);
 +        ED_buttons_set_context(C, &ptr, BCONTEXT_MODIFIER);
 +        break;
 +      case TSE_BONE: {
 +        bArmature *arm = (bArmature *)tselem->id;
 +        Bone *bone = te->directdata;
 +
 +        RNA_pointer_create(&arm->id, &RNA_Bone, bone, &ptr);
 +        ED_buttons_set_context(C, &ptr, BCONTEXT_BONE);
 +        break;
 +      }
 +      case TSE_EBONE: {
 +        bArmature *arm = (bArmature *)tselem->id;
 +        EditBone *ebone = te->directdata;
 +
 +        RNA_pointer_create(&arm->id, &RNA_EditBone, ebone, &ptr);
 +        ED_buttons_set_context(C, &ptr, BCONTEXT_BONE);
 +        break;
 +      }
 +      case TSE_POSE_CHANNEL: {
 +        Object *ob = (Object *)tselem->id;
 +        bArmature *arm = ob->data;
 +        bPoseChannel *pchan = te->directdata;
 +
 +        RNA_pointer_create(&arm->id, &RNA_PoseBone, pchan, &ptr);
 +        ED_buttons_set_context(C, &ptr, BCONTEXT_BONE);
 +        break;
 +      }
 +      case TSE_POSE_BASE: {
 +        Object *ob = (Object *)tselem->id;
 +        bArmature *arm = ob->data;
 +
 +        RNA_pointer_create(&arm->id, &RNA_Armature, arm, &ptr);
 +        ED_buttons_set_context(C, &ptr, BCONTEXT_DATA);
 +        break;
 +      }
 +      case TSE_R_LAYER_BASE:
 +      case TSE_R_LAYER: {
 +        ViewLayer *view_layer = te->directdata;
 +
 +        RNA_pointer_create(tselem->id, &RNA_ViewLayer, view_layer, &ptr);
 +        ED_buttons_set_context(C, &ptr, BCONTEXT_VIEW_LAYER);
 +        break;
 +      }
 +      case TSE_POSEGRP_BASE:
 +      case TSE_POSEGRP: {
 +        Object *ob = (Object *)tselem->id;
 +        bArmature *arm = ob->data;
 +
 +        RNA_pointer_create(&arm->id, &RNA_Armature, arm, &ptr);
 +        ED_buttons_set_context(C, &ptr, BCONTEXT_DATA);
 +        break;
 +      }
 +      case TSE_LINKED_PSYS: {
 +        Object *ob = (Object *)tselem->id;
 +        ParticleSystem *psys = psys_get_current(ob);
 +
 +        RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys, &ptr);
 +        ED_buttons_set_context(C, &ptr, BCONTEXT_PARTICLE);
 +        break;
 +      }
 +      case TSE_GP_LAYER:
 +        RNA_id_pointer_create(tselem->id, &ptr);
 +        ED_buttons_set_context(C, &ptr, BCONTEXT_DATA);
 +        break;
 +    }
 +  }
 +}
 +
 +/* TODO (Nathan): Temporary while testing */
 +static void outliner_set_active_camera(bContext *C, Scene *scene, TreeStoreElem *tselem)
 +{
 +  Object *ob = (Object *)tselem->id;
 +
 +  scene->camera = ob;
 +  Main *bmain = CTX_data_main(C);
 +  wmWindowManager *wm = bmain->wm.first;
 +
 +  WM_windows_scene_data_sync(&wm->windows, scene);
 +  DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
 +  DEG_relations_tag_update(bmain);
 +  WM_event_add_notifier(C, NC_SCENE | NA_EDITED, NULL);
 +}
 +
 +void outliner_set_active_data(bContext *C,
 +                              TreeViewContext *tvc,
 +                              TreeElement *te,
 +                              TreeStoreElem *tselem)
 +{
 +  if (tselem->type == 0 && te->idcode == ID_OB) {
 +    Object *ob = (Object *)tselem->id;
 +    if (ob->type == OB_CAMERA) {
 +      outliner_set_active_camera(C, tvc->scene, tselem);
 +    }
 +  }
 +  else if (tselem->type == 0 && te->idcode == ID_SCE) {
 +    Scene *scene = (Scene *)tselem->id;
 +    if (scene != tvc->scene) {
 +      WM_window_set_active_scene(CTX_data_main(C), C, CTX_wm_window(C), scene);
 +    }
 +  }
 +  else if (tselem->type == TSE_VIEW_COLLECTION_BASE) {
 +    ViewLayer *view_layer = CTX_data_view_layer(C);
 +    LayerCollection *layer_collection = view_layer->layer_collections.first;
 +    BKE_layer_collection_activate(view_layer, layer_collection);
 +    WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
 +  }
 +  else if (tselem->type == TSE_LAYER_COLLECTION) {
 +    Scene *scene = CTX_data_scene(C);
 +    LayerCollection *layer_collection = te->directdata;
 +    ViewLayer *view_layer = BKE_view_layer_find_from_collection(scene, layer_collection);
 +    BKE_layer_collection_activate(view_layer, layer_collection);
 +    WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
 +  }
 +}
 +
  /* ================================================ */
  
- /* Set the walk navigation start element */
- void outliner_set_walk_element(SpaceOutliner *soops, TreeStoreElem *tselem)
- {
-   outliner_flag_set(&soops->tree, TSE_ACTIVE_WALK, false);
-   tselem->flag |= TSE_ACTIVE_WALK;
- }
 +
  /**
   * Action when clicking to activate an item (typically under the mouse cursor),
   * but don't do any cursor intersection checks.
@@@ -1813,59 -1629,25 +1805,59 @@@ static TreeElement *outliner_element_fi
  }
  
  /* Find next visible element in the tree */
- static TreeElement *outliner_find_next_element(SpaceOutliner *soops, TreeElement *walk_element)
+ static TreeElement *outliner_find_next_element(SpaceOutliner *soops, TreeElement *te)
  {
-   TreeStoreElem *tselem = TREESTORE(walk_element);
+   TreeStoreElem *tselem = TREESTORE(te);
  
-   if (TSELEM_OPEN(tselem, soops) && walk_element->subtree.first) {
-     walk_element = walk_element->subtree.first;
+   if (TSELEM_OPEN(tselem, soops) && te->subtree.first) {
+     te = te->subtree.first;
    }
-   else if (walk_element->next) {
-     walk_element = walk_element->next;
+   else if (te->next) {
+     te = te->next;
    }
    else {
-     walk_element = outliner_element_find_successor_in_parents(walk_element);
+     te = outliner_element_find_successor_in_parents(te);
    }
  
-   return walk_element;
+   return te;
  }
  
 +static TreeElement *outliner_walk_left(SpaceOutliner *soops,
-                                        TreeElement *walk_element,
++                                       TreeElement *te,
 +                                       bool toggle_all)
 +{
-   TreeStoreElem *tselem = TREESTORE(walk_element);
++  TreeStoreElem *tselem = TREESTORE(te);
 +
 +  if (TSELEM_OPEN(tselem, soops)) {
-     outliner_item_openclose(walk_element, false, toggle_all);
++    outliner_item_openclose(te, false, toggle_all);
 +  }
 +  /* Only walk up a level if the element is closed and not toggling expand */
-   else if (!toggle_all && walk_element->parent) {
-     walk_element = walk_element->parent;
++  else if (!toggle_all && te->parent) {
++    te = te->parent;
 +  }
 +
-   return walk_element;
++  return te;
 +}
 +
 +static TreeElement *outliner_walk_right(SpaceOutliner *soops,
-                                         TreeElement *walk_element,
++                                        TreeElement *te,
 +                                        bool toggle_all)
 +{
-   TreeStoreElem *tselem = TREESTORE(walk_element);
++  TreeStoreElem *tselem = TREESTORE(te);
 +
 +  /* Only walk down a level if the element is open and not toggling expand */
-   if (!toggle_all && TSELEM_OPEN(tselem, soops) && walk_element->subtree.first) {
-     walk_element = walk_element->subtree.first;
++  if (!toggle_all && TSELEM_OPEN(tselem, soops) && te->subtree.first) {
++    te = te->subtree.first;
 +  }
 +  else {
-     outliner_item_openclose(walk_element, true, toggle_all);
++    outliner_item_openclose(te, true, toggle_all);
 +  }
 +
-   return walk_element;
++  return te;
 +}
 +
  static TreeElement *do_outliner_select_walk(SpaceOutliner *soops,
-                                             TreeElement *walk_element,
+                                             TreeElement *te,
                                              const int direction,
                                              const bool extend,
                                              const bool toggle_all)
@@@ -1879,16 -1656,16 +1866,16 @@@
  
    switch (direction) {
      case UI_SELECT_WALK_UP:
-       walk_element = outliner_fin

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list