diff options
author | Joerg Mueller <nexyon@gmail.com> | 2011-08-01 15:44:20 +0400 |
---|---|---|
committer | Joerg Mueller <nexyon@gmail.com> | 2011-08-01 15:44:20 +0400 |
commit | 3e85ec432ef050563d75488eca3049b77497153d (patch) | |
tree | 147c765f8b099b0d525c5e55ccc6a70995632509 /source/blender/editors | |
parent | f3c867c3dbde6919653e7cc712099e48b7508715 (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')
21 files changed, 256 insertions, 14 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" diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 0b99c256183..3c4ca1a5d97 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -153,6 +153,7 @@ typedef enum eAnim_ChannelType { ANIMTYPE_DSMESH, ANIMTYPE_DSTEX, ANIMTYPE_DSLAT, + ANIMTYPE_DSSPK, ANIMTYPE_SHAPEKEY, @@ -243,6 +244,7 @@ typedef enum eAnimFilter_Flags { #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)) +#define FILTER_SPK_OBJD(spk) ((spk->flag & SPK_DS_EXPAND)) /* Variable use expanders */ #define FILTER_NTREE_DATA(ntree) ((ntree->flag & NTREE_DS_EXPAND)) #define FILTER_TEX_DATA(tex) ((tex->flag & TEX_DS_EXPAND)) diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index 2311aafbb17..2bc2aac165f 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -204,6 +204,8 @@ enum { TH_STRIP_SELECT, TH_LAMP, + + TH_SPEAKER, TH_NODE, TH_NODE_IN_OUT, diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 3d7d1bf95cc..28bfbfba6c8 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -298,11 +298,13 @@ static const char *template_id_browse_tip(StructRNA *type) case ID_MA: return "Browse Material to be linked"; case ID_TE: return "Browse Texture to be linked"; case ID_IM: return "Browse Image to be linked"; - case ID_LA: return "Browse Lattice Data to be linked"; + case ID_LT: return "Browse Lattice Data to be linked"; + case ID_LA: return "Browse Lamp Data to be linked"; case ID_CA: return "Browse Camera Data to be linked"; case ID_WO: return "Browse World Settings to be linked"; case ID_SCR: return "Choose Screen lay-out"; case ID_TXT: return "Browse Text to be linked"; + case ID_SPK: return "Browse Speaker Data to be linked"; case ID_SO: return "Browse Sound to be linked"; case ID_AR: return "Browse Armature data to be linked"; case ID_AC: return "Browse Action to be linked"; diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 2465c734aa0..1aa2fb391db 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -249,6 +249,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo cp= ts->wire; break; case TH_LAMP: cp= ts->lamp; break; + case TH_SPEAKER: + cp= ts->speaker; break; case TH_SELECT: cp= ts->select; break; case TH_ACTIVE: @@ -584,6 +586,7 @@ void ui_theme_init_default(void) SETCOLF(btheme->tv3d.grid, 0.251, 0.251, 0.251, 1.0); SETCOL(btheme->tv3d.wire, 0x0, 0x0, 0x0, 255); SETCOL(btheme->tv3d.lamp, 0, 0, 0, 40); + SETCOL(btheme->tv3d.speaker, 0, 0, 0, 255); SETCOL(btheme->tv3d.select, 241, 88, 0, 255); SETCOL(btheme->tv3d.active, 255, 170, 64, 255); SETCOL(btheme->tv3d.group, 8, 48, 8, 255); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index f5f97c6a5f6..48e138dfcdc 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -44,6 +44,7 @@ #include "DNA_object_fluidsim.h" #include "DNA_object_force.h" #include "DNA_scene_types.h" +#include "DNA_speaker_types.h" #include "DNA_vfont_types.h" #include "BLI_math.h" @@ -764,6 +765,40 @@ static int group_instance_add_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } +static int object_speaker_add_exec(bContext *C, wmOperator *op) +{ + Object *ob; + int enter_editmode; + unsigned int layer; + float loc[3], rot[3]; + + object_add_generic_invoke_options(C, op); + if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer)) + return OPERATOR_CANCELLED; + + ob= ED_object_add_type(C, OB_SPEAKER, loc, rot, FALSE, layer); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_speaker_add(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Add Speaker"; + ot->description = "Add a speaker object to the scene"; + ot->idname= "OBJECT_OT_speaker_add"; + + /* api callbacks */ + ot->invoke= WM_menu_invoke; + ot->exec= object_speaker_add_exec; + ot->poll= ED_operator_objectmode; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + ED_object_add_generic_props(ot, FALSE); +} + /* only used as menu */ void OBJECT_OT_group_instance_add(wmOperatorType *ot) { @@ -1600,6 +1635,18 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base id->us--; } break; + case OB_SPEAKER: + // AUD_XXX TODO: always duplicate Speakers on speaker object duplication? + if(dupflag!=0) { + ID_NEW_US2(obn->data ) + else { + obn->data= copy_speaker(obn->data); + didit= 1; + } + id->us--; + } + break; + } /* check if obdata is copied */ diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 801880f0f32..c308d36f838 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -116,6 +116,7 @@ void OBJECT_OT_armature_add(struct wmOperatorType *ot); void OBJECT_OT_lamp_add(struct wmOperatorType *ot); void OBJECT_OT_effector_add(struct wmOperatorType *ot); void OBJECT_OT_camera_add(struct wmOperatorType *ot); +void OBJECT_OT_speaker_add(struct wmOperatorType *ot); void OBJECT_OT_group_instance_add(struct wmOperatorType *ot); void OBJECT_OT_duplicates_make_real(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index ff9b13379a2..8f00f923b84 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -117,6 +117,7 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_armature_add); WM_operatortype_append(OBJECT_OT_lamp_add); WM_operatortype_append(OBJECT_OT_camera_add); + WM_operatortype_append(OBJECT_OT_speaker_add); WM_operatortype_append(OBJECT_OT_add); WM_operatortype_append(OBJECT_OT_add_named); WM_operatortype_append(OBJECT_OT_effector_add); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index f21241b6e7a..ab9c69988fe 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -45,6 +45,7 @@ #include "DNA_meta_types.h" #include "DNA_particle_types.h" #include "DNA_scene_types.h" +#include "DNA_speaker_types.h" #include "DNA_world_types.h" #include "DNA_object_types.h" @@ -971,8 +972,8 @@ static int track_set_exec(bContext *C, wmOperator *op) data->tar = obact; ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME; - /* Lamp and Camera track differently by default */ - if (ob->type == OB_LAMP || ob->type == OB_CAMERA) + /* Lamp, Camera and Speaker track differently by default */ + if (ob->type == OB_LAMP || ob->type == OB_CAMERA || ob->type == OB_SPEAKER) data->trackflag = TRACK_nZ; } } @@ -990,8 +991,8 @@ static int track_set_exec(bContext *C, wmOperator *op) data->tar = obact; ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME; - /* Lamp and Camera track differently by default */ - if (ob->type == OB_LAMP || ob->type == OB_CAMERA) { + /* Lamp, Camera and Speaker track differently by default */ + if (ob->type == OB_LAMP || ob->type == OB_CAMERA || ob->type == OB_SPEAKER) { data->reserved1 = TRACK_nZ; data->reserved2 = UP_Y; } @@ -1011,8 +1012,8 @@ static int track_set_exec(bContext *C, wmOperator *op) data->tar = obact; ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME; - /* Lamp and Camera track differently by default */ - if (ob->type == OB_LAMP || ob->type == OB_CAMERA) { + /* Lamp, Camera and Speaker track differently by default */ + if (ob->type == OB_LAMP || ob->type == OB_CAMERA || ob->type == OB_SPEAKER) { data->trackflag = TRACK_nZ; data->lockflag = LOCK_Y; } @@ -1481,6 +1482,9 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag) ob->data= copy_armature(ob->data); armature_rebuild_pose(ob, ob->data); break; + case OB_SPEAKER: + ob->data= copy_speaker(ob->data); + break; default: if (G.f & G_DEBUG) printf("ERROR single_obdata_users: can't copy %s\n", id->name); diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index f0a0bcff3f3..8744ec5dfd6 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -376,8 +376,8 @@ static int bake_animation_exec(bContext *C, wmOperator *UNUSED(op)) void SOUND_OT_bake_animation(wmOperatorType *ot) { /* identifiers */ - ot->name= "Bake animation"; - ot->description= "Bakes the animation cache so that it's up to date"; + ot->name= "Update animation cache"; + ot->description= "Updates the audio animation cache so that it's up to date"; ot->idname= "SOUND_OT_bake_animation"; /* api callbacks */ diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 8e1a4b2d16c..35500ac9518 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -44,6 +44,7 @@ #include "DNA_node_types.h" #include "DNA_scene_types.h" #include "DNA_world_types.h" +#include "DNA_speaker_types.h" #include "DNA_brush_types.h" #include "BKE_context.h" @@ -188,6 +189,7 @@ static int buttons_context_path_data(ButsContextPath *path, int type) else if(RNA_struct_is_a(ptr->type, &RNA_Lattice) && (type == -1 || type == OB_LATTICE)) return 1; else if(RNA_struct_is_a(ptr->type, &RNA_Camera) && (type == -1 || type == OB_CAMERA)) return 1; else if(RNA_struct_is_a(ptr->type, &RNA_Lamp) && (type == -1 || type == OB_LAMP)) return 1; + else if(RNA_struct_is_a(ptr->type, &RNA_Speaker) && (type == -1 || type == OB_SPEAKER)) return 1; /* try to get an object in the path, no pinning supported here */ else if(buttons_context_path_object(path)) { ob= path->ptr[path->len-1].data; @@ -648,7 +650,7 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts) const char *buttons_context_dir[] = { "world", "object", "mesh", "armature", "lattice", "curve", - "meta_ball", "lamp", "camera", "material", "material_slot", + "meta_ball", "lamp", "speaker", "camera", "material", "material_slot", "texture", "texture_slot", "bone", "edit_bone", "pose_bone", "particle_system", "particle_system_editable", "cloth", "soft_body", "fluid", "smoke", "collision", "brush", NULL}; @@ -701,6 +703,10 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r set_pointer_type(path, result, &RNA_Camera); return 1; } + else if(CTX_data_equals(member, "speaker")) { + set_pointer_type(path, result, &RNA_Speaker); + return 1; + } else if(CTX_data_equals(member, "material")) { set_pointer_type(path, result, &RNA_Material); return 1; diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 6736230e84f..e245e19ce96 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -1127,7 +1127,7 @@ void filelist_from_main(struct FileList *filelist) if( filelist->dir[0]==0) { /* make directories */ - filelist->numfiles= 23; + filelist->numfiles= 24; filelist->filelist= (struct direntry *)malloc(filelist->numfiles * sizeof(struct direntry)); for(a=0; a<filelist->numfiles; a++) { @@ -1157,6 +1157,7 @@ void filelist_from_main(struct FileList *filelist) filelist->filelist[20].relname= BLI_strdup("Armature"); filelist->filelist[21].relname= BLI_strdup("Action"); filelist->filelist[22].relname= BLI_strdup("NodeTree"); + filelist->filelist[23].relname= BLI_strdup("Speaker"); filelist_sort(filelist, FILE_SORT_ALPHA); } else { diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index 677e818351d..b6de8e7fb59 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -146,6 +146,7 @@ static int nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA case ANIMTYPE_DSPART: case ANIMTYPE_DSMBALL: case ANIMTYPE_DSARM: + case ANIMTYPE_DSSPK: { /* for these channels, we only do AnimData */ if (ale->id && ale->adt) { diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index 5e81148c231..08a4de81013 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -180,6 +180,7 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho case ANIMTYPE_DSMESH: case ANIMTYPE_DSTEX: case ANIMTYPE_DSLAT: + case ANIMTYPE_DSSPK: { /* sanity checking... */ if (ale->adt) { diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 40a9f80e712..c2dda694a1d 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1080,6 +1080,8 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_FONT); break; case OB_SURF: tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_SURFACE); break; + case OB_SPEAKER: + tselem_draw_icon_uibut(&arg, ICON_SPEAKER); break; case OB_EMPTY: tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_EMPTY); break; @@ -1123,6 +1125,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto tselem_draw_icon_uibut(&arg, ICON_TEXTURE_DATA); break; case ID_IM: tselem_draw_icon_uibut(&arg, ICON_IMAGE_DATA); break; + case ID_SPK: case ID_SO: tselem_draw_icon_uibut(&arg, ICON_SPEAKER); break; case ID_AR: diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 57ee2fe00ef..4525ea9c8d9 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -135,7 +135,7 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb, break; case ID_ME: case ID_CU: case ID_MB: case ID_LT: - case ID_LA: case ID_AR: case ID_CA: + case ID_LA: case ID_AR: case ID_CA: case ID_SPK: case ID_MA: case ID_TE: case ID_IP: case ID_IM: case ID_SO: case ID_KE: case ID_WO: case ID_AC: case ID_NLA: case ID_TXT: case ID_GR: diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 12d1865e28c..0c6ef67d603 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -50,6 +50,7 @@ #include "DNA_scene_types.h" #include "DNA_world_types.h" #include "DNA_sequence_types.h" +#include "DNA_speaker_types.h" #include "DNA_object_types.h" #include "BLI_blenlib.h" @@ -714,6 +715,13 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor } } break; + case ID_SPK: + { + Speaker *spk= (Speaker *)id; + + outliner_add_element(soops, &te->subtree, spk->adt, te, TSE_ANIM_DATA, 0); + } + break; case ID_WO: { World *wrld= (World *)id; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index e6889f4563f..86d3ddc3353 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -45,6 +45,7 @@ #include "DNA_meta_types.h" #include "DNA_scene_types.h" #include "DNA_smoke_types.h" +#include "DNA_speaker_types.h" #include "DNA_world_types.h" #include "DNA_armature_types.h" @@ -1491,6 +1492,52 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob } } +/* flag similar to draw_object() */ +static void drawspeaker(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, int flag) +{ + //Speaker *spk = ob->data; + + float vec[3]; + int i, j; + + glEnable(GL_BLEND); + + for(j = 0; j < 3; j++) + { + vec[2] = .25f * j -.125f; + + glBegin(GL_LINE_LOOP); + for(i = 0; i < 16; i++) + { + vec[0] = cos(M_PI * i / 8.0f) * (j == 0 ? .5f : .25f); + vec[1] = sin(M_PI * i / 8.0f) * (j == 0 ? .5f : .25f); + glVertex3fv(vec); + } + glEnd(); + } + + for(j = 0; j < 4; j++) + { + vec[0] = (((j + 1) % 2) * (j - 1)) * .5f; + vec[1] = ((j % 2) * (j - 2)) * .5f; + glBegin(GL_LINE_STRIP); + for(i = 0; i < 3; i++) + { + if(i == 1) + { + vec[0] *= .5f; + vec[1] *= .5f; + } + + vec[2] = .25f * i -.125f; + glVertex3fv(vec); + } + glEnd(); + } + + glDisable(GL_BLEND); +} + static void lattice_draw_verts(Lattice *lt, DispList *dl, short sel) { BPoint *bp = lt->def; @@ -5759,6 +5806,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) else { if(ob->type==OB_LAMP) UI_ThemeColor(TH_LAMP); + else if(ob->type==OB_SPEAKER) UI_ThemeColor(TH_SPEAKER); else UI_ThemeColor(TH_WIRE); if((scene->basact)==base) { @@ -6006,6 +6054,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0 || (rv3d->persp==RV3D_CAMOB && v3d->camera==ob)) /* special exception for active camera */ drawcamera(scene, v3d, rv3d, ob, flag); break; + case OB_SPEAKER: + if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) + drawspeaker(scene, v3d, rv3d, ob, flag); + break; case OB_LATTICE: if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { drawlattice(scene, v3d, ob); |