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>2011-08-07 16:27:20 +0400
committerJoshua Leung <aligorith@gmail.com>2011-08-07 16:27:20 +0400
commit022e815fbd6d81f9b1baa177cce1abf2f42bcb21 (patch)
tree5c8b9b947ef50d4b0f398cf6a53b81a04e4f83c9 /source/blender/blenkernel
parent2d884fc035d403d43c7a18e3e61cd56ccdfbec2b (diff)
Sound clip NLA Strips for Nexyon
These are basically just for specifying when a speaker should fire off it's soundclip, and as such, many NLA operations are irrelevant for it. They can only be specified on object-level for speaker objects. I've still got some UI tweaks I'll need to work on in order for these to be able to be added even when the speaker doesn't have any NLA tracks yet. (EDIT: while typing this, I had an idea for how to do this, but that'll be for next commit). In the mean time, you'll need to add a single keyframe for the object, snowflake that action and delete the NLA strip before you can start editing.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_nla.h3
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c3
-rw-r--r--source/blender/blenkernel/intern/nla.c40
3 files changed, 46 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_nla.h b/source/blender/blenkernel/BKE_nla.h
index 0206756a1ad..49c1f8acd24 100644
--- a/source/blender/blenkernel/BKE_nla.h
+++ b/source/blender/blenkernel/BKE_nla.h
@@ -39,6 +39,8 @@ struct AnimData;
struct NlaStrip;
struct NlaTrack;
struct bAction;
+struct Scene;
+struct Speaker;
/* ----------------------------- */
/* Data Management */
@@ -54,6 +56,7 @@ void copy_nladata(ListBase *dst, ListBase *src);
struct NlaTrack *add_nlatrack(struct AnimData *adt, struct NlaTrack *prev);
struct NlaStrip *add_nlastrip(struct bAction *act);
struct NlaStrip *add_nlastrip_to_stack(struct AnimData *adt, struct bAction *act);
+struct NlaStrip *add_nla_soundstrip(struct Scene *scene, struct Speaker *spk);
/* ----------------------------- */
/* API */
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index a43cdc8143e..832d13c9c2f 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1921,6 +1921,9 @@ void nlastrip_evaluate (PointerRNA *ptr, ListBase *channels, ListBase *modifiers
case NLASTRIP_TYPE_META: /* meta */
nlastrip_evaluate_meta(ptr, channels, modifiers, nes);
break;
+
+ default: /* do nothing */
+ break;
}
/* clear temp recursion safe-check */
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index f2ce8e4e6f1..dad49646622 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -46,6 +46,8 @@
#include "DNA_anim_types.h"
#include "DNA_scene_types.h"
+#include "DNA_sound_types.h"
+#include "DNA_speaker_types.h"
#include "BKE_action.h"
#include "BKE_fcurve.h"
@@ -53,6 +55,9 @@
#include "BKE_global.h"
#include "BKE_library.h"
+#ifdef WITH_AUDASPACE
+# include "AUD_C-API.h"
+#endif
#include "RNA_access.h"
#include "nla_private.h"
@@ -337,6 +342,41 @@ NlaStrip *add_nlastrip_to_stack (AnimData *adt, bAction *act)
return strip;
}
+/* Add a NLA Strip referencing the given speaker's sound */
+NlaStrip *add_nla_soundstrip (Scene *scene, Speaker *speaker)
+{
+ NlaStrip *strip = MEM_callocN(sizeof(NlaStrip), "NlaSoundStrip");
+
+ /* if speaker has a sound, set the strip length to the length of the sound,
+ * otherwise default to length of 10 frames
+ */
+#ifdef WITH_AUDASPACE
+ if (speaker->sound)
+ {
+ AUD_SoundInfo info = AUD_getInfo(speaker->sound->playback_handle);
+
+ strip->end = ceil(info.length * FPS);
+ }
+ else
+#endif
+ {
+ strip->end = 10.0f;
+ }
+
+ /* general settings */
+ strip->type = NLASTRIP_TYPE_SOUND;
+
+ strip->flag = NLASTRIP_FLAG_SELECT;
+ strip->extendmode = NLASTRIP_EXTEND_NOTHING; /* nothing to extend... */
+
+ /* strip should be referenced as-is */
+ strip->scale= 1.0f;
+ strip->repeat = 1.0f;
+
+ /* return this strip */
+ return strip;
+}
+
/* *************************************************** */
/* NLA Evaluation <-> Editing Stuff */