[Bf-blender-cvs] [fda1198] master: GPencil: RMB menu tools in Outliner works for GP Layers now

Joshua Leung noreply at git.blender.org
Wed Feb 18 02:52:52 CET 2015


Commit: fda119866d8055529bf22683779911242cb6b37e
Author: Joshua Leung
Date:   Wed Feb 18 13:01:29 2015 +1300
Branches: master
https://developer.blender.org/rBfda119866d8055529bf22683779911242cb6b37e

GPencil: RMB menu tools in Outliner works for GP Layers now

It would be even better if these used their own dedicated menu which could include
the protect values too, but this one at least works now

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

M	source/blender/editors/space_outliner/outliner_tools.c

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

diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index d6c3a85..64e0058 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -33,6 +33,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_linestyle_types.h"
@@ -585,6 +586,20 @@ static void sequence_cb(int event, TreeElement *te, TreeStoreElem *tselem, void
 	(void)tselem;
 }
 
+static void gp_layer_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), void *UNUSED(arg))
+{
+	bGPDlayer *gpl = (bGPDlayer *)te->directdata;
+	
+	if (event == OL_DOP_SELECT)
+		gpl->flag |= GP_LAYER_SELECT;
+	else if (event == OL_DOP_DESELECT)
+		gpl->flag &= ~GP_LAYER_SELECT;
+	else if (event == OL_DOP_HIDE)
+		gpl->flag |= GP_LAYER_HIDE;
+	else if (event == OL_DOP_UNHIDE)
+		gpl->flag &= ~GP_LAYER_HIDE;
+}
+
 static void data_select_linked_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), void *C_v)
 {
 	if (event == OL_DOP_SELECT_LINKED) {
@@ -1453,6 +1468,7 @@ void OUTLINER_OT_modifier_operation(wmOperatorType *ot)
 
 /* ******************** */
 
+// XXX: select linked is for RNA structs only
 static EnumPropertyItem prop_data_op_types[] = {
 	{OL_DOP_SELECT, "SELECT", 0, "Select", ""},
 	{OL_DOP_DESELECT, "DESELECT", 0, "Deselect", ""},
@@ -1507,6 +1523,14 @@ static int outliner_data_operation_exec(bContext *C, wmOperator *op)
 		}
 			break;
 			
+		case TSE_GP_LAYER:
+		{
+			outliner_do_data_operation(soops, datalevel, event, &soops->tree, gp_layer_cb, NULL);
+			WM_event_add_notifier(C, NC_GPENCIL | ND_DATA, NULL);
+			ED_undo_push(C, "Grease Pencil Layer operation");
+		}
+			break;
+			
 		case TSE_RNA_STRUCT:
 			if (event == OL_DOP_SELECT_LINKED) {
 				outliner_do_data_operation(soops, datalevel, event, &soops->tree, data_select_linked_cb, C);




More information about the Bf-blender-cvs mailing list