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:
authorJoshua Leung <aligorith@gmail.com>2009-08-03 17:09:23 +0400
committerJoshua Leung <aligorith@gmail.com>2009-08-03 17:09:23 +0400
commit641c8e69a82fc8f674f81948e329cae334ef60fc (patch)
tree9e67c1672c83d49a728f28da3a7ca48dd5f6d558 /source/blender/editors
parentcd905eef702555b27d4d90983b079a1a62c31fb8 (diff)
2.5 - MetaBalls are now animateable
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/anim_channels.c21
-rw-r--r--source/blender/editors/animation/anim_filter.c47
-rw-r--r--source/blender/editors/include/ED_anim_api.h2
-rw-r--r--source/blender/editors/space_action/action_draw.c17
-rw-r--r--source/blender/editors/space_action/action_header.c1
-rw-r--r--source/blender/editors/space_graph/graph_draw.c17
-rw-r--r--source/blender/editors/space_graph/graph_header.c3
-rw-r--r--source/blender/editors/space_nla/nla_channels.c17
-rw-r--r--source/blender/editors/space_nla/nla_draw.c26
-rw-r--r--source/blender/editors/space_nla/nla_header.c3
10 files changed, 150 insertions, 4 deletions
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);