up-down arrow keys now jump between mask keyframes (when in the mask view).
This commit is contained in:
@@ -60,6 +60,7 @@
|
||||
#include "DNA_speaker_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_mask_types.h"
|
||||
|
||||
#include "BKE_key.h"
|
||||
#include "BKE_material.h"
|
||||
@@ -184,6 +185,50 @@ static void nupdate_ak_gpframe(void *node, void *data)
|
||||
ak->modified += 1;
|
||||
}
|
||||
|
||||
/* ......... */
|
||||
|
||||
/* Comparator callback used for ActKeyColumns and GPencil frame */
|
||||
static short compare_ak_maskobjshape(void *node, void *data)
|
||||
{
|
||||
ActKeyColumn *ak = (ActKeyColumn *)node;
|
||||
MaskObjectShape *maskobj_shape = (MaskObjectShape *)data;
|
||||
|
||||
if (maskobj_shape->frame < ak->cfra)
|
||||
return -1;
|
||||
else if (maskobj_shape->frame > ak->cfra)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* New node callback used for building ActKeyColumns from GPencil frames */
|
||||
static DLRBT_Node *nalloc_ak_maskobjshape(void *data)
|
||||
{
|
||||
ActKeyColumn *ak = MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumnGPF");
|
||||
MaskObjectShape *maskobj_shape = (MaskObjectShape *)data;
|
||||
|
||||
/* store settings based on state of BezTriple */
|
||||
ak->cfra = maskobj_shape->frame;
|
||||
ak->sel = (maskobj_shape->flag & SELECT) ? SELECT : 0;
|
||||
|
||||
/* set 'modified', since this is used to identify long keyframes */
|
||||
ak->modified = 1;
|
||||
|
||||
return (DLRBT_Node *)ak;
|
||||
}
|
||||
|
||||
/* Node updater callback used for building ActKeyColumns from GPencil frames */
|
||||
static void nupdate_ak_maskobjshape(void *node, void *data)
|
||||
{
|
||||
ActKeyColumn *ak = (ActKeyColumn *)node;
|
||||
MaskObjectShape *maskobj_shape = (MaskObjectShape *)data;
|
||||
|
||||
/* set selection status and 'touched' status */
|
||||
if (maskobj_shape->flag & SELECT) ak->sel = SELECT;
|
||||
ak->modified += 1;
|
||||
}
|
||||
|
||||
|
||||
/* --------------- */
|
||||
|
||||
/* Add the given BezTriple to the given 'list' of Keyframes */
|
||||
@@ -204,6 +249,15 @@ static void add_gpframe_to_keycolumns_list(DLRBT_Tree *keys, bGPDframe *gpf)
|
||||
BLI_dlrbTree_add(keys, compare_ak_gpframe, nalloc_ak_gpframe, nupdate_ak_gpframe, gpf);
|
||||
}
|
||||
|
||||
/* Add the given MaskObjectShape Frame to the given 'list' of Keyframes */
|
||||
static void add_maskobj_to_keycolumns_list(DLRBT_Tree *keys, MaskObjectShape *maskobj_shape)
|
||||
{
|
||||
if (ELEM(NULL, keys, maskobj_shape))
|
||||
return;
|
||||
else
|
||||
BLI_dlrbTree_add(keys, compare_ak_maskobjshape, nalloc_ak_maskobjshape, nupdate_ak_maskobjshape, maskobj_shape);
|
||||
}
|
||||
|
||||
/* ActBeztColumns (Helpers for Long Keyframes) ------------------------------ */
|
||||
|
||||
/* maximum size of default buffer for BezTriple columns */
|
||||
@@ -940,3 +994,17 @@ void gpl_to_keylist(bDopeSheet *UNUSED(ads), bGPDlayer *gpl, DLRBT_Tree *keys)
|
||||
}
|
||||
}
|
||||
|
||||
void mask_to_keylist(bDopeSheet *UNUSED(ads), MaskObject *maskobj, DLRBT_Tree *keys)
|
||||
{
|
||||
MaskObjectShape *maskobj_shape;
|
||||
|
||||
if (maskobj && keys) {
|
||||
for (maskobj_shape = maskobj->splines_shapes.first;
|
||||
maskobj_shape;
|
||||
maskobj_shape = maskobj_shape->next)
|
||||
{
|
||||
add_maskobj_to_keycolumns_list(keys, maskobj_shape);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ struct bActionGroup;
|
||||
struct Object;
|
||||
struct ListBase;
|
||||
struct bGPDlayer;
|
||||
struct MaskObject;
|
||||
struct Scene;
|
||||
struct View2D;
|
||||
struct DLRBT_Tree;
|
||||
@@ -139,6 +140,9 @@ void summary_to_keylist(struct bAnimContext *ac, struct DLRBT_Tree *keys, struct
|
||||
/* Grease Pencil Layer */
|
||||
// XXX not restored
|
||||
void gpl_to_keylist(struct bDopeSheet *ads, struct bGPDlayer *gpl, struct DLRBT_Tree *keys);
|
||||
/* Mask */
|
||||
// XXX not restored
|
||||
void mask_to_keylist(struct bDopeSheet *UNUSED(ads), struct MaskObject *maskobj, struct DLRBT_Tree *keys);
|
||||
|
||||
/* ActKeyColumn API ---------------- */
|
||||
/* Comparator callback used for ActKeyColumns and cframe float-value pointer */
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_meta_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_mask_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
@@ -59,6 +60,7 @@
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_tessmesh.h"
|
||||
#include "BKE_sound.h"
|
||||
#include "BKE_mask.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
@@ -1945,7 +1947,17 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
|
||||
|
||||
if (ob)
|
||||
ob_to_keylist(&ads, ob, &keys, NULL);
|
||||
|
||||
|
||||
{
|
||||
SpaceClip *sc = CTX_wm_space_clip(C);
|
||||
if (sc) {
|
||||
if ((sc->mode == SC_MODE_MASKEDITING) && sc->mask) {
|
||||
MaskObject *maskobj = BKE_mask_object_active(sc->mask);
|
||||
mask_to_keylist(&ads, maskobj, &keys);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* build linked-list for searching */
|
||||
BLI_dlrbTree_linkedlist_sync(&keys);
|
||||
|
||||
|
||||
@@ -92,6 +92,8 @@ typedef struct MaskObjectShape {
|
||||
float *data; /* u coordinate along spline segment and weight of this point */
|
||||
int tot_vert; /* to ensure no buffer overruns's: alloc size is (tot_vert * MASK_OBJECT_SHAPE_ELEM_SIZE) */
|
||||
int frame; /* different flags of this point */
|
||||
char flag;
|
||||
char pad[7];
|
||||
} MaskObjectShape;
|
||||
|
||||
typedef struct MaskObject {
|
||||
|
||||
Reference in New Issue
Block a user