diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-12-28 03:52:31 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-12-28 03:52:31 +0300 |
commit | be55097353069b56a2726ebfe87bb2dd0a4b46a6 (patch) | |
tree | 1b0caa1ad22c6a3a79b71a419379ec6cd451b95d /source/blender/editors/animation | |
parent | ff31d2d65cd6ab8bff2dc45939a8e7a2dab57c86 (diff) |
Mesh Animation + Depsgraph Tweaks:
* Mesh data/settings can now be animated. It is not recommended that geometry be animated directly, but other settings such as autosmooth, etc. can be...
* Code cleanups for depsgraph, making sure that drivers get included for all object data types.
Diffstat (limited to 'source/blender/editors/animation')
5 files changed, 156 insertions, 0 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 5398238a43b..aa0fcab3e36 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -53,6 +53,7 @@ #include "DNA_constraint_types.h" #include "DNA_key_types.h" #include "DNA_lamp_types.h" +#include "DNA_mesh_types.h" #include "DNA_material_types.h" #include "DNA_meta_types.h" #include "DNA_node_types.h" @@ -1820,6 +1821,78 @@ static bAnimChannelType ACF_DSNTREE= acf_dsntree_setting_ptr /* pointer for setting */ }; +/* Mesh Expander ------------------------------------------- */ + +// TODO: just get this from RNA? +static int acf_dsmesh_icon(bAnimListElem *ale) +{ + return ICON_MESH_DATA; +} + +/* get the appropriate flag(s) for the setting when it is valid */ +static int acf_dsmesh_setting_flag(int setting, short *neg) +{ + /* clear extra return data first */ + *neg= 0; + + switch (setting) { + case ACHANNEL_SETTING_EXPAND: /* expanded */ + return ME_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_dsmesh_setting_ptr(bAnimListElem *ale, int setting, short *type) +{ + Mesh *me= (Mesh *)ale->data; + + /* clear extra return data first */ + *type= 0; + + switch (setting) { + case ACHANNEL_SETTING_EXPAND: /* expanded */ + GET_ACF_FLAG_PTR(me->flag); + + case ACHANNEL_SETTING_SELECT: /* selected */ + case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */ + case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ + if (me->adt) + GET_ACF_FLAG_PTR(me->adt->flag) + else + return NULL; + + default: /* unsupported */ + return NULL; + } +} + +/* node tree expander type define */ +static bAnimChannelType ACF_DSMESH= +{ + 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_dsmesh_icon, /* icon */ + + acf_generic_dataexpand_setting_valid, /* has setting */ + acf_dsmesh_setting_flag, /* flag for setting */ + acf_dsmesh_setting_ptr /* pointer for setting */ +}; /* ShapeKey Entry ------------------------------------------- */ @@ -2071,6 +2144,7 @@ void ANIM_init_channel_typeinfo_data (void) animchannelTypeInfo[type++]= &ACF_DSPART; /* Particle Channel */ animchannelTypeInfo[type++]= &ACF_DSMBALL; /* MetaBall Channel */ animchannelTypeInfo[type++]= &ACF_DSARM; /* Armature Channel */ + animchannelTypeInfo[type++]= &ACF_DSMESH; /* Mesh 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 0c77c2b0010..ebb3136d530 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -142,6 +142,7 @@ void ANIM_set_active_channel (bAnimContext *ac, void *data, short datatype, int case ANIMTYPE_DSPART: case ANIMTYPE_DSMBALL: case ANIMTYPE_DSARM: + case ANIMTYPE_DSMESH: { /* need to verify that this data is valid for now */ if (ale->adt) { @@ -184,6 +185,7 @@ void ANIM_set_active_channel (bAnimContext *ac, void *data, short datatype, int case ANIMTYPE_DSPART: case ANIMTYPE_DSMBALL: case ANIMTYPE_DSARM: + case ANIMTYPE_DSMESH: { /* need to verify that this data is valid for now */ if (ale->adt) @@ -257,6 +259,7 @@ void ANIM_deselect_anim_channels (void *data, short datatype, short test, short case ANIMTYPE_DSPART: case ANIMTYPE_DSMBALL: case ANIMTYPE_DSARM: + case ANIMTYPE_DSMESH: { if ((ale->adt) && (ale->adt->flag & ADT_UI_SELECTED)) sel= ACHANNEL_SETFLAG_CLEAR; @@ -337,6 +340,7 @@ void ANIM_deselect_anim_channels (void *data, short datatype, short test, short case ANIMTYPE_DSPART: case ANIMTYPE_DSMBALL: case ANIMTYPE_DSARM: + case ANIMTYPE_DSMESH: { /* need to verify that this data is valid for now */ if (ale->adt) { @@ -1651,6 +1655,7 @@ static int mouse_anim_channels (bAnimContext *ac, float x, int channel_index, sh case ANIMTYPE_DSPART: case ANIMTYPE_DSMBALL: case ANIMTYPE_DSARM: + case ANIMTYPE_DSMESH: { /* sanity checking... */ if (ale->adt) { diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 392f435d017..0b63dd73cda 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -616,6 +616,19 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s ale->adt= BKE_animdata_from_id(data); } break; + case ANIMTYPE_DSMESH: + { + Mesh *me= (Mesh *)data; + AnimData *adt= me->adt; + + ale->flag= FILTER_MESH_OBJD(me); + + 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; @@ -1348,6 +1361,14 @@ static int animdata_filter_dopesheet_obdata (ListBase *anim_data, bDopeSheet *ad expanded= FILTER_ARM_OBJD(arm); } break; + case OB_MESH: /* ------- Mesh ---------- */ + { + Mesh *me= (Mesh *)ob->data; + + type= ANIMTYPE_DSMESH; + expanded= FILTER_MESH_OBJD(me); + } + break; } /* special exception for drivers instead of action */ @@ -1582,6 +1603,19 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B } } break; + case OB_MESH: /* ------- Mesh ---------- */ + { + Mesh *me= (Mesh *)ob->data; + + if ((ads->filterflag & ADS_FILTER_NOMESH) == 0) { + ANIMDATA_FILTER_CASES(me, + { /* AnimData blocks - do nothing... */ }, + obdata_ok= 1;, + obdata_ok= 1;, + obdata_ok= 1;) + } + } + break; } if (obdata_ok) items += animdata_filter_dopesheet_obdata(anim_data, ads, base, filter_mode); @@ -2018,6 +2052,23 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bAnimContext *ac, bDo dataOk= !(ads->filterflag & ADS_FILTER_NOARM);) } break; + case OB_MESH: /* ------- Mesh ---------- */ + { + Mesh *me= (Mesh *)ob->data; + dataOk= 0; + ANIMDATA_FILTER_CASES(me, + if ((ads->filterflag & ADS_FILTER_NOMESH)==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(me); + dataOk=0; + }, + dataOk= !(ads->filterflag & ADS_FILTER_NOMESH);, + dataOk= !(ads->filterflag & ADS_FILTER_NOMESH);, + dataOk= !(ads->filterflag & ADS_FILTER_NOMESH);) + } + break; default: /* --- other --- */ dataOk= 0; break; @@ -2108,6 +2159,12 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bAnimContext *ac, bDo dataOk= ANIMDATA_HAS_KEYS(arm); } break; + case OB_MESH: /* -------- Mesh ---------- */ + { + Mesh *me= (Mesh *)ob->data; + dataOk= ANIMDATA_HAS_KEYS(me); + } + break; default: /* --- other --- */ dataOk= 0; break; diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index 631cec87c96..42fe9160946 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -56,6 +56,7 @@ #include "DNA_space_types.h" #include "DNA_key_types.h" #include "DNA_lamp_types.h" +#include "DNA_mesh_types.h" #include "DNA_material_types.h" #include "DNA_meta_types.h" #include "DNA_node_types.h" @@ -822,6 +823,14 @@ void ob_to_keylist(bDopeSheet *ads, Object *ob, DLRBT_Tree *keys, DLRBT_Tree *bl action_to_keylist(arm->adt, arm->adt->action, keys, blocks); } break; + case OB_MESH: /* ------- Mesh ---------- */ + { + Mesh *me= (Mesh *)ob->data; + + if ((me->adt) && !(filterflag & ADS_FILTER_NOMESH)) + action_to_keylist(me->adt, me->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 039041d1efd..b3b0d6308a7 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -41,6 +41,7 @@ #include "DNA_curve_types.h" #include "DNA_key_types.h" #include "DNA_lamp_types.h" +#include "DNA_mesh_types.h" #include "DNA_material_types.h" #include "DNA_object_types.h" #include "DNA_meta_types.h" @@ -285,6 +286,16 @@ static short ob_keys_bezier_loop(BeztEditData *bed, Object *ob, BeztEditFunc bez } } break; + case OB_MESH: /* ------- Mesh ---------- */ + { + Mesh *me= (Mesh *)ob->data; + + if ((me->adt) && !(filterflag & ADS_FILTER_NOMESH)) { + if (adt_keys_bezier_loop(bed, me->adt, bezt_ok, bezt_cb, fcu_cb, filterflag)) + return 1; + } + } + break; } /* Add Particle System Keyframes */ |