[Bf-blender-cvs] [2060ec76dc2] temp-gpencil-interpolate: GPencil: Add Remove Breakdowns to Menu in Dopesheet
Antonio Vazquez
noreply at git.blender.org
Tue Dec 22 19:49:30 CET 2020
Commit: 2060ec76dc26c4d9d25743425776b63dc8e1192f
Author: Antonio Vazquez
Date: Tue Dec 22 19:47:58 2020 +0100
Branches: temp-gpencil-interpolate
https://developer.blender.org/rB2060ec76dc26c4d9d25743425776b63dc8e1192f
GPencil: Add Remove Breakdowns to Menu in Dopesheet
===================================================================
M release/scripts/startup/bl_ui/space_dopesheet.py
M source/blender/editors/gpencil/gpencil_interpolate.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py
index 3f43240eaed..95ef13c89e5 100644
--- a/release/scripts/startup/bl_ui/space_dopesheet.py
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -321,7 +321,7 @@ class DOPESHEET_MT_editor_menus(Menu):
if st.mode != 'GPENCIL':
layout.menu("DOPESHEET_MT_key")
else:
- layout.menu("DOPESHEET_MT_gpencil_frame")
+ layout.menu("DOPESHEET_MT_gpencil_key")
class DOPESHEET_MT_view(Menu):
@@ -557,8 +557,8 @@ class DOPESHEET_MT_gpencil_channel(Menu):
layout.operator_menu_enum("anim.channels_move", "direction", text="Move...")
-class DOPESHEET_MT_gpencil_frame(Menu):
- bl_label = "Frame"
+class DOPESHEET_MT_gpencil_key(Menu):
+ bl_label = "Key"
def draw(self, _context):
layout = self.layout
@@ -569,7 +569,10 @@ class DOPESHEET_MT_gpencil_frame(Menu):
layout.separator()
layout.operator("action.duplicate")
+
+ layout.separator()
layout.operator("action.delete")
+ layout.operator("gpencil.interpolate_reverse")
layout.separator()
layout.operator("action.keyframe_type")
@@ -754,7 +757,7 @@ classes = (
DOPESHEET_MT_key,
DOPESHEET_MT_key_transform,
DOPESHEET_MT_gpencil_channel,
- DOPESHEET_MT_gpencil_frame,
+ DOPESHEET_MT_gpencil_key,
DOPESHEET_MT_delete,
DOPESHEET_MT_context_menu,
DOPESHEET_MT_channel_context_menu,
diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c
index 55b26121c39..f50511f5d3a 100644
--- a/source/blender/editors/gpencil/gpencil_interpolate.c
+++ b/source/blender/editors/gpencil/gpencil_interpolate.c
@@ -796,7 +796,7 @@ void GPENCIL_OT_interpolate(wmOperatorType *ot)
RNA_def_boolean(ot->srna,
"flip",
0,
- "Flip",
+ "Flip Strokes",
"Invert destination stroke to match start and end with source stroke");
prop = RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "");
@@ -1353,7 +1353,7 @@ void GPENCIL_OT_interpolate_sequence(wmOperatorType *ot)
RNA_def_boolean(ot->srna,
"flip",
0,
- "Flip",
+ "Flip Strokes",
"Invert destination stroke to match start and end with source stroke");
RNA_def_enum(ot->srna,
@@ -1406,19 +1406,30 @@ void GPENCIL_OT_interpolate_sequence(wmOperatorType *ot)
static bool gpencil_interpolate_reverse_poll(bContext *C)
{
- if (!gpencil_view3d_poll(C)) {
- return 0;
+ ScrArea *area = CTX_wm_area(C);
+ if (area == NULL) {
+ return false;
+ }
+ if ((area->spacetype != SPACE_VIEW3D) && (area->spacetype != SPACE_ACTION)) {
+ return false;
}
- bGPDlayer *gpl = CTX_data_active_gpencil_layer(C);
+ bGPdata *gpd = ED_gpencil_data_get_active(C);
+ if (gpd == NULL) {
+ return false;
+ }
+ bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd);
+ if (gpl == NULL) {
+ return false;
+ }
/* need to be on a breakdown frame */
if ((gpl->actframe == NULL) || (gpl->actframe->key_type != BEZT_KEYTYPE_BREAKDOWN)) {
CTX_wm_operator_poll_msg_set(C, "Expected current frame to be a breakdown");
- return 0;
+ return false;
}
- return 1;
+ return true;
}
static int gpencil_interpolate_reverse_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1428,7 +1439,11 @@ static int gpencil_interpolate_reverse_exec(bContext *C, wmOperator *UNUSED(op))
/* Go through each layer, deleting the breakdowns around the current frame,
* but only if there is a keyframe nearby to stop at
*/
- CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) {
+ LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
+ /* only editable and visible layers are considered */
+ if (!BKE_gpencil_layer_is_editable(gpl) || (gpl->actframe == NULL)) {
+ continue;
+ }
bGPDframe *start_key = NULL;
bGPDframe *end_key = NULL;
bGPDframe *gpf, *gpfn;
@@ -1489,7 +1504,6 @@ static int gpencil_interpolate_reverse_exec(bContext *C, wmOperator *UNUSED(op))
BLI_freelinkN(&gpl->frames, end_key);
}
}
- CTX_DATA_END;
/* notifiers */
DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
More information about the Bf-blender-cvs
mailing list