[Bf-blender-cvs] [9dd0881] GPencil_EditStrokes: Grease Pencil Dopesheet - Selecting channels in the dopesheet changes active layer

Joshua Leung noreply at git.blender.org
Mon Sep 29 14:47:54 CEST 2014


Commit: 9dd0881abba4920433a57199034c26f3f39558a4
Author: Joshua Leung
Date:   Mon Sep 29 13:03:55 2014 +1300
Branches: GPencil_EditStrokes
https://developer.blender.org/rB9dd0881abba4920433a57199034c26f3f39558a4

Grease Pencil Dopesheet - Selecting channels in the dopesheet changes active layer

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

M	source/blender/editors/animation/anim_channels_edit.c

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

diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index b6ab040..ec4e85b 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -136,6 +136,13 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datat
 				}
 				break;
 			}
+			case ANIMTYPE_GPLAYER:
+			{
+				bGPDlayer *gpl = (bGPDlayer *)ale->data;
+				
+				ACHANNEL_SET_FLAG(gpl, ACHANNEL_SETFLAG_CLEAR, GP_LAYER_ACTIVE);
+				break;
+			}
 		}
 	}
 	
@@ -184,8 +191,14 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datat
 				break;
 			}
 			
-			/* unhandled currently, but may be interesting */
 			case ANIMTYPE_GPLAYER:
+			{
+				bGPDlayer *gpl = (bGPDlayer *)channel_data;
+				gpl->flag |= GP_LAYER_ACTIVE;
+				break;
+			}
+			
+			/* unhandled currently, but may be interesting */
 			case ANIMTYPE_MASKLAYER:
 			case ANIMTYPE_SHAPEKEY:
 			case ANIMTYPE_NLAACTION:
@@ -2897,7 +2910,13 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
 				gpl->flag |= GP_LAYER_SELECT;
 			}
 			
-			notifierFlags |= (ND_ANIMCHAN | NA_EDITED);
+			/* change active layer, if this is selected (since we must always have an active layer) */
+			if (gpl->flag & GP_LAYER_SELECT) {
+				ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, gpl, ANIMTYPE_GPLAYER);
+			}
+			
+			WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, NULL); /* Grease Pencil updates */
+			notifierFlags |= (ND_ANIMCHAN | NA_EDITED); /* Animation Ediotrs updates */
 			break;
 		}
 		case ANIMTYPE_MASKDATABLOCK:




More information about the Bf-blender-cvs mailing list