[Bf-blender-cvs] [c29174eedf3] greasepencil-object: Dopesheet jump frame in active layer
Antonio Vazquez
noreply at git.blender.org
Mon Nov 27 17:08:11 CET 2017
Commit: c29174eedf3d847f358919d0d4e6c8ccda2a2dd6
Author: Antonio Vazquez
Date: Mon Nov 27 17:07:45 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rBc29174eedf3d847f358919d0d4e6c8ccda2a2dd6
Dopesheet jump frame in active layer
This new function allows to enable the frame jump only in active layer and not in all visible layer.
This was a request of Hero open movie artist team.
===================================================================
M release/scripts/startup/bl_ui/space_dopesheet.py
M source/blender/editors/animation/anim_draw.c
M source/blender/editors/animation/keyframes_draw.c
M source/blender/editors/include/ED_keyframes_draw.h
M source/blender/editors/screen/screen_ops.c
M source/blender/editors/space_time/space_time.c
M source/blender/makesdna/DNA_action_types.h
M source/blender/makesrna/intern/rna_space.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py
index 3e4edbc4bfa..48930234ac2 100644
--- a/release/scripts/startup/bl_ui/space_dopesheet.py
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -146,6 +146,7 @@ class DOPESHEET_HT_header(Header):
dopesheet_filter(layout, context, genericFiltersOnly=True)
elif st.mode == 'GPENCIL':
row = layout.row(align=True)
+ row.prop(st, "use_gp_jump_active", text="", icon="BRUSH_DATA")
row.prop(st.dopesheet, "show_gpencil_3d_only", text="Active Only")
if st.dopesheet.show_gpencil_3d_only:
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 8b5ec1f16e6..fbc9d382af2 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -502,20 +502,20 @@ static bool find_prev_next_keyframes(struct bContext *C, int *nextfra, int *prev
/* populate tree with keyframe nodes */
scene_to_keylist(&ads, scene, &keys, NULL);
- gpencil_to_keylist(&ads, scene->gpd, &keys);
+ gpencil_to_keylist(&ads, scene->gpd, &keys, false);
if (ob) {
ob_to_keylist(&ads, ob, &keys, NULL);
- gpencil_to_keylist(&ads, ob->data, &keys);
+ gpencil_to_keylist(&ads, ob->data, &keys, false);
}
if (mask) {
MaskLayer *masklay = BKE_mask_layer_active(mask);
- mask_to_keylist(&ads, masklay, &keys);
+ mask_to_keylist(&ads, masklay, &keys, false);
}
/* build linked-list for searching */
- BLI_dlrbTree_linkedlist_sync(&keys);
+ BLI_dlrbTree_linkedlist_sync(&keys, false);
/* find matching keyframe in the right direction */
do {
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index d1326faa676..4a86412b690 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -769,7 +769,7 @@ void draw_gpencil_channel(View2D *v2d, bDopeSheet *ads, bGPdata *gpd, float ypos
BLI_dlrbTree_init(&keys);
- gpencil_to_keylist(ads, gpd, &keys);
+ gpencil_to_keylist(ads, gpd, &keys, false);
BLI_dlrbTree_linkedlist_sync(&keys);
@@ -1005,7 +1005,7 @@ void action_to_keylist(AnimData *adt, bAction *act, DLRBT_Tree *keys, DLRBT_Tree
}
-void gpencil_to_keylist(bDopeSheet *ads, bGPdata *gpd, DLRBT_Tree *keys)
+void gpencil_to_keylist(bDopeSheet *ads, bGPdata *gpd, DLRBT_Tree *keys, const bool active)
{
bGPDlayer *gpl;
@@ -1013,7 +1013,9 @@ void gpencil_to_keylist(bDopeSheet *ads, bGPdata *gpd, DLRBT_Tree *keys)
/* for now, just aggregate out all the frames, but only for visible layers */
for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
if ((gpl->flag & GP_LAYER_HIDE) == 0) {
- gpl_to_keylist(ads, gpl, keys);
+ if ((!active) || ((active) && (gpl->flag & GP_LAYER_SELECT))) {
+ gpl_to_keylist(ads, gpl, keys);
+ }
}
}
}
diff --git a/source/blender/editors/include/ED_keyframes_draw.h b/source/blender/editors/include/ED_keyframes_draw.h
index 532cf374f9f..177837ce406 100644
--- a/source/blender/editors/include/ED_keyframes_draw.h
+++ b/source/blender/editors/include/ED_keyframes_draw.h
@@ -152,7 +152,7 @@ void scene_to_keylist(struct bDopeSheet *ads, struct Scene *sce, struct DLRBT_Tr
/* DopeSheet Summary */
void summary_to_keylist(struct bAnimContext *ac, struct DLRBT_Tree *keys, struct DLRBT_Tree *blocks);
/* Grease Pencil datablock summary */
-void gpencil_to_keylist(struct bDopeSheet *ads, struct bGPdata *gpd, struct DLRBT_Tree *keys);
+void gpencil_to_keylist(struct bDopeSheet *ads, struct bGPdata *gpd, struct DLRBT_Tree *keys, const bool active);
/* Grease Pencil Layer */
void gpl_to_keylist(struct bDopeSheet *ads, struct bGPDlayer *gpl, struct DLRBT_Tree *keys);
/* Palette */
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index f7d4df2bbf7..d217f24a720 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -2237,6 +2237,7 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
+ SpaceAction *spa = (SpaceAction *)CTX_wm_space_data(C);
bDopeSheet ads = {NULL};
DLRBT_Tree keys;
ActKeyColumn *ak;
@@ -2261,7 +2262,7 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
/* populate tree with keyframe nodes */
scene_to_keylist(&ads, scene, &keys, NULL);
- gpencil_to_keylist(&ads, scene->gpd, &keys);
+ gpencil_to_keylist(&ads, scene->gpd, &keys, false);
/* populate for all palettes */
CTX_DATA_BEGIN(C, Palette *, palette, available_palettes)
@@ -2274,8 +2275,9 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
if (ob) {
ob_to_keylist(&ads, ob, &keys, NULL);
- if (ob->type == OB_GPENCIL) {
- gpencil_to_keylist(&ads, ob->data, &keys);
+ if ((ob->type == OB_GPENCIL) && (spa) && (spa->mode == SACTCONT_GPENCIL)) {
+ const bool active = (spa->flag & SACTION_GP_JUMP_ACTIVE);
+ gpencil_to_keylist(&ads, ob->data, &keys, active);
}
}
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index a0a9d784afc..1b5889b65a7 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -309,7 +309,7 @@ static void time_draw_idblock_keyframes(View2D *v2d, ID *id, short onlysel, cons
ob_to_keylist(&ads, (Object *)id, &keys, NULL);
break;
case ID_GD:
- gpencil_to_keylist(&ads, (bGPdata *)id, &keys);
+ gpencil_to_keylist(&ads, (bGPdata *)id, &keys, false);
break;
case ID_PAL:
palette_to_keylist(&ads, (Palette *)id, &keys, NULL);
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index 984d4ee0c86..1f443d2850f 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -706,8 +706,10 @@ typedef enum eSAction_Flag {
/* don't perform realtime updates */
SACTION_NOREALTIMEUPDATES = (1 << 10),
/* move markers as well as keyframes */
- SACTION_MARKERS_MOVE = (1 << 11)
-} eSAction_Flag;
+ SACTION_MARKERS_MOVE = (1 << 11),
+ /* jump gpencil active layer */
+ SACTION_GP_JUMP_ACTIVE = (1 << 12)
+} eSAction_Flag;
/* SpaceAction Mode Settings */
typedef enum eAnimEdit_Context {
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 3a496d13429..3edf0a125c9 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -3292,6 +3292,11 @@ static void rna_def_space_dopesheet(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "ads");
RNA_def_property_ui_text(prop, "Dope Sheet", "Settings for filtering animation data");
+ prop = RNA_def_property(srna, "use_gp_jump_active", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_GP_JUMP_ACTIVE);
+ RNA_def_property_ui_text(prop, "Jump Active",
+ "Only jump between keyframes in the current Grease Pencil active layer");
+
/* autosnap */
prop = RNA_def_property(srna, "auto_snap", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "autosnap");
More information about the Bf-blender-cvs
mailing list