diff options
Diffstat (limited to 'source/blender')
18 files changed, 179 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 7278fee5ab8..560ae76e4d1 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -71,7 +71,7 @@ static short id_has_animdata (ID *id) switch (GS(id->name)) { /* has AnimData */ case ID_OB: - case ID_CU: + case ID_MB: case ID_CU: case ID_KE: case ID_PA: case ID_MA: case ID_TE: case ID_NT: @@ -1442,6 +1442,9 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime) // TODO: we probably need the same hack as for curves (ctime-hack) EVAL_ANIM_IDS(main->key.first, ADT_RECALC_ANIM); + /* metaballs */ + EVAL_ANIM_IDS(main->mball.first, ADT_RECALC_ANIM); + /* curves */ /* we need to perform a special hack here to ensure that the ctime * value of the curve gets set in case there's no animation for that diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 74d56e81a87..c7058d7d8db 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -55,6 +55,7 @@ #include "BKE_main.h" /* #include "BKE_object.h" */ +#include "BKE_animsys.h" #include "BKE_scene.h" #include "BKE_blender.h" #include "BKE_library.h" @@ -90,6 +91,7 @@ void free_mball(MetaBall *mb) { unlink_mball(mb); + if(mb->adt) BKE_free_animdata((ID *)mb); if(mb->mat) MEM_freeN(mb->mat); if(mb->bb) MEM_freeN(mb->bb); BLI_freelistN(&mb->elems); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 876b07eef89..8dde100dff2 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2488,7 +2488,8 @@ static void lib_link_mball(FileData *fd, Main *main) mb= main->mball.first; while(mb) { if(mb->id.flag & LIB_NEEDLINK) { - + if (mb->adt) lib_link_animdata(fd, &mb->id, mb->adt); + for(a=0; a<mb->totcol; a++) mb->mat[a]= newlibadr_us(fd, mb->id.lib, mb->mat[a]); mb->ipo= newlibadr_us(fd, mb->id.lib, mb->ipo); // XXX depreceated - old animation system @@ -2501,6 +2502,9 @@ static void lib_link_mball(FileData *fd, Main *main) static void direct_link_mball(FileData *fd, MetaBall *mb) { + mb->adt= newdataadr(fd, mb->adt); + direct_link_animdata(fd, mb->adt); + mb->mat= newdataadr(fd, mb->mat); test_pointer_array(fd, (void **)&mb->mat); @@ -9946,6 +9950,9 @@ static void expand_mball(FileData *fd, Main *mainvar, MetaBall *mb) for(a=0; a<mb->totcol; a++) { expand_doit(fd, mainvar, mb->mat[a]); } + + if(mb->adt) + expand_animdata(fd, mainvar, mb->adt); } static void expand_curve(FileData *fd, Main *mainvar, Curve *cu) diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index da68132700d..05ea60b50df 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1297,6 +1297,7 @@ static void write_mballs(WriteData *wd, ListBase *idbase) /* direct data */ writedata(wd, DATA, sizeof(void *)*mb->totcol, mb->mat); + if (mb->adt) write_animdata(wd, mb->adt); ml= mb->elems.first; while(ml) { diff --git a/source/blender/editors/animation/anim_channels.c b/source/blender/editors/animation/anim_channels.c index f518b5b0a2e..235a3039b2c 100644 --- a/source/blender/editors/animation/anim_channels.c +++ b/source/blender/editors/animation/anim_channels.c @@ -56,6 +56,7 @@ #include "DNA_key_types.h" #include "DNA_lamp_types.h" #include "DNA_material_types.h" +#include "DNA_meta_types.h" #include "DNA_userdef_types.h" #include "DNA_gpencil_types.h" #include "DNA_windowmanager_types.h" @@ -1066,7 +1067,7 @@ static void setflag_anim_channels (bAnimContext *ac, short setting, short mode, case ANIMTYPE_DSPART: { ParticleSettings *part= (ParticleSettings*)ale->data; - + if (ASUBCHANNEL_SEL_OK(ale)) { if (setting == ACHANNEL_SETTING_EXPAND) { ACHANNEL_SET_FLAG(part, mode, PART_DS_EXPAND); @@ -1074,6 +1075,17 @@ static void setflag_anim_channels (bAnimContext *ac, short setting, short mode, } } break; + case ANIMTYPE_DSMBALL: + { + MetaBall *mb= (MetaBall *)ale->data; + + if (ASUBCHANNEL_SEL_OK(ale)) { + if (setting == ACHANNEL_SETTING_EXPAND) { + ACHANNEL_SET_FLAG(mb, mode, MB_DS_EXPAND); + } + } + } + break; case ANIMTYPE_GROUP: { @@ -1688,6 +1700,13 @@ static int mouse_anim_channels (bAnimContext *ac, float x, int channel_index, sh notifierFlags |= ND_ANIMCHAN_EDIT; } break; + case ANIMTYPE_DSMBALL: + { + MetaBall *mb= (MetaBall *)ale->data; + mb->flag2 ^= MB_DS_EXPAND; + notifierFlags |= ND_ANIMCHAN_EDIT; + } + break; case ANIMTYPE_GROUP: { diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 4e479bd75d0..4797c7946a4 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -62,6 +62,7 @@ #include "DNA_key_types.h" #include "DNA_material_types.h" #include "DNA_mesh_types.h" +#include "DNA_meta_types.h" #include "DNA_object_types.h" #include "DNA_particle_types.h" #include "DNA_space_types.h" @@ -1090,6 +1091,14 @@ static int animdata_filter_dopesheet_obdata (ListBase *anim_data, bDopeSheet *ad expanded= FILTER_CUR_OBJD(cu); } break; + case OB_MBALL: /* ------- MetaBall ---------- */ + { + MetaBall *mb= (MetaBall *)ob->data; + + type= ANIMTYPE_DSMBALL; + expanded= FILTER_MBALL_OBJD(mb); + } + break; } /* special exception for drivers instead of action */ @@ -1273,12 +1282,25 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B } } break; + case OB_MBALL: /* ------- MetaBall ---------- */ + { + MetaBall *mb= (MetaBall *)ob->data; + + if ((ads->filterflag & ADS_FILTER_NOMBA) == 0) { + ANIMDATA_FILTER_CASES(mb, + { /* 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); /* particles */ - if(ob->particlesystem.first && !(ads->filterflag & ADS_FILTER_NOPART)) + if (ob->particlesystem.first && !(ads->filterflag & ADS_FILTER_NOPART)) items += animdata_filter_dopesheet_particles(anim_data, ads, base, filter_mode); /* return the number of items added to the list */ @@ -1595,6 +1617,23 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int dataOk= !(ads->filterflag & ADS_FILTER_NOCUR);) } break; + case OB_MBALL: /* ------- MetaBall ---------- */ + { + MetaBall *mb= (MetaBall *)ob->data; + dataOk= 0; + ANIMDATA_FILTER_CASES(mb, + if ((ads->filterflag & ADS_FILTER_NOMBA)==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(mb); + dataOk=0; + }, + dataOk= !(ads->filterflag & ADS_FILTER_NOMBA);, + dataOk= !(ads->filterflag & ADS_FILTER_NOMBA);, + dataOk= !(ads->filterflag & ADS_FILTER_NOMBA);) + } + break; default: /* --- other --- */ dataOk= 0; break; @@ -1671,6 +1710,12 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, int dataOk= ANIMDATA_HAS_KEYS(cu); } break; + case OB_MBALL: /* -------- Metas ---------- */ + { + MetaBall *mb= (MetaBall *)ob->data; + dataOk= ANIMDATA_HAS_KEYS(mb); + } + break; default: /* --- other --- */ dataOk= 0; break; diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 8f7c0ceeab6..0786d0f9be0 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -131,6 +131,7 @@ typedef enum eAnim_ChannelType { ANIMTYPE_DSSKEY, ANIMTYPE_DSWOR, ANIMTYPE_DSPART, + ANIMTYPE_DSMBALL, ANIMTYPE_SHAPEKEY, // XXX probably can become depreceated??? @@ -196,6 +197,7 @@ typedef enum eAnimFilter_Flags { #define FILTER_CAM_OBJD(ca) ((ca->flag & CAM_DS_EXPAND)) #define FILTER_CUR_OBJD(cu) ((cu->flag & CU_DS_EXPAND)) #define FILTER_PART_OBJD(part) ((part->flag & PART_DS_EXPAND)) +#define FILTER_MBALL_OBJD(mb) ((mb->flag2 & MB_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) diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 216ff3993dd..6e86748adae 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -60,6 +60,7 @@ #include "DNA_key_types.h" #include "DNA_lamp_types.h" #include "DNA_material_types.h" +#include "DNA_meta_types.h" #include "DNA_userdef_types.h" #include "DNA_gpencil_types.h" #include "DNA_windowmanager_types.h" @@ -653,6 +654,22 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar) strcpy(name, part->id.name+2); } break; + case ANIMTYPE_DSMBALL: /* metaball (dopesheet) expand widget */ + { + MetaBall *mb = (MetaBall *)ale->data; + + group = 4; + indent = 1; + special = ICON_META_DATA; + + if (FILTER_MBALL_OBJD(mb)) + expand = ICON_TRIA_DOWN; + else + expand = ICON_TRIA_RIGHT; + + strcpy(name, mb->id.name+2); + } + break; case ANIMTYPE_GROUP: /* action group */ diff --git a/source/blender/editors/space_action/action_header.c b/source/blender/editors/space_action/action_header.c index b3c3cbaca18..d3929a22342 100644 --- a/source/blender/editors/space_action/action_header.c +++ b/source/blender/editors/space_action/action_header.c @@ -386,6 +386,7 @@ void action_header_buttons(const bContext *C, ARegion *ar) uiDefIconButBitI(block, TOGN, ADS_FILTER_NOLAM, B_REDR, ICON_LAMP_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Lamps"); uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCAM, B_REDR, ICON_CAMERA_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Cameras"); uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCUR, B_REDR, ICON_CURVE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Curves"); + uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMBA, B_REDR, ICON_META_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display MetaBalls"); uiDefIconButBitI(block, TOGN, ADS_FILTER_NOPART, B_REDR, ICON_PARTICLE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Particles"); uiBlockEndAlign(block); xco += 30; diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 105ecf23c3e..f6915c4db01 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -51,6 +51,7 @@ #include "DNA_key_types.h" #include "DNA_lamp_types.h" #include "DNA_material_types.h" +#include "DNA_meta_types.h" #include "DNA_object_types.h" #include "DNA_particle_types.h" #include "DNA_scene_types.h" @@ -1158,6 +1159,22 @@ void graph_draw_channel_names(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) strcpy(name, part->id.name+2); } break; + case ANIMTYPE_DSMBALL: /* metaball (dopesheet) expand widget */ + { + MetaBall *mb = (MetaBall *)ale->data; + + group = 4; + indent = 1; + special = ICON_META_DATA; + + if (FILTER_MBALL_OBJD(mb)) + expand = ICON_TRIA_DOWN; + else + expand = ICON_TRIA_RIGHT; + + strcpy(name, mb->id.name+2); + } + break; case ANIMTYPE_GROUP: /* action group */ diff --git a/source/blender/editors/space_graph/graph_header.c b/source/blender/editors/space_graph/graph_header.c index 989f1f8e0cc..2c9017db649 100644 --- a/source/blender/editors/space_graph/graph_header.c +++ b/source/blender/editors/space_graph/graph_header.c @@ -310,13 +310,14 @@ void graph_header_buttons(const bContext *C, ARegion *ar) uiDefIconButBitI(block, TOGN, ADS_FILTER_NOLAM, B_REDR, ICON_LAMP_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Lamps"); uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCAM, B_REDR, ICON_CAMERA_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Cameras"); uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCUR, B_REDR, ICON_CURVE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Curves"); + uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMBA, B_REDR, ICON_META_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display MetaBalls"); uiDefIconButBitI(block, TOGN, ADS_FILTER_NOPART, B_REDR, ICON_PARTICLE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Particles"); uiBlockEndAlign(block); xco += 30; } else { // XXX this case shouldn't happen at all... for now, just pad out same amount of space - xco += 9*XIC + 30; + xco += 10*XIC + 30; } /* auto-snap selector */ diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index 98dacc8ef5b..ab918519ec0 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -45,6 +45,7 @@ #include "DNA_key_types.h" #include "DNA_lamp_types.h" #include "DNA_material_types.h" +#include "DNA_meta_types.h" #include "DNA_userdef_types.h" #include "DNA_windowmanager_types.h" #include "DNA_world_types.h" @@ -320,6 +321,22 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho notifierFlags |= ND_ANIMCHAN_EDIT; } break; + case ANIMTYPE_DSMBALL: + { + MetaBall *mb= (MetaBall *)ale->data; + AnimData *adt= ale->adt; + + if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { + /* toggle mute */ + adt->flag ^= ADT_NLA_EVAL_OFF; + } + else { + /* toggle expand */ + mb->flag2 ^= MB_DS_EXPAND; + } + notifierFlags |= ND_ANIMCHAN_EDIT; + } + break; case ANIMTYPE_NLATRACK: { diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 3feefcc11ab..a7a854a7277 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -46,6 +46,7 @@ #include "DNA_key_types.h" #include "DNA_lamp_types.h" #include "DNA_material_types.h" +#include "DNA_meta_types.h" #include "DNA_particle_types.h" #include "DNA_userdef_types.h" #include "DNA_windowmanager_types.h" @@ -908,6 +909,31 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) strcpy(name, part->id.name+2); } break; + case ANIMTYPE_DSMBALL: /* metaball (dopesheet) expand widget */ + { + MetaBall *mb = (MetaBall *)ale->data; + AnimData *adt= ale->adt; + + group = 4; + indent = 1; + special = ICON_META_DATA; + + if (FILTER_MBALL_OBJD(mb)) + expand = ICON_TRIA_DOWN; + else + expand = ICON_TRIA_RIGHT; + + /* NLA evaluation on/off button */ + if (adt) { + if (adt->flag & ADT_NLA_EVAL_OFF) + mute = ICON_MUTE_IPO_ON; + else + mute = ICON_MUTE_IPO_OFF; + } + + strcpy(name, mb->id.name+2); + } + break; case ANIMTYPE_NLATRACK: /* NLA Track */ { diff --git a/source/blender/editors/space_nla/nla_header.c b/source/blender/editors/space_nla/nla_header.c index 20343adef03..04c2db08bda 100644 --- a/source/blender/editors/space_nla/nla_header.c +++ b/source/blender/editors/space_nla/nla_header.c @@ -261,13 +261,14 @@ void nla_header_buttons(const bContext *C, ARegion *ar) uiDefIconButBitI(block, TOGN, ADS_FILTER_NOLAM, B_REDR, ICON_LAMP_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(snla->ads->filterflag), 0, 0, 0, 0, "Display Lamps"); uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCAM, B_REDR, ICON_CAMERA_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(snla->ads->filterflag), 0, 0, 0, 0, "Display Cameras"); uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCUR, B_REDR, ICON_CURVE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(snla->ads->filterflag), 0, 0, 0, 0, "Display Curves"); + uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMBA, B_REDR, ICON_META_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(snla->ads->filterflag), 0, 0, 0, 0, "Display MetaBalls"); uiDefIconButBitI(block, TOGN, ADS_FILTER_NOPART, B_REDR, ICON_PARTICLE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(snla->ads->filterflag), 0, 0, 0, 0, "Display Particles"); uiBlockEndAlign(block); xco += 15; } else { // XXX this case shouldn't happen at all... for now, just pad out same amount of space - xco += 7*XIC + 15; + xco += 10*XIC + 15; } xco += (XIC + 8); diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 0c6c04273e3..6f097ea3882 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -313,6 +313,7 @@ typedef enum DOPESHEET_FILTERFLAG { ADS_FILTER_NOWOR = (1<<14), ADS_FILTER_NOSCE = (1<<15), ADS_FILTER_NOPART = (1<<16), + ADS_FILTER_NOMBA = (1<<17), /* NLA-specific filters */ ADS_FILTER_NLA_NOACT = (1<<20), /* if the AnimData block has no NLA data, don't include to just show Action-line */ diff --git a/source/blender/makesdna/DNA_meta_types.h b/source/blender/makesdna/DNA_meta_types.h index 897368fd5df..8b61405b851 100644 --- a/source/blender/makesdna/DNA_meta_types.h +++ b/source/blender/makesdna/DNA_meta_types.h @@ -35,6 +35,7 @@ #include "DNA_ID.h" struct BoundBox; +struct AnimData; struct Ipo; struct Material; @@ -62,18 +63,20 @@ typedef struct MetaElem { typedef struct MetaBall { ID id; + struct AnimData *adt; struct BoundBox *bb; ListBase elems; ListBase disp; ListBase *editelems; /* not saved in files, note we use pointer for editmode check */ - struct Ipo *ipo; + struct Ipo *ipo; // XXX... depreceated (old animation system) /* material of the mother ball will define the material used of all others */ struct Material **mat; - short flag, totcol; + char flag, flag2; /* flag is enum for updates, flag2 is bitflags for settings */ + short totcol; int texflag; /* used to store MB_AUTOSPACE */ /* texture space, copied as one block in editobject.c */ @@ -104,6 +107,10 @@ typedef struct MetaBall { #define MB_UPDATE_FAST 2 #define MB_UPDATE_NEVER 3 +/* mb->flag2 */ +#define MB_DS_EXPAND (1<<0) + + /* ml->type */ #define MB_BALL 0 #define MB_TUBEX 1 /* depercated */ diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index 39e72c34adf..422e1b07ed7 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -147,7 +147,7 @@ typedef struct Sequence { Strip *strip; - struct Ipo *ipo; + struct Ipo *ipo; // xxx depreceated... old animation system struct Scene *scene; struct anim *anim; float facf0, facf1; diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c index df26e6b8121..17193f313f5 100644 --- a/source/blender/makesrna/intern/rna_meta.c +++ b/source/blender/makesrna/intern/rna_meta.c @@ -185,6 +185,9 @@ void rna_def_metaball(BlenderRNA *brna) /* materials, textures */ rna_def_texmat_common(srna, "rna_Meta_texspace_editable"); + + /* anim */ + rna_def_animdata_common(srna); } void RNA_def_meta(BlenderRNA *brna) |