Commit: 5ebae1c0c07f8c625ac9892c99f1b464c2c79fb3
Author: Joshua Leung
Date:   Sat Feb 7 12:50:22 2015 +1300
Branches: master
https://developer.blender.org/rB5ebae1c0c07f8c625ac9892c99f1b464c2c79fb3

GPencil: Initial support for GP Layers in Outliner

This is still very rudimentary, and lacks many things.
* This needs a better icon. Perhaps we can look into using colour swatches here
  too like in all the other places?
* The "active" check needs to be implemented still
* Various restriction toggles to come still

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

M       source/blender/editors/space_outliner/outliner_draw.c
M       source/blender/editors/space_outliner/outliner_intern.h
M       source/blender/editors/space_outliner/outliner_select.c
M       source/blender/editors/space_outliner/outliner_tree.c

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

diff --git a/source/blender/editors/space_outliner/outliner_draw.c 
b/source/blender/editors/space_outliner/outliner_draw.c
index f604679..97d6a88 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -31,6 +31,7 @@
 
 #include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
+#include "DNA_gpencil_types.h"
 #include "DNA_group_types.h"
 #include "DNA_lamp_types.h"
 #include "DNA_object_types.h"
@@ -549,6 +550,17 @@ static void namebutton_cb(bContext *C, void *tsep, char 
*oldname)
                                        WM_event_add_notifier(C, NC_OBJECT | 
ND_POSE, ob);
                                        break;
                                }
+                               case TSE_GP_LAYER:
+                               {
+                                       bGPdata *gpd = (bGPdata *)tselem->id; 
// id = GP Datablock
+                                       bGPDlayer *gpl = te->directdata;
+                                       
+                                       // XXX: name needs translation stuff
+                                       BLI_uniquename(&gpd->layers, gpl, "GP 
Layer", '.',
+                                                      offsetof(bGPDlayer, 
info), sizeof(gpl->info));
+                                       WM_event_add_notifier(C, NC_GPENCIL | 
ND_DATA, gpd);
+                                       break;
+                               }
                                case TSE_R_LAYER:
                                        break;
                        }
@@ -1074,6 +1086,8 @@ static void tselem_draw_icon(uiBlock *block, int xmax, 
float x, float y, TreeSto
                                else
                                        UI_icon_draw(x, y, 
RNA_struct_ui_icon(te->rnaptr.type));
                                break;
+                       case TSE_GP_LAYER:
+                               UI_icon_draw(x, y, ICON_DOT); break; // XXX: 
needs a dedicated icon?
                        default:
                                UI_icon_draw(x, y, ICON_DOT); break;
                }
diff --git a/source/blender/editors/space_outliner/outliner_intern.h 
b/source/blender/editors/space_outliner/outliner_intern.h
index 26283df..05e5d3c 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -104,6 +104,7 @@ typedef struct TreeElement {
 #define TSE_KEYMAP          34
 #define TSE_KEYMAP_ITEM     35
 #define TSE_ID_BASE                    36
+#define TSE_GP_LAYER        37
 
 /* button events */
 #define OL_NAMEBUTTON       1
diff --git a/source/blender/editors/space_outliner/outliner_select.c 
b/source/blender/editors/space_outliner/outliner_select.c
index ad71ac8..730ee02 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -873,6 +873,9 @@ eOLDrawState tree_element_type_active(
                        return tree_element_active_sequence_dup(scene, te, 
tselem, set);
                case TSE_KEYMAP_ITEM:
                        return tree_element_active_keymap_item(C, te, tselem, 
set);
+               case TSE_GP_LAYER:
+                       //return tree_element_active_gplayer(C, scene, te, 
tselem, set);
+                       break;
                        
        }
        return OL_DRAWSEL_NONE;
diff --git a/source/blender/editors/space_outliner/outliner_tree.c 
b/source/blender/editors/space_outliner/outliner_tree.c
index 8a4b6f1..273cf75 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -822,9 +822,10 @@ static void outliner_add_id_contents(SpaceOops *soops, 
TreeElement *te, TreeStor
                        
                        if (outliner_animdata_test(gpd->adt))
                                outliner_add_element(soops, &te->subtree, gpd, 
te, TSE_ANIM_DATA, 0);
-                               
+                       
+                       // TODO: base element for layers?
                        for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
-                               // TODO
+                               outliner_add_element(soops, &te->subtree, gpl, 
te, TSE_GP_LAYER, a);
                                a++;
                        }
                }
@@ -875,6 +876,9 @@ static TreeElement *outliner_add_element(SpaceOops *soops, 
ListBase *lb, void *i
        else if (type == TSE_ANIM_DATA) {
                /* pass */
        }
+       else if (type == TSE_GP_LAYER) {
+               /* pass */
+       }
        else if (type == TSE_ID_BASE) {
                /* pass */
        }
@@ -957,6 +961,12 @@ static TreeElement *outliner_add_element(SpaceOops *soops, 
ListBase *lb, void *i
                        }
                }
        }
+       else if (type == TSE_GP_LAYER) {
+               bGPDlayer *gpl = (bGPDlayer *)idv;
+               
+               te->name = gpl->info;
+               te->directdata = gpl;
+       }
        else if (type == TSE_SEQUENCE) {
                Sequence *seq = (Sequence *) idv;
                Sequence *p;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to