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:
authorJoerg Mueller <nexyon@gmail.com>2011-08-01 15:44:20 +0400
committerJoerg Mueller <nexyon@gmail.com>2011-08-01 15:44:20 +0400
commit3e85ec432ef050563d75488eca3049b77497153d (patch)
tree147c765f8b099b0d525c5e55ccc6a70995632509 /source/blender/editors/animation
parentf3c867c3dbde6919653e7cc712099e48b7508715 (diff)
3D Audio GSoC:
Adds new speaker object type. Notes: * Needs some nice icons * Quickily review by Joshua Leung (5 mins) * Properties UI updated (with help of Thomans Dinges) * Speakers have their own theme color * No real audio functionality yet. * Minor bug regarding lamps/lattices fixed in interface_templates.c I personality tested: * Creation, Deletion, Duplication * Saving, Loading * Library linking (incl. make local) * Tracking * Dope Sheet, Outliner * Animation * Drawing (incl. Theme)
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c84
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c5
-rw-r--r--source/blender/editors/animation/anim_filter.c22
-rw-r--r--source/blender/editors/animation/keyframes_draw.c1
4 files changed, 110 insertions, 2 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 5e23b49fc22..4296d404cd3 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -55,6 +55,7 @@
#include "DNA_node_types.h"
#include "DNA_world_types.h"
#include "DNA_gpencil_types.h"
+#include "DNA_speaker_types.h"
#include "RNA_access.h"
@@ -584,7 +585,9 @@ static int acf_object_icon(bAnimListElem *ale)
return ICON_OUTLINER_OB_META;
case OB_LATTICE:
return ICON_OUTLINER_OB_LATTICE;
- case OB_ARMATURE:
+ case OB_SPEAKER:
+ return ICON_SPEAKER;
+ case OB_ARMATURE:
return ICON_OUTLINER_OB_ARMATURE;
case OB_FONT:
return ICON_OUTLINER_OB_FONT;
@@ -2088,6 +2091,82 @@ static bAnimChannelType ACF_DSLAT=
acf_dslat_setting_ptr /* pointer for setting */
};
+/* Speaker Expander ------------------------------------------- */
+
+// TODO: just get this from RNA?
+static int acf_dsspk_icon(bAnimListElem *UNUSED(ale))
+{
+ return ICON_SPEAKER;
+}
+
+/* get the appropriate flag(s) for the setting when it is valid */
+static int acf_dsspk_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
+{
+ /* clear extra return data first */
+ *neg= 0;
+
+ switch (setting) {
+ case ACHANNEL_SETTING_EXPAND: /* expanded */
+ return SPK_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_dsspk_setting_ptr(bAnimListElem *ale, int setting, short *type)
+{
+ Speaker *spk= (Speaker *)ale->data;
+
+ /* clear extra return data first */
+ *type= 0;
+
+ switch (setting) {
+ case ACHANNEL_SETTING_EXPAND: /* expanded */
+ GET_ACF_FLAG_PTR(spk->flag);
+
+ case ACHANNEL_SETTING_SELECT: /* selected */
+ case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
+ if (spk->adt)
+ GET_ACF_FLAG_PTR(spk->adt->flag)
+ else
+ return NULL;
+
+ default: /* unsupported */
+ return NULL;
+ }
+}
+
+/* speaker expander type define */
+static bAnimChannelType ACF_DSSPK=
+{
+ "Speaker Expander", /* type name */
+
+ acf_generic_dataexpand_color, /* backdrop color */
+ acf_generic_dataexpand_backdrop,/* backdrop */
+ acf_generic_indention_1, /* indent level */
+ acf_generic_basic_offset, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_dsspk_icon, /* icon */
+
+ acf_generic_dataexpand_setting_valid, /* has setting */
+ acf_dsspk_setting_flag, /* flag for setting */
+ acf_dsspk_setting_ptr /* pointer for setting */
+};
+
/* ShapeKey Entry ------------------------------------------- */
/* name for ShapeKey */
@@ -2370,7 +2449,8 @@ static void ANIM_init_channel_typeinfo_data (void)
animchannelTypeInfo[type++]= &ACF_DSMESH; /* Mesh Channel */
animchannelTypeInfo[type++]= &ACF_DSTEX; /* Texture Channel */
animchannelTypeInfo[type++]= &ACF_DSLAT; /* Lattice Channel */
-
+ animchannelTypeInfo[type++]= &ACF_DSSPK; /* Speaker Channel */
+
animchannelTypeInfo[type++]= &ACF_SHAPEKEY; /* ShapeKey */
animchannelTypeInfo[type++]= &ACF_GPD; /* Grease Pencil Datablock */
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index eee7fb0badd..8331001d98e 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -124,6 +124,7 @@ void ANIM_set_active_channel (bAnimContext *ac, void *data, short datatype, int
case ANIMTYPE_DSMESH:
case ANIMTYPE_DSTEX:
case ANIMTYPE_DSLAT:
+ case ANIMTYPE_DSSPK:
{
/* need to verify that this data is valid for now */
if (ale->adt) {
@@ -168,6 +169,7 @@ void ANIM_set_active_channel (bAnimContext *ac, void *data, short datatype, int
case ANIMTYPE_DSARM:
case ANIMTYPE_DSMESH:
case ANIMTYPE_DSLAT:
+ case ANIMTYPE_DSSPK:
{
/* need to verify that this data is valid for now */
if (ale && ale->adt) {
@@ -247,6 +249,7 @@ void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype,
case ANIMTYPE_DSNTREE:
case ANIMTYPE_DSTEX:
case ANIMTYPE_DSLAT:
+ case ANIMTYPE_DSSPK:
{
if ((ale->adt) && (ale->adt->flag & ADT_UI_SELECTED))
sel= ACHANNEL_SETFLAG_CLEAR;
@@ -336,6 +339,7 @@ void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype,
case ANIMTYPE_DSNTREE:
case ANIMTYPE_DSTEX:
case ANIMTYPE_DSLAT:
+ case ANIMTYPE_DSSPK:
{
/* need to verify that this data is valid for now */
if (ale->adt) {
@@ -2071,6 +2075,7 @@ static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_i
case ANIMTYPE_DSNTREE:
case ANIMTYPE_DSTEX:
case ANIMTYPE_DSLAT:
+ case ANIMTYPE_DSSPK:
{
/* sanity checking... */
if (ale->adt) {
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 047a7763fd8..4927b0f097a 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -67,6 +67,7 @@
#include "DNA_sequence_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
+#include "DNA_speaker_types.h"
#include "DNA_world_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_object_types.h"
@@ -646,6 +647,19 @@ static bAnimListElem *make_new_animlistelem (void *data, short datatype, ID *own
ale->adt= BKE_animdata_from_id(data);
}
break;
+ case ANIMTYPE_DSSPK:
+ {
+ Speaker *spk= (Speaker *)data;
+ AnimData *adt= spk->adt;
+
+ ale->flag= FILTER_SPK_OBJD(spk);
+
+ 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;
@@ -1608,6 +1622,14 @@ static size_t animdata_filter_ds_obdata (bAnimContext *ac, ListBase *anim_data,
expanded= FILTER_LATTICE_OBJD(lt);
}
break;
+ case OB_SPEAKER: /* ---------- Speaker ----------- */
+ {
+ Speaker *spk= (Speaker *)ob->data;
+
+ type= ANIMTYPE_DSSPK;
+ expanded= FILTER_SPK_OBJD(spk);
+ }
+ break;
}
/* add object data animation channels */
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index b774bc947e4..56bc37709bc 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -59,6 +59,7 @@
#include "DNA_meta_types.h"
#include "DNA_node_types.h"
#include "DNA_particle_types.h"
+#include "DNA_speaker_types.h"
#include "DNA_world_types.h"
#include "DNA_gpencil_types.h"