UI: Outliner - GP Icon Changes
authorHarley Acheson <harley.acheson@gmail.com>
Fri, 14 Jun 2019 16:55:07 +0000 (09:55 -0700)
committerHarley Acheson <harley.acheson@gmail.com>
Fri, 14 Jun 2019 16:55:07 +0000 (09:55 -0700)
Changes all GP layer icons to Pencil and highlights selected layer with background color.

Differential Revision: https://developer.blender.org/D5073

Reviewed by Dalai Felinto

release/scripts/addons
source/blender/editors/space_outliner/outliner_draw.c

index a30fce5..dccf8a4 160000 (submodule)
@@ -1 +1 @@
-Subproject commit a30fce5376c5a70cb64cff58298b8a392512ef2d
+Subproject commit dccf8a462ccf10141149dc35416fc27c93abac3a
index 40632ee..4485475 100644 (file)
@@ -2151,17 +2151,8 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
         data.icon = ICON_GROUP;
         break;
       }
-      /* Removed the icons from outliner.
-       * Need a better structure with Layers, Palettes and Colors. */
       case TSE_GP_LAYER: {
-        /* indicate whether layer is active */
-        bGPDlayer *gpl = te->directdata;
-        if (gpl->flag & GP_LAYER_ACTIVE) {
-          data.icon = ICON_GREASEPENCIL;
-        }
-        else {
-          data.icon = ICON_DOT;
-        }
+        data.icon = ICON_GREASEPENCIL;
         break;
       }
       default:
@@ -2641,12 +2632,16 @@ static void outliner_draw_iconrow(bContext *C,
           active = tree_element_active(C, scene, view_layer, soops, te, OL_SETSEL_NONE, false);
         }
       }
+      else if (tselem->type == TSE_GP_LAYER) {
+        bGPDlayer *gpl = te->directdata;
+        active = (gpl->flag & GP_LAYER_ACTIVE) ? OL_DRAWSEL_ACTIVE : OL_DRAWSEL_NONE;
+      }
       else {
         active = tree_element_type_active(
             C, scene, view_layer, soops, te, tselem, OL_SETSEL_NONE, false);
       }
 
-      if (!ELEM(tselem->type, 0, TSE_LAYER_COLLECTION, TSE_R_LAYER)) {
+      if (!ELEM(tselem->type, 0, TSE_LAYER_COLLECTION, TSE_R_LAYER, TSE_GP_LAYER)) {
         outliner_draw_iconrow_doit(block, te, fstyle, xmax, offsx, ys, alpha_fac, active, 1);
       }
       else {
@@ -2808,12 +2803,20 @@ static void outliner_draw_tree_element(bContext *C,
         }
       }
     }
-    else {
-      active = tree_element_type_active(
-          C, scene, view_layer, soops, te, tselem, OL_SETSEL_NONE, false);
-      /* active collection*/
-      icon_bgcolor[3] = 0.2f;
+    else if (tselem->type == TSE_GP_LAYER) {
+      /* Active grease pencil layer. */
+      if (((bGPDlayer *)te->directdata)->flag & GP_LAYER_ACTIVE) {
+        icon_bgcolor[3] = 0.2f;
+        active = OL_DRAWSEL_ACTIVE;
+      }
     }
+    else
+      {
+        active = tree_element_type_active(
+            C, scene, view_layer, soops, te, tselem, OL_SETSEL_NONE, false);
+        /* active collection*/
+        icon_bgcolor[3] = 0.2f;
+      }
 
     /* Checkbox to enable collections. */
     if ((tselem->type == TSE_LAYER_COLLECTION) &&