forked from bartvdbraak/blender
Animation data for lattices is now shown in the Animaton Editors
This commit is contained in:
parent
95dcf11a88
commit
09852b9a58
@ -57,6 +57,8 @@ def dopesheet_filter(layout, context):
|
||||
row.prop(dopesheet, "show_curves", text="")
|
||||
if bpy.data.metaballs:
|
||||
row.prop(dopesheet, "show_metaballs", text="")
|
||||
if bpy.data.lattices:
|
||||
row.prop(dopesheet, "show_lattices", text="")
|
||||
if bpy.data.armatures:
|
||||
row.prop(dopesheet, "show_armatures", text="")
|
||||
if bpy.data.particles:
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -153,6 +153,7 @@ typedef enum eAnim_ChannelType {
|
||||
ANIMTYPE_DSARM,
|
||||
ANIMTYPE_DSMESH,
|
||||
ANIMTYPE_DSTEX,
|
||||
ANIMTYPE_DSLAT,
|
||||
|
||||
ANIMTYPE_SHAPEKEY,
|
||||
|
||||
@ -230,6 +231,8 @@ typedef enum eAnimFilter_Flags {
|
||||
#define FILTER_MBALL_OBJD(mb) ((mb->flag2 & MB_DS_EXPAND))
|
||||
#define FILTER_ARM_OBJD(arm) ((arm->flag & ARM_DS_EXPAND))
|
||||
#define FILTER_MESH_OBJD(me) ((me->flag & ME_DS_EXPAND))
|
||||
#define FILTER_LATTICE_OBJD(lt) ((lt->flag & LT_DS_EXPAND))
|
||||
|
||||
/* 'Sub-object/Action' channels (flags stored in Action) */
|
||||
#define SEL_ACTC(actc) ((actc->flag & ACT_SELECTED))
|
||||
#define EXPANDED_ACTC(actc) ((actc->flag & ACT_COLLAPSED)==0)
|
||||
|
@ -173,6 +173,7 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
|
||||
case ANIMTYPE_DSARM:
|
||||
case ANIMTYPE_DSMESH:
|
||||
case ANIMTYPE_DSTEX:
|
||||
case ANIMTYPE_DSLAT:
|
||||
{
|
||||
/* sanity checking... */
|
||||
if (ale->adt) {
|
||||
|
@ -530,7 +530,7 @@ typedef enum eDopeSheet_FilterFlag {
|
||||
ADS_FILTER_NOSHAPEKEYS = (1<<6),
|
||||
ADS_FILTER_NOMESH = (1<<7),
|
||||
ADS_FILTER_NOOBJ = (1<<8), /* for animdata on object level, if we only want to concentrate on materials/etc. */
|
||||
// NOTE: there are a few more spaces for datablock filtering here...
|
||||
ADS_FILTER_NOLAT = (1<<9),
|
||||
ADS_FILTER_NOCAM = (1<<10),
|
||||
ADS_FILTER_NOMAT = (1<<11),
|
||||
ADS_FILTER_NOLAM = (1<<12),
|
||||
|
@ -77,5 +77,7 @@ typedef struct Lattice {
|
||||
#define LT_GRID 1
|
||||
#define LT_OUTSIDE 2
|
||||
|
||||
#define LT_DS_EXPAND 4
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -235,6 +235,12 @@ static void rna_def_dopesheet(BlenderRNA *brna)
|
||||
RNA_def_property_ui_icon(prop, ICON_MESH_DATA, 0);
|
||||
RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
|
||||
|
||||
prop= RNA_def_property(srna, "show_lattices", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOLAT);
|
||||
RNA_def_property_ui_text(prop, "Display Lattices", "Include visualization of Lattice related Animation data");
|
||||
RNA_def_property_ui_icon(prop, ICON_LATTICE_DATA, 0);
|
||||
RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
|
||||
|
||||
prop= RNA_def_property(srna, "show_cameras", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOCAM);
|
||||
RNA_def_property_ui_text(prop, "Display Camera", "Include visualization of Camera related Animation data");
|
||||
|
Loading…
Reference in New Issue
Block a user