Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2015-12-13 16:36:02 +0300
committerJoshua Leung <aligorith@gmail.com>2015-12-13 17:06:50 +0300
commitab0b0efe822e246e8c371e8d9de953ac71201efc (patch)
treeeed20e4deb9ee6afe167d429fdaf86e3f1d7f6c2 /source/blender/editors
parenta27477b9e8c0b12e3da77aad0cf891d13cdf6a12 (diff)
Dopesheet: Mirroring GPencil keyframes now works again
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/gpencil/editaction_gpencil.c16
-rw-r--r--source/blender/editors/include/ED_gpencil.h4
-rw-r--r--source/blender/editors/space_action/action_edit.c19
3 files changed, 19 insertions, 20 deletions
diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c
index 9f96ac6122f..a5d39d7be1c 100644
--- a/source/blender/editors/gpencil/editaction_gpencil.c
+++ b/source/blender/editors/gpencil/editaction_gpencil.c
@@ -535,7 +535,6 @@ void ED_gplayer_snap_frames(bGPDlayer *gpl, Scene *scene, short mode)
}
}
-#if 0 /* XXX disabled until grease pencil code stabilises again */
/* -------------------------------------- */
/* Mirror Tools */
@@ -545,7 +544,7 @@ static short mirror_gpf_cframe(bGPDframe *gpf, Scene *scene)
if (gpf->flag & GP_FRAME_SELECT) {
diff = CFRA - gpf->framenum;
- gpf->framenum = CFRA;
+ gpf->framenum = CFRA + diff;
}
return 0;
@@ -567,6 +566,7 @@ static short mirror_gpf_xaxis(bGPDframe *gpf, Scene *scene)
{
int diff;
+ /* NOTE: since we can't really do this, we just do the same as for yaxis... */
if (gpf->flag & GP_FRAME_SELECT) {
diff = -gpf->framenum;
gpf->framenum = diff;
@@ -617,19 +617,20 @@ static short mirror_gpf_marker(bGPDframe *gpf, Scene *scene)
/* mirror selected gp-frames on... */
-void mirror_gplayer_frames(bGPDlayer *gpl, Scene *scene, short mode)
+// TODO: mirror over a specific time
+void ED_gplayer_mirror_frames(bGPDlayer *gpl, Scene *scene, short mode)
{
switch (mode) {
- case 1: /* mirror over current frame */
+ case MIRROR_KEYS_CURFRAME: /* mirror over current frame */
ED_gplayer_frames_looper(gpl, scene, mirror_gpf_cframe);
break;
- case 2: /* mirror over frame 0 */
+ case MIRROR_KEYS_YAXIS: /* mirror over frame 0 */
ED_gplayer_frames_looper(gpl, scene, mirror_gpf_yaxis);
break;
- case 3: /* mirror over value 0 */
+ case MIRROR_KEYS_XAXIS: /* mirror over value 0 */
ED_gplayer_frames_looper(gpl, scene, mirror_gpf_xaxis);
break;
- case 4: /* mirror over marker */
+ case MIRROR_KEYS_MARKER: /* mirror over marker */
mirror_gpf_marker(NULL, NULL);
ED_gplayer_frames_looper(gpl, scene, mirror_gpf_marker);
mirror_gpf_marker(NULL, NULL);
@@ -641,4 +642,3 @@ void mirror_gplayer_frames(bGPDlayer *gpl, Scene *scene, short mode)
}
/* ***************************************** */
-#endif // XXX disabled until Grease Pencil code stabilises again...
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index 47619031501..0f638c449ad 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -125,14 +125,12 @@ void ED_gplayer_frames_duplicate(struct bGPDlayer *gpl);
void ED_gplayer_frames_keytype_set(struct bGPDlayer *gpl, short type);
void ED_gplayer_snap_frames(struct bGPDlayer *gpl, struct Scene *scene, short mode);
+void ED_gplayer_mirror_frames(struct bGPDlayer *gpl, struct Scene *scene, short mode);
void ED_gpencil_anim_copybuf_free(void);
bool ED_gpencil_anim_copybuf_copy(struct bAnimContext *ac);
bool ED_gpencil_anim_copybuf_paste(struct bAnimContext *ac, const short copy_mode);
-#if 0
-void mirror_gplayer_frames(struct bGPDlayer *gpl, short mode);
-#endif
/* ------------ Grease-Pencil Undo System ------------------ */
int ED_gpencil_session_active(void);
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index a8cb6150664..42730ff87fc 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -1693,16 +1693,21 @@ static void mirror_action_keys(bAnimContext *ac, short mode)
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
- if (adt) {
+ if (ale->type == ANIMTYPE_GPLAYER) {
+ ED_gplayer_mirror_frames(ale->data, ac->scene, mode);
+ }
+ else if (ale->type == ANIMTYPE_MASKLAYER) {
+ /* TODO */
+ }
+ else if (adt) {
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1);
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve);
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1);
}
- //else if (ale->type == ACTTYPE_GPLAYER)
- // snap_gplayer_frames(ale->data, mode);
- else
+ else {
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve);
-
+ }
+
ale->update |= ANIM_UPDATE_DEFAULT;
}
@@ -1721,10 +1726,6 @@ static int actkeys_mirror_exec(bContext *C, wmOperator *op)
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
- /* XXX... */
- if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
- return OPERATOR_PASS_THROUGH;
-
/* get mirroring mode */
mode = RNA_enum_get(op->ptr, "type");