Revision: 39139
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39139
Author:   aligorith
Date:     2011-08-07 12:43:44 +0000 (Sun, 07 Aug 2011)
Log Message:
-----------
Nla Sound Strips + Add Speaker

Second part of previous commit. Now, when speaker objects are created,
they are created by default with an NLA sound strip so that it is easy
to just start immediately using this to do cool stuff (i.e. timing
when you want the sound to start).

Modified Paths:
--------------
    branches/soc-2011-pepper/source/blender/editors/object/object_add.c

Modified: branches/soc-2011-pepper/source/blender/editors/object/object_add.c
===================================================================
--- branches/soc-2011-pepper/source/blender/editors/object/object_add.c 
2011-08-07 12:27:20 UTC (rev 39138)
+++ branches/soc-2011-pepper/source/blender/editors/object/object_add.c 
2011-08-07 12:43:44 UTC (rev 39139)
@@ -35,6 +35,7 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "DNA_anim_types.h"
 #include "DNA_curve_types.h"
 #include "DNA_group_types.h"
 #include "DNA_lamp_types.h"
@@ -69,6 +70,7 @@
 #include "BKE_mball.h"
 #include "BKE_mesh.h"
 #include "BKE_modifier.h"
+#include "BKE_nla.h"
 #include "BKE_object.h"
 #include "BKE_particle.h"
 #include "BKE_report.h"
@@ -778,6 +780,25 @@
                return OPERATOR_CANCELLED;
 
        ob= ED_object_add_type(C, OB_SPEAKER, loc, rot, FALSE, layer);
+       
+       /* to make it easier to start using this immediately in NLA, a default 
sound clip is created
+        * ready to be moved around to retime the sound and/or make new sound 
clips
+        */
+       {
+               /* create new data for NLA hierarchy */
+               AnimData *adt = BKE_id_add_animdata(&ob->id);
+               NlaTrack *nlt = add_nlatrack(adt, NULL);
+               NlaStrip *strip = add_nla_soundstrip(CTX_data_scene(C), 
ob->data);
+               
+               /* hook them up */
+               BKE_nlatrack_add_strip(nlt, strip);
+               
+               /* auto-name the strip, and give the track an interesting name  
*/
+               strcpy(nlt->name, "SoundTrack");
+               BKE_nlastrip_validate_name(adt, strip);
+               
+               WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+       }
 
        return OPERATOR_FINISHED;
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to