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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2011-01-09 18:07:14 +0300
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2011-01-09 18:07:14 +0300
commit0ec378f3fea3be9235b5bc8cb976d6126ae808f5 (patch)
tree5266bf2dff77d453046265892380e441cb4643be /source/blender/editors/animation
parentddcb91fc213cb9d9f87558f88a4831cd4c8e2791 (diff)
parent99e203dbd46237c204fa697374e21769473955f5 (diff)
Merged changes in the trunk up to revision 34193.
Conflicts resolved: source/blender/editors/animation/anim_channels_defines.c source/blender/editors/animation/anim_channels_edit.c source/blender/editors/animation/keyframes_draw.c source/blender/editors/animation/keyframes_edit.c source/blender/editors/include/ED_anim_api.h source/blender/editors/space_nla/nla_channels.c source/blender/makesrna/intern/CMakeLists.txt source/blender/makesrna/intern/rna_main_api.c source/blender/makesrna/intern/rna_scene.c API changes resolved: source/blender/freestyle/intern/system/PythonInterpreter.h
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c81
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c8
-rw-r--r--source/blender/editors/animation/anim_deps.c1
-rw-r--r--source/blender/editors/animation/anim_filter.c71
-rw-r--r--source/blender/editors/animation/anim_ipo_utils.c3
-rw-r--r--source/blender/editors/animation/anim_markers.c281
-rw-r--r--source/blender/editors/animation/anim_ops.c2
-rw-r--r--source/blender/editors/animation/drivers.c1
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c1
-rw-r--r--source/blender/editors/animation/keyframes_draw.c14
-rw-r--r--source/blender/editors/animation/keyframes_edit.c14
-rw-r--r--source/blender/editors/animation/keyframes_general.c1
-rw-r--r--source/blender/editors/animation/keyframing.c45
-rw-r--r--source/blender/editors/animation/keyingsets.c70
14 files changed, 495 insertions, 98 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 592149157aa..cc1e8bd9eb8 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -31,6 +31,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
@@ -42,6 +43,7 @@
#include "DNA_space_types.h"
#include "DNA_key_types.h"
#include "DNA_lamp_types.h"
+#include "DNA_lattice_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_mesh_types.h"
#include "DNA_material_types.h"
@@ -50,9 +52,11 @@
#include "DNA_world_types.h"
#include "RNA_access.h"
+
#include "BKE_curve.h"
#include "BKE_key.h"
#include "BKE_context.h"
+#include "BKE_utildefines.h" /* FILE_MAX */
#include "UI_interface.h"
#include "UI_interface_icons.h"
@@ -2311,6 +2315,82 @@ static bAnimChannelType ACF_DSMESH=
acf_dsmesh_setting_ptr /* pointer for setting */
};
+/* Lattice Expander ------------------------------------------- */
+
+// TODO: just get this from RNA?
+static int acf_dslat_icon(bAnimListElem *UNUSED(ale))
+{
+ return ICON_LATTICE_DATA;
+}
+
+/* get the appropriate flag(s) for the setting when it is valid */
+static int acf_dslat_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
+{
+ /* clear extra return data first */
+ *neg= 0;
+
+ switch (setting) {
+ case ACHANNEL_SETTING_EXPAND: /* expanded */
+ return LT_DS_EXPAND;
+
+ case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
+ return ADT_NLA_EVAL_OFF;
+
+ case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+ *neg= 1;
+ return ADT_CURVES_NOT_VISIBLE;
+
+ case ACHANNEL_SETTING_SELECT: /* selected */
+ return ADT_UI_SELECTED;
+
+ default: /* unsupported */
+ return 0;
+ }
+}
+
+/* get pointer to the setting */
+static void *acf_dslat_setting_ptr(bAnimListElem *ale, int setting, short *type)
+{
+ Lattice *lt= (Lattice *)ale->data;
+
+ /* clear extra return data first */
+ *type= 0;
+
+ switch (setting) {
+ case ACHANNEL_SETTING_EXPAND: /* expanded */
+ GET_ACF_FLAG_PTR(lt->flag);
+
+ case ACHANNEL_SETTING_SELECT: /* selected */
+ case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
+ if (lt->adt)
+ GET_ACF_FLAG_PTR(lt->adt->flag)
+ else
+ return NULL;
+
+ default: /* unsupported */
+ return NULL;
+ }
+}
+
+/* node tree expander type define */
+static bAnimChannelType ACF_DSLAT=
+{
+ "Lattice Expander", /* type name */
+
+ acf_generic_dataexpand_color, /* backdrop color */
+ acf_generic_dataexpand_backdrop,/* backdrop */
+ acf_generic_indention_1, /* indent level */ // XXX this only works for compositing
+ acf_generic_basic_offset, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_dslat_icon, /* icon */
+
+ acf_generic_dataexpand_setting_valid, /* has setting */
+ acf_dslat_setting_flag, /* flag for setting */
+ acf_dslat_setting_ptr /* pointer for setting */
+};
+
/* ShapeKey Entry ------------------------------------------- */
/* name for ShapeKey */
@@ -2567,6 +2647,7 @@ void ANIM_init_channel_typeinfo_data (void)
animchannelTypeInfo[type++]= &ACF_DSARM; /* Armature Channel */
animchannelTypeInfo[type++]= &ACF_DSMESH; /* Mesh Channel */
animchannelTypeInfo[type++]= &ACF_DSTEX; /* Texture Channel */
+ animchannelTypeInfo[type++]= &ACF_DSLAT; /* Lattice Channel */
animchannelTypeInfo[type++]= &ACF_DSLINESTYLE; /* LineStyle Channel */
animchannelTypeInfo[type++]= &ACF_SHAPEKEY; /* ShapeKey */
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 9d6b6d80a78..f4e3602343f 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -32,6 +32,8 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
+
#include "DNA_anim_types.h"
#include "DNA_object_types.h"
@@ -114,6 +116,8 @@ void ANIM_set_active_channel (bAnimContext *ac, void *data, short datatype, int
case ANIMTYPE_DSMBALL:
case ANIMTYPE_DSARM:
case ANIMTYPE_DSMESH:
+ case ANIMTYPE_DSTEX:
+ case ANIMTYPE_DSLAT:
{
/* need to verify that this data is valid for now */
if (ale->adt) {
@@ -157,6 +161,7 @@ void ANIM_set_active_channel (bAnimContext *ac, void *data, short datatype, int
case ANIMTYPE_DSMBALL:
case ANIMTYPE_DSARM:
case ANIMTYPE_DSMESH:
+ case ANIMTYPE_DSLAT:
{
/* need to verify that this data is valid for now */
// XXX: ale may be null!
@@ -234,6 +239,7 @@ void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype,
case ANIMTYPE_DSMESH:
case ANIMTYPE_DSNTREE:
case ANIMTYPE_DSTEX:
+ case ANIMTYPE_DSLAT:
case ANIMTYPE_DSLINESTYLE:
{
if ((ale->adt) && (ale->adt->flag & ADT_UI_SELECTED))
@@ -318,6 +324,7 @@ void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype,
case ANIMTYPE_DSMESH:
case ANIMTYPE_DSNTREE:
case ANIMTYPE_DSTEX:
+ case ANIMTYPE_DSLAT:
case ANIMTYPE_DSLINESTYLE:
{
/* need to verify that this data is valid for now */
@@ -1940,6 +1947,7 @@ static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_i
case ANIMTYPE_DSMESH:
case ANIMTYPE_DSNTREE:
case ANIMTYPE_DSTEX:
+ case ANIMTYPE_DSLAT:
case ANIMTYPE_DSLINESTYLE:
{
/* sanity checking... */
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c
index 02d69fd61fa..340101612b9 100644
--- a/source/blender/editors/animation/anim_deps.c
+++ b/source/blender/editors/animation/anim_deps.c
@@ -38,6 +38,7 @@
#include "DNA_sequence_types.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_animsys.h"
#include "BKE_action.h"
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 641183db4c4..91af5534eaa 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -70,6 +70,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BLI_ghash.h"
#include "BKE_animsys.h"
@@ -82,6 +83,7 @@
#include "BKE_material.h"
#include "BKE_node.h"
#include "BKE_sequencer.h"
+#include "BKE_utildefines.h"
#include "ED_anim_api.h"
@@ -106,23 +108,7 @@ static Key *actedit_get_shapekeys (bAnimContext *ac)
//if (saction->pin) return NULL;
/* shapekey data is stored with geometry data */
- switch (ob->type) {
- case OB_MESH:
- key= ((Mesh *)ob->data)->key;
- break;
-
- case OB_LATTICE:
- key= ((Lattice *)ob->data)->key;
- break;
-
- case OB_CURVE:
- case OB_SURF:
- key= ((Curve *)ob->data)->key;
- break;
-
- default:
- return NULL;
- }
+ key= ob_get_key(ob);
if (key) {
if (key->type == KEY_RELATIVE)
@@ -643,6 +629,19 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
ale->adt= BKE_animdata_from_id(data);
}
break;
+ case ANIMTYPE_DSLAT:
+ {
+ Lattice *lt= (Lattice *)data;
+ AnimData *adt= lt->adt;
+
+ ale->flag= FILTER_LATTICE_OBJD(lt);
+
+ ale->key_data= (adt) ? adt->action : NULL;
+ ale->datatype= ALE_ACT;
+
+ ale->adt= BKE_animdata_from_id(data);
+ }
+ break;
case ANIMTYPE_DSSKEY:
{
Key *key= (Key *)data;
@@ -1613,6 +1612,14 @@ static int animdata_filter_dopesheet_obdata (bAnimContext *ac, ListBase *anim_da
expanded= FILTER_MESH_OBJD(me);
}
break;
+ case OB_LATTICE: /* ---- Lattice ---- */
+ {
+ Lattice *lt = (Lattice *)ob->data;
+
+ type= ANIMTYPE_DSLAT;
+ expanded= FILTER_LATTICE_OBJD(lt);
+ }
+ break;
}
/* special exception for drivers instead of action */
@@ -1871,6 +1878,19 @@ static int animdata_filter_dopesheet_ob (bAnimContext *ac, ListBase *anim_data,
}
}
break;
+ case OB_LATTICE: /* ------- Lattice ---------- */
+ {
+ Lattice *lt= (Lattice *)ob->data;
+
+ if ((ads->filterflag & ADS_FILTER_NOLAT) == 0) {
+ ANIMDATA_FILTER_CASES(lt,
+ { /* AnimData blocks - do nothing... */ },
+ obdata_ok= 1;,
+ obdata_ok= 1;,
+ obdata_ok= 1;)
+ }
+ }
+ break;
}
if (obdata_ok)
items += animdata_filter_dopesheet_obdata(ac, anim_data, ads, base, filter_mode);
@@ -2500,6 +2520,23 @@ static int animdata_filter_dopesheet (bAnimContext *ac, ListBase *anim_data, bDo
dataOk= !(ads->filterflag & ADS_FILTER_NOMESH);)
}
break;
+ case OB_LATTICE: /* ------- Lattice ---------- */
+ {
+ Lattice *lt= (Lattice *)ob->data;
+ dataOk= 0;
+ ANIMDATA_FILTER_CASES(lt,
+ if ((ads->filterflag & ADS_FILTER_NOLAT)==0) {
+ /* for the special AnimData blocks only case, we only need to add
+ * the block if it is valid... then other cases just get skipped (hence ok=0)
+ */
+ ANIMDATA_ADD_ANIMDATA(lt);
+ dataOk=0;
+ },
+ dataOk= !(ads->filterflag & ADS_FILTER_NOLAT);,
+ dataOk= !(ads->filterflag & ADS_FILTER_NOLAT);,
+ dataOk= !(ads->filterflag & ADS_FILTER_NOLAT);)
+ }
+ break;
default: /* --- other --- */
dataOk= 0;
break;
diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c
index 56161f4bfa0..3e2212c15bb 100644
--- a/source/blender/editors/animation/anim_ipo_utils.c
+++ b/source/blender/editors/animation/anim_ipo_utils.c
@@ -37,10 +37,11 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
-#include "BKE_utildefines.h"
+
#include "RNA_access.h"
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 2f5ad28c8f2..80b026ddd6e 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -38,6 +38,7 @@
#include "RNA_enum_types.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
@@ -82,6 +83,8 @@ static ListBase *context_get_markers(const bContext *C)
return &CTX_data_scene(C)->markers;
}
+/* --------------------------------- */
+
/* Get the marker that is closest to this point */
/* XXX for select, the min_dist should be small */
TimeMarker *ED_markers_find_nearest_marker (ListBase *markers, float x)
@@ -175,6 +178,8 @@ void ED_markers_get_minmax (ListBase *markers, short sel, float *first, float *l
*last= max;
}
+/* --------------------------------- */
+
/* Adds a marker to list of cfra elems */
void add_marker_to_cfra_elem(ListBase *lb, TimeMarker *marker, short only_sel)
{
@@ -218,6 +223,23 @@ void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, short only_sel)
add_marker_to_cfra_elem(lb, marker, only_sel);
}
+/* --------------------------------- */
+
+/* Get the first selected marker */
+TimeMarker *ED_markers_get_first_selected(ListBase *markers)
+{
+ TimeMarker *marker;
+
+ if (markers) {
+ for (marker = markers->first; marker; marker = marker->next) {
+ if (marker->flag & SELECT)
+ return marker;
+ }
+ }
+
+ return NULL;
+}
+
/* ************* Marker Drawing ************ */
/* function to draw markers */
@@ -239,10 +261,11 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
/* vertical line - dotted */
#ifdef DURIAN_CAMERA_SWITCH
- if ((marker->camera) || (flag & DRAW_MARKERS_LINES)) {
+ if ((marker->camera) || (flag & DRAW_MARKERS_LINES))
#else
- if (flag & DRAW_MARKERS_LINES) {
+ if (flag & DRAW_MARKERS_LINES)
#endif
+ {
setlinestyle(3);
if (marker->flag & SELECT)
@@ -333,6 +356,84 @@ void draw_markers_time(const bContext *C, int flag)
}
}
+/* ************************ Marker Wrappers API ********************* */
+/* These wrappers allow marker operators to function within the confines
+ * of standard animation editors, such that they can coexist with the
+ * primary operations of those editors.
+ */
+
+/* maximum y-axis value (in region screen-space) that marker events should still be accepted for */
+#define ANIMEDIT_MARKER_YAXIS_MAX 30
+
+/* ------------------------ */
+
+/* special poll() which checks if there are selected markers first */
+static int ed_markers_poll_selected_markers(bContext *C)
+{
+ ListBase *markers = context_get_markers(C);
+
+ /* first things first: markers can only exist in timeline views */
+ if (ED_operator_animview_active(C) == 0)
+ return 0;
+
+ /* check if some marker is selected */
+ return ED_markers_get_first_selected(markers) != NULL;
+}
+
+/* ------------------------ */
+
+/* Second-tier invoke() callback that performs context validation before running the
+ * "custom"/third-tier invoke() callback supplied as the last arg (which would normally
+ * be the operator's invoke() callback elsewhere)
+ *
+ * < invoke_func: (fn(bContext*, wmOperator*, wmEvent*)=int) "standard" invoke function
+ * that operator would otherwise have used. If NULL, the operator's standard
+ * exec() callback will be called instead in the appropriate places.
+ */
+static int ed_markers_opwrap_invoke_custom(bContext *C, wmOperator *op, wmEvent *evt,
+ int (*invoke_func)(bContext*,wmOperator*,wmEvent*))
+{
+ ScrArea *sa = CTX_wm_area(C);
+ int retval = OPERATOR_PASS_THROUGH;
+
+ /* only timeline view doesn't need calling-location validation as it's the only dedicated view */
+ if (sa->spacetype != SPACE_TIME) {
+ /* restrict y-values to within ANIMEDIT_MARKER_YAXIS_MAX of the view's vertical extents, including scrollbars */
+ if (evt->mval[1] > ANIMEDIT_MARKER_YAXIS_MAX) {
+ /* not ok... "pass-through" to let normal editor's operators have a chance at tackling this event... */
+ //printf("MARKER-WRAPPER-DEBUG: event mval[1] = %d, so over accepted tolerance\n", evt->mval[1]);
+ return OPERATOR_CANCELLED|OPERATOR_PASS_THROUGH;
+ }
+ }
+
+ /* allow operator to run now */
+ if (invoke_func)
+ retval = invoke_func(C, op, evt);
+ else if (op->type->exec)
+ retval = op->type->exec(C, op);
+ else
+ BKE_report(op->reports, RPT_ERROR, "Programming error: operator doesn't actually have code to do anything!");
+
+ /* return status modifications - for now, make this spacetype dependent as above */
+ if (sa->spacetype != SPACE_TIME) {
+ /* unless successful, must add "pass-through" to let normal operator's have a chance at tackling this event */
+ if (retval != OPERATOR_FINISHED)
+ retval |= OPERATOR_PASS_THROUGH;
+ }
+
+ return retval;
+}
+
+/* standard wrapper - first-tier invoke() callback to be directly assigned to operator typedata
+ * for operators which don't need any special invoke calls. Any operators with special invoke calls
+ * though will need to implement their own wrapper which calls the second-tier callback themselves
+ * (passing through the custom invoke function they use)
+ */
+static int ed_markers_opwrap_invoke(bContext *C, wmOperator *op, wmEvent *evt)
+{
+ return ed_markers_opwrap_invoke_custom(C, op, evt, NULL);
+}
+
/* ************************** add markers *************************** */
/* add TimeMarker at curent frame */
@@ -376,6 +477,7 @@ static void MARKER_OT_add(wmOperatorType *ot)
/* api callbacks */
ot->exec= ed_marker_add;
+ ot->invoke = ed_markers_opwrap_invoke;
ot->poll= ED_operator_animview_active;
/* flags */
@@ -396,7 +498,7 @@ functions:
exit() cleanup, send notifier
- cancel() to escpae from modal
+ cancel() to escape from modal
callbacks:
@@ -488,6 +590,11 @@ static int ed_marker_move_invoke(bContext *C, wmOperator *op, wmEvent *evt)
return OPERATOR_CANCELLED;
}
+static int ed_marker_move_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+{
+ return ed_markers_opwrap_invoke_custom(C, op, evt, ed_marker_move_invoke);
+}
+
/* note, init has to be called succesfully */
static void ed_marker_move_apply(wmOperator *op)
{
@@ -665,9 +772,9 @@ static void MARKER_OT_move(wmOperatorType *ot)
/* api callbacks */
ot->exec= ed_marker_move_exec;
- ot->invoke= ed_marker_move_invoke;
+ ot->invoke= ed_marker_move_invoke_wrapper;
ot->modal= ed_marker_move_modal;
- ot->poll= ED_operator_animview_active;
+ ot->poll= ed_markers_poll_selected_markers;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
@@ -744,6 +851,11 @@ static int ed_marker_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *evt)
return ed_marker_move_invoke(C, op, evt);
}
+static int ed_marker_duplicate_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+{
+ return ed_markers_opwrap_invoke_custom(C, op, evt, ed_marker_duplicate_invoke);
+}
+
static void MARKER_OT_duplicate(wmOperatorType *ot)
{
/* identifiers */
@@ -753,9 +865,9 @@ static void MARKER_OT_duplicate(wmOperatorType *ot)
/* api callbacks */
ot->exec= ed_marker_duplicate_exec;
- ot->invoke= ed_marker_duplicate_invoke;
+ ot->invoke= ed_marker_duplicate_invoke_wrapper;
ot->modal= ed_marker_move_modal;
- ot->poll= ED_operator_animview_active;
+ ot->poll= ed_markers_poll_selected_markers;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -794,7 +906,7 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera)
float viewx;
int x, y, cfra;
- if(markers == NULL)
+ if (markers == NULL)
return OPERATOR_PASS_THROUGH;
x= evt->x - CTX_wm_region(C)->winrct.xmin;
@@ -811,27 +923,27 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera)
#ifdef DURIAN_CAMERA_SWITCH
- if(camera) {
+ if (camera) {
Scene *scene= CTX_data_scene(C);
Base *base;
TimeMarker *marker;
int sel= 0;
-
+
if (!extend)
scene_deselect_all(scene);
-
+
for (marker= markers->first; marker; marker= marker->next) {
if(marker->frame==cfra) {
sel= (marker->flag & SELECT);
break;
}
}
-
+
for (marker= markers->first; marker; marker= marker->next) {
- if(marker->camera) {
- if(marker->frame==cfra) {
+ if (marker->camera) {
+ if (marker->frame==cfra) {
base= object_in_scene(marker->camera, scene);
- if(base) {
+ if (base) {
ED_base_object_select(base, sel);
if(sel)
ED_base_object_activate(C, base);
@@ -839,7 +951,7 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera)
}
}
}
-
+
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
}
#endif
@@ -861,6 +973,11 @@ static int ed_marker_select_invoke(bContext *C, wmOperator *op, wmEvent *evt)
return ed_marker_select(C, evt, extend, camera);
}
+static int ed_marker_select_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+{
+ return ed_markers_opwrap_invoke_custom(C, op, evt, ed_marker_select_invoke);
+}
+
static void MARKER_OT_select(wmOperatorType *ot)
{
/* identifiers */
@@ -869,7 +986,7 @@ static void MARKER_OT_select(wmOperatorType *ot)
ot->idname= "MARKER_OT_select";
/* api callbacks */
- ot->invoke= ed_marker_select_invoke;
+ ot->invoke= ed_marker_select_invoke_wrapper;
ot->poll= ED_operator_animview_active;
/* flags */
@@ -917,24 +1034,18 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
UI_view2d_region_to_view(v2d, xmin, ymin, &xminf, &yminf);
UI_view2d_region_to_view(v2d, xmax, ymax, &xmaxf, &ymaxf);
- /* XXX disputable */
- if(yminf > 30.0f || ymaxf < 0.0f)
- return 0;
-
- if(markers == NULL)
+ if (markers == NULL)
return 0;
/* XXX marker context */
- for(marker= markers->first; marker; marker= marker->next) {
+ for (marker= markers->first; marker; marker= marker->next) {
if ((marker->frame > xminf) && (marker->frame <= xmaxf)) {
switch (gesture_mode) {
case GESTURE_MODAL_SELECT:
- if ((marker->flag & SELECT) == 0)
- marker->flag |= SELECT;
+ marker->flag |= SELECT;
break;
case GESTURE_MODAL_DESELECT:
- if (marker->flag & SELECT)
- marker->flag &= ~SELECT;
+ marker->flag &= ~SELECT;
break;
}
}
@@ -946,6 +1057,11 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
return 1;
}
+static int ed_marker_select_border_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+{
+ return ed_markers_opwrap_invoke_custom(C, op, evt, WM_border_select_invoke);
+}
+
static void MARKER_OT_select_border(wmOperatorType *ot)
{
/* identifiers */
@@ -955,7 +1071,7 @@ static void MARKER_OT_select_border(wmOperatorType *ot)
/* api callbacks */
ot->exec= ed_marker_border_select_exec;
- ot->invoke= WM_border_select_invoke;
+ ot->invoke= ed_marker_select_border_invoke_wrapper;
ot->modal= WM_border_select_modal;
ot->poll= ED_operator_animview_active;
@@ -975,17 +1091,11 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
TimeMarker *marker;
int action = RNA_enum_get(op->ptr, "action");
- if(markers == NULL)
+ if (markers == NULL)
return OPERATOR_CANCELLED;
if (action == SEL_TOGGLE) {
- action = SEL_SELECT;
- for(marker= markers->first; marker; marker= marker->next) {
- if(marker->flag & SELECT) {
- action = SEL_DESELECT;
- break;
- }
- }
+ action = (ED_markers_get_first_selected(markers) != NULL) ? SEL_DESELECT : SEL_SELECT;
}
for(marker= markers->first; marker; marker= marker->next) {
@@ -997,11 +1107,7 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
marker->flag &= ~SELECT;
break;
case SEL_INVERT:
- if (marker->flag & SELECT) {
- marker->flag &= ~SELECT;
- } else {
- marker->flag |= SELECT;
- }
+ marker->flag ^= SELECT;
break;
}
}
@@ -1021,6 +1127,7 @@ static void MARKER_OT_select_all(wmOperatorType *ot)
/* api callbacks */
ot->exec= ed_marker_select_all_exec;
+ ot->invoke = ed_markers_opwrap_invoke;
ot->poll= ED_operator_animview_active;
/* flags */
@@ -1030,7 +1137,7 @@ static void MARKER_OT_select_all(wmOperatorType *ot)
WM_operator_properties_select_all(ot);
}
-/* ******************************* remove marker ***************** */
+/* ***************** remove marker *********************** */
/* remove selected TimeMarkers */
static int ed_marker_delete_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1039,12 +1146,12 @@ static int ed_marker_delete_exec(bContext *C, wmOperator *UNUSED(op))
TimeMarker *marker, *nmarker;
short changed= 0;
- if(markers == NULL)
+ if (markers == NULL)
return OPERATOR_CANCELLED;
- for(marker= markers->first; marker; marker= nmarker) {
+ for (marker= markers->first; marker; marker= nmarker) {
nmarker= marker->next;
- if(marker->flag & SELECT) {
+ if (marker->flag & SELECT) {
BLI_freelinkN(markers, marker);
changed= 1;
}
@@ -1058,6 +1165,11 @@ static int ed_marker_delete_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
+static int ed_marker_delete_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+{
+ // XXX: must we keep these confirmations?
+ return ed_markers_opwrap_invoke_custom(C, op, evt, WM_operator_confirm);
+}
static void MARKER_OT_delete(wmOperatorType *ot)
{
@@ -1067,35 +1179,90 @@ static void MARKER_OT_delete(wmOperatorType *ot)
ot->idname= "MARKER_OT_delete";
/* api callbacks */
- ot->invoke= WM_operator_confirm;
+ ot->invoke= ed_marker_delete_invoke_wrapper;
ot->exec= ed_marker_delete_exec;
- ot->poll= ED_operator_animview_active;
+ ot->poll= ed_markers_poll_selected_markers;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+
+/* **************** rename marker ***************** */
+
+/* rename first selected TimeMarker */
+static int ed_marker_rename_exec(bContext *C, wmOperator *op)
+{
+ TimeMarker *marker= ED_markers_get_first_selected(context_get_markers(C));
+
+ if(marker) {
+ RNA_string_get(op->ptr, "name", marker->name);
+
+ WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
+
+ return OPERATOR_FINISHED;
+ }
+ else {
+ return OPERATOR_CANCELLED;
+ }
+}
+
+static int ed_marker_rename_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+{
+ /* must initialise the marker name first if there is a marker selected */
+ TimeMarker *marker = ED_markers_get_first_selected(context_get_markers(C));
+ if (marker)
+ RNA_string_set(op->ptr, "name", marker->name);
+ /* now see if the operator is usable */
+ return ed_markers_opwrap_invoke_custom(C, op, evt, WM_operator_props_popup);
}
+static void MARKER_OT_rename(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Rename Marker";
+ ot->description= "Rename first selected time marker";
+ ot->idname= "MARKER_OT_rename";
+
+ /* api callbacks */
+ ot->invoke= ed_marker_rename_invoke_wrapper;
+ ot->exec= ed_marker_rename_exec;
+ ot->poll= ed_markers_poll_selected_markers;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* properties */
+ ot->prop = RNA_def_string(ot->srna, "name", "RenamedMarker", sizeof(((TimeMarker *)NULL)->name), "Name", "New name for marker");
+ //RNA_def_boolean(ot->srna, "ensure_unique", 0, "Ensure Unique", "Ensure that new name is unique within collection of markers");
+}
+
+/* **************** make links to scene ***************** */
+
static int ed_marker_make_links_scene_exec(bContext *C, wmOperator *op)
{
ListBase *markers= context_get_markers(C);
Scene *scene_to= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
TimeMarker *marker, *marker_new;
- if(scene_to==NULL) {
+ if (scene_to==NULL) {
BKE_report(op->reports, RPT_ERROR, "Scene not found");
return OPERATOR_CANCELLED;
}
- if(scene_to == CTX_data_scene(C)) {
- BKE_report(op->reports, RPT_ERROR, "Can't link objects into the same scene");
+ if (scene_to == CTX_data_scene(C)) {
+ BKE_report(op->reports, RPT_ERROR, "Can't re-link markers into the same scene");
return OPERATOR_CANCELLED;
}
/* copy markers */
for (marker= markers->first; marker; marker= marker->next) {
- if(marker->flag & SELECT) {
+ if (marker->flag & SELECT) {
marker_new= MEM_dupallocN(marker);
+ marker_new->prev= marker_new->next = NULL;
+
BLI_addtail(&scene_to->markers, marker_new);
}
}
@@ -1109,12 +1276,13 @@ static void MARKER_OT_make_links_scene(wmOperatorType *ot)
/* identifiers */
ot->name= "Make Links to Scene";
- ot->description= "Link markers to another scene";
+ ot->description= "Copy selected markers to another scene";
ot->idname= "MARKER_OT_make_links_scene";
/* api callbacks */
ot->exec= ed_marker_make_links_scene_exec;
- ot->poll= ED_operator_animview_active;
+ ot->invoke = ed_markers_opwrap_invoke;
+ ot->poll= ed_markers_poll_selected_markers;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1163,7 +1331,8 @@ static void MARKER_OT_camera_bind(wmOperatorType *ot)
/* api callbacks */
ot->exec= ed_marker_camera_bind_exec;
- ot->poll= ED_operator_animview_active;
+ ot->invoke = ed_markers_opwrap_invoke;
+ ot->poll= ed_markers_poll_selected_markers;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1182,6 +1351,7 @@ void ED_operatortypes_marker(void)
WM_operatortype_append(MARKER_OT_select_border);
WM_operatortype_append(MARKER_OT_select_all);
WM_operatortype_append(MARKER_OT_delete);
+ WM_operatortype_append(MARKER_OT_rename);
WM_operatortype_append(MARKER_OT_make_links_scene);
#ifdef DURIAN_CAMERA_SWITCH
WM_operatortype_append(MARKER_OT_camera_bind);
@@ -1213,6 +1383,7 @@ void ED_marker_keymap(wmKeyConfig *keyconf)
WM_keymap_verify_item(keymap, "MARKER_OT_select_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "MARKER_OT_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "MARKER_OT_delete", DELKEY, KM_PRESS, 0, 0);
+ WM_keymap_verify_item(keymap, "MARKER_OT_rename", MKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "MARKER_OT_move", GKEY, KM_PRESS, 0, 0);
#ifdef DURIAN_CAMERA_SWITCH
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index ba5a53e6d7a..6b0fa30b096 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -31,6 +31,8 @@
#include "BLO_sys_types.h"
+#include "BLI_utildefines.h"
+
#include "DNA_anim_types.h"
#include "DNA_scene_types.h"
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index 902fa2f789f..c6c333755b0 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -32,6 +32,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index 7642f63b531..b47fea58633 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -43,6 +43,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 548d06993e7..93808233288 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -39,6 +39,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_dlrbTree.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
@@ -47,6 +48,7 @@
#include "DNA_scene_types.h"
#include "DNA_key_types.h"
#include "DNA_lamp_types.h"
+#include "DNA_lattice_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_mesh_types.h"
#include "DNA_material_types.h"
@@ -59,7 +61,7 @@
#include "BKE_key.h"
#include "BKE_material.h"
#include "BKE_global.h" // XXX remove me!
-#include "BKE_utildefines.h"
+
#include "BIF_gl.h"
@@ -775,6 +777,8 @@ void ob_to_keylist(bDopeSheet *ads, Object *ob, DLRBT_Tree *keys, DLRBT_Tree *bl
/* add material's data */
action_to_keylist(ma->adt, ma->adt->action, keys, blocks);
+
+ // TODO: textures...
}
}
@@ -830,6 +834,14 @@ void ob_to_keylist(bDopeSheet *ads, Object *ob, DLRBT_Tree *keys, DLRBT_Tree *bl
action_to_keylist(me->adt, me->adt->action, keys, blocks);
}
break;
+ case OB_LATTICE: /* ------- Lattice ---------- */
+ {
+ Lattice *lt= (Lattice *)ob->data;
+
+ if ((lt->adt) && !(filterflag & ADS_FILTER_NOLAT))
+ action_to_keylist(lt->adt, lt->adt->action, keys, blocks);
+ }
+ break;
}
/* Add Particle System Keyframes */
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index a1c02f922f2..ca056b61efa 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -33,12 +33,14 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_camera_types.h"
#include "DNA_key_types.h"
#include "DNA_lamp_types.h"
+#include "DNA_lattice_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_mesh_types.h"
#include "DNA_material_types.h"
@@ -52,7 +54,7 @@
#include "BKE_fcurve.h"
#include "BKE_key.h"
#include "BKE_material.h"
-#include "BKE_utildefines.h"
+
#include "ED_anim_api.h"
#include "ED_keyframes_edit.h"
@@ -319,6 +321,16 @@ static short ob_keyframes_loop(KeyframeEditData *ked, Object *ob, KeyframeEditFu
}
}
break;
+ case OB_LATTICE: /* ---- Lattice ------ */
+ {
+ Lattice *lt= (Lattice *)ob->data;
+
+ if ((lt->adt) && !(filterflag & ADS_FILTER_NOLAT)) {
+ if (adt_keyframes_loop(ked, lt->adt, key_ok, key_cb, fcu_cb, filterflag))
+ return 1;
+ }
+ }
+ break;
}
/* Add Particle System Keyframes */
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index e8509a1bbc2..92fce2a77e5 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -34,6 +34,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_object_types.h"
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index e588a3610d8..726c898e843 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -38,6 +38,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_dynstr.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
@@ -72,6 +73,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
+#include "RNA_enum_types.h"
#include "anim_intern.h"
@@ -1074,7 +1076,7 @@ static int insert_key_exec (bContext *C, wmOperator *op)
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
KeyingSet *ks= NULL;
- int type= RNA_int_get(op->ptr, "type");
+ int type= RNA_enum_get(op->ptr, "type");
float cfra= (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
short success;
@@ -1139,11 +1141,12 @@ void ANIM_OT_keyframe_insert (wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- /* keyingset to use
- * - here the type is int not enum, since many of the indicies here are determined dynamically
- */
- prop= RNA_def_int(ot->srna, "type", 0, INT_MIN, INT_MAX, "Keying Set Number", "Index (determined internally) of the Keying Set to use", 0, 1);
+ /* keyingset to use (dynamic enum) */
+ prop= RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
+ RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
RNA_def_property_flag(prop, PROP_HIDDEN);
+ ot->prop= prop;
+
/* confirm whether a keyframe was added by showing a popup
* - by default, this is enabled, since this operator is assumed to be called independently
*/
@@ -1168,7 +1171,7 @@ static int insert_key_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(
}
else {
/* just call the exec() on the active keyingset */
- RNA_int_set(op->ptr, "type", 0);
+ RNA_enum_set(op->ptr, "type", 0);
RNA_boolean_set(op->ptr, "confirm_success", 1);
return op->type->exec(C, op);
@@ -1192,17 +1195,19 @@ void ANIM_OT_keyframe_insert_menu (wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- /* keyingset to use
- * - here the type is int not enum, since many of the indicies here are determined dynamically
- */
- prop= RNA_def_int(ot->srna, "type", 0, INT_MIN, INT_MAX, "Keying Set Number", "Index (determined internally) of the Keying Set to use", 0, 1);
+ /* keyingset to use (dynamic enum) */
+ prop= RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
+ RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
RNA_def_property_flag(prop, PROP_HIDDEN);
+ ot->prop= prop;
+
/* confirm whether a keyframe was added by showing a popup
* - by default, this is disabled so that if a menu is shown, this doesn't come up too
*/
// XXX should this just be always on?
prop= RNA_def_boolean(ot->srna, "confirm_success", 0, "Confirm Successful Insert", "Show a popup when the keyframes get successfully added");
RNA_def_property_flag(prop, PROP_HIDDEN);
+
/* whether the menu should always be shown
* - by default, the menu should only be shown when there is no active Keying Set (2.5 behaviour),
* although in some cases it might be useful to always shown (pre 2.5 behaviour)
@@ -1218,7 +1223,7 @@ static int delete_key_exec (bContext *C, wmOperator *op)
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
KeyingSet *ks= NULL;
- int type= RNA_int_get(op->ptr, "type");
+ int type= RNA_enum_get(op->ptr, "type");
float cfra= (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
short success;
@@ -1269,6 +1274,8 @@ static int delete_key_exec (bContext *C, wmOperator *op)
void ANIM_OT_keyframe_delete (wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
ot->name= "Delete Keyframe";
ot->idname= "ANIM_OT_keyframe_delete";
@@ -1281,10 +1288,12 @@ void ANIM_OT_keyframe_delete (wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- /* keyingset to use
- * - here the type is int not enum, since many of the indicies here are determined dynamically
- */
- RNA_def_int(ot->srna, "type", 0, INT_MIN, INT_MAX, "Keying Set Number", "Index (determined internally) of the Keying Set to use", 0, 1);
+ /* keyingset to use (dynamic enum) */
+ prop= RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
+ RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
+ RNA_def_property_flag(prop, PROP_HIDDEN);
+ ot->prop= prop;
+
/* confirm whether a keyframe was added by showing a popup
* - by default, this is enabled, since this operator is assumed to be called independently
*/
@@ -1407,7 +1416,7 @@ static int insert_key_button_exec (bContext *C, wmOperator *op)
}
else if (G.f & G_DEBUG) {
printf("ptr.data = %p, prop = %p,", (void *)ptr.data, (void *)prop);
- if(prop)
+ if (prop)
printf("animateable = %d \n", RNA_property_animateable(&ptr, prop));
else
printf("animateable = NULL \n");
@@ -1416,7 +1425,7 @@ static int insert_key_button_exec (bContext *C, wmOperator *op)
if (success) {
/* send updates */
uiContextAnimUpdate(C);
-
+
DAG_ids_flush_update(bmain, 0);
/* send notifiers that keyframes have been changed */
@@ -1488,7 +1497,7 @@ static int delete_key_button_exec (bContext *C, wmOperator *op)
if (success) {
/* send updates */
uiContextAnimUpdate(C);
-
+
DAG_ids_flush_update(bmain, 0);
/* send notifiers that keyframes have been changed */
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index d0e7d8be769..51b00cc0086 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -38,6 +38,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_dynstr.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_scene_types.h"
@@ -59,6 +60,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
+#include "RNA_enum_types.h"
#include "anim_intern.h"
@@ -417,12 +419,9 @@ static int remove_keyingset_button_exec (bContext *C, wmOperator *op)
/* try to find a path matching this description */
ksp= BKE_keyingset_find_path(ks, ptr.id.data, ks->name, path, index, KSP_GROUP_KSNAME);
-
+
if (ksp) {
- /* just free it... */
- MEM_freeN(ksp->rna_path);
- BLI_freelinkN(&ks->paths, ksp);
-
+ BKE_keyingset_free_path(ks, ksp);
success= 1;
}
@@ -691,6 +690,67 @@ KeyingSet *ANIM_get_keyingset_for_autokeying(Scene *scene, const char *tranformK
/* Menu of All Keying Sets ----------------------------- */
+/* Dynamically populate an enum of Keying Sets */
+EnumPropertyItem *ANIM_keying_sets_enum_itemf (bContext *C, PointerRNA *UNUSED(ptr), int *free)
+{
+ Scene *scene = CTX_data_scene(C);
+ KeyingSet *ks;
+ EnumPropertyItem *item= NULL, item_tmp= {0};
+ int totitem= 0;
+ int i= 0;
+
+ if (C == NULL) {
+ return DummyRNA_DEFAULT_items;
+ }
+
+ /* active Keying Set
+ * - only include entry if it exists
+ */
+ if (scene->active_keyingset) {
+ /* active Keying Set */
+ item_tmp.identifier= item_tmp.name= "Active Keying Set";
+ item_tmp.value= i++;
+ RNA_enum_item_add(&item, &totitem, &item_tmp);
+
+ /* separator */
+ RNA_enum_item_add_separator(&item, &totitem);
+ }
+ else
+ i++;
+
+ /* user-defined Keying Sets
+ * - these are listed in the order in which they were defined for the active scene
+ */
+ if (scene->keyingsets.first) {
+ for (ks= scene->keyingsets.first; ks; ks= ks->next) {
+ if (ANIM_keyingset_context_ok_poll(C, ks)) {
+ item_tmp.identifier= item_tmp.name= ks->name;
+ item_tmp.value= i++;
+ RNA_enum_item_add(&item, &totitem, &item_tmp);
+ }
+ }
+
+ /* separator */
+ RNA_enum_item_add_separator(&item, &totitem);
+ }
+
+ /* builtin Keying Sets */
+ i= -1;
+ for (ks= builtin_keyingsets.first; ks; ks= ks->next) {
+ /* only show KeyingSet if context is suitable */
+ if (ANIM_keyingset_context_ok_poll(C, ks)) {
+ item_tmp.identifier= item_tmp.name= ks->name;
+ item_tmp.value= i--;
+ RNA_enum_item_add(&item, &totitem, &item_tmp);
+ }
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *free= 1;
+
+ return item;
+}
+
/* Create (and show) a menu containing all the Keying Sets which can be used in the current context */
void ANIM_keying_sets_menu_setup (bContext *C, const char title[], const char op_name[])
{