[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47072] branches/soc-2011-tomato/source/ blender: up-down arrow keys now jump between mask keyframes ( when in the mask view).
Campbell Barton
ideasman42 at gmail.com
Sun May 27 14:59:16 CEST 2012
Revision: 47072
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47072
Author: campbellbarton
Date: 2012-05-27 12:59:16 +0000 (Sun, 27 May 2012)
Log Message:
-----------
up-down arrow keys now jump between mask keyframes (when in the mask view).
Modified Paths:
--------------
branches/soc-2011-tomato/source/blender/editors/animation/keyframes_draw.c
branches/soc-2011-tomato/source/blender/editors/include/ED_keyframes_draw.h
branches/soc-2011-tomato/source/blender/editors/screen/screen_ops.c
branches/soc-2011-tomato/source/blender/makesdna/DNA_mask_types.h
Modified: branches/soc-2011-tomato/source/blender/editors/animation/keyframes_draw.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/animation/keyframes_draw.c 2012-05-27 12:23:20 UTC (rev 47071)
+++ branches/soc-2011-tomato/source/blender/editors/animation/keyframes_draw.c 2012-05-27 12:59:16 UTC (rev 47072)
@@ -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 @@
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 @@
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 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);
+ }
+ }
+}
+
Modified: branches/soc-2011-tomato/source/blender/editors/include/ED_keyframes_draw.h
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/include/ED_keyframes_draw.h 2012-05-27 12:23:20 UTC (rev 47071)
+++ branches/soc-2011-tomato/source/blender/editors/include/ED_keyframes_draw.h 2012-05-27 12:59:16 UTC (rev 47072)
@@ -42,6 +42,7 @@
struct Object;
struct ListBase;
struct bGPDlayer;
+struct MaskObject;
struct Scene;
struct View2D;
struct DLRBT_Tree;
@@ -139,6 +140,9 @@
/* 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 */
Modified: branches/soc-2011-tomato/source/blender/editors/screen/screen_ops.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/screen/screen_ops.c 2012-05-27 12:23:20 UTC (rev 47071)
+++ branches/soc-2011-tomato/source/blender/editors/screen/screen_ops.c 2012-05-27 12:59:16 UTC (rev 47072)
@@ -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 @@
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);
Modified: branches/soc-2011-tomato/source/blender/makesdna/DNA_mask_types.h
===================================================================
--- branches/soc-2011-tomato/source/blender/makesdna/DNA_mask_types.h 2012-05-27 12:23:20 UTC (rev 47071)
+++ branches/soc-2011-tomato/source/blender/makesdna/DNA_mask_types.h 2012-05-27 12:59:16 UTC (rev 47072)
@@ -92,6 +92,8 @@
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 {
More information about the Bf-blender-cvs
mailing list