diff options
author | Joshua Leung <aligorith@gmail.com> | 2011-01-05 03:37:21 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2011-01-05 03:37:21 +0300 |
commit | 09852b9a58e49cf1c33af59a88d5dac9bbfc8697 (patch) | |
tree | 997122794671d36ec49ad679f19658ca171bb37f /source/blender/editors/animation | |
parent | 95dcf11a8865f4b3da98066175b88e5810d0fec6 (diff) |
Animation data for lattices is now shown in the Animaton Editors
Diffstat (limited to 'source/blender/editors/animation')
4 files changed, 144 insertions, 0 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 4781223b3ac..7322eb8ac13 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -42,6 +42,7 @@ #include "DNA_space_types.h" #include "DNA_key_types.h" #include "DNA_lamp_types.h" +#include "DNA_lattice_types.h" #include "DNA_mesh_types.h" #include "DNA_material_types.h" #include "DNA_meta_types.h" @@ -2234,6 +2235,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 */ @@ -2490,6 +2567,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_SHAPEKEY; /* ShapeKey */ diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 4c022e38d26..d3dd8088949 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -114,6 +114,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 +159,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 +237,7 @@ void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype, case ANIMTYPE_DSMESH: case ANIMTYPE_DSNTREE: case ANIMTYPE_DSTEX: + case ANIMTYPE_DSLAT: { if ((ale->adt) && (ale->adt->flag & ADT_UI_SELECTED)) sel= ACHANNEL_SETFLAG_CLEAR; @@ -317,6 +321,7 @@ void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype, case ANIMTYPE_DSMESH: case ANIMTYPE_DSNTREE: case ANIMTYPE_DSTEX: + case ANIMTYPE_DSLAT: { /* need to verify that this data is valid for now */ if (ale->adt) { @@ -1938,6 +1943,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: { /* sanity checking... */ if (ale->adt) { diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 791955dcfba..e3669dd1077 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -626,6 +626,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; @@ -1583,6 +1596,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 */ @@ -1841,6 +1862,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); @@ -2354,6 +2388,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/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index ece19d422cc..aefb853cc5f 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -47,6 +47,7 @@ #include "DNA_scene_types.h" #include "DNA_key_types.h" #include "DNA_lamp_types.h" +#include "DNA_lattice_types.h" #include "DNA_mesh_types.h" #include "DNA_material_types.h" #include "DNA_meta_types.h" @@ -812,6 +813,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 */ |