Last bunch of minor fixes before merge.
authorJoerg Mueller <nexyon@gmail.com>
Tue, 30 Aug 2011 07:57:55 +0000 (07:57 +0000)
committerJoerg Mueller <nexyon@gmail.com>
Tue, 30 Aug 2011 07:57:55 +0000 (07:57 +0000)
* Use NULL in AUD_Reference.h
* Use SETLOOPER in sound.c
* Move flags to the end of Speaker struct.

intern/audaspace/intern/AUD_Reference.h
source/blender/blenkernel/intern/sound.c
source/blender/editors/sound/sound_ops.c
source/blender/makesdna/DNA_speaker_types.h

index f78de40c3bb792938132d95a07ee41286915fcc4..4b878fc8d468bab7647ab563deeb0bc35383ae2c 100644 (file)
@@ -32,6 +32,7 @@
 #define AUD_REFERENCE
 
 #include <map>
+#include <cstddef>
 
 // #define MEM_DEBUG
 
@@ -113,15 +114,15 @@ public:
                m_reference = dynamic_cast<T*>(reference);
                AUD_ReferenceHandler::incref(m_original);
 #ifdef MEM_DEBUG
-               if(m_reference != 0)
+               if(m_reference != NULL)
                        std::cerr << "+" << typeid(*m_reference).name() << std::endl;
 #endif
        }
 
        AUD_Reference()
        {
-               m_original = 0;
-               m_reference = 0;
+               m_original = NULL;
+               m_reference = NULL;
        }
 
        /**
@@ -134,7 +135,7 @@ public:
                m_reference = ref.m_reference;
                AUD_ReferenceHandler::incref(m_original);
 #ifdef MEM_DEBUG
-               if(m_reference != 0)
+               if(m_reference != NULL)
                        std::cerr << "+" << typeid(*m_reference).name() << std::endl;
 #endif
        }
@@ -146,7 +147,7 @@ public:
                m_reference = dynamic_cast<T*>(ref.get());
                AUD_ReferenceHandler::incref(m_original);
 #ifdef MEM_DEBUG
-               if(m_reference != 0)
+               if(m_reference != NULL)
                        std::cerr << "+" << typeid(*m_reference).name() << std::endl;
 #endif
        }
@@ -158,7 +159,7 @@ public:
        ~AUD_Reference()
        {
 #ifdef MEM_DEBUG
-               if(m_reference != 0)
+               if(m_reference != NULL)
                        std::cerr << "-" << typeid(*m_reference).name() << std::endl;
 #endif
                if(AUD_ReferenceHandler::decref(m_original))
@@ -175,7 +176,7 @@ public:
                        return *this;
 
 #ifdef MEM_DEBUG
-               if(m_reference != 0)
+               if(m_reference != NULL)
                        std::cerr << "-" << typeid(*m_reference).name() << std::endl;
 #endif
                if(AUD_ReferenceHandler::decref(m_original))
@@ -185,7 +186,7 @@ public:
                m_reference = ref.m_reference;
                AUD_ReferenceHandler::incref(m_original);
 #ifdef MEM_DEBUG
-               if(m_reference != 0)
+               if(m_reference != NULL)
                        std::cerr << "+" << typeid(*m_reference).name() << std::endl;
 #endif
 
@@ -197,7 +198,7 @@ public:
         */
        inline bool isNull() const
        {
-               return m_reference == 0;
+               return m_reference == NULL;
        }
 
        /**
index abead8d43ddfb44819ee9ebbf071a698881b7987..985fef974d376db7f2d2e03dd94bc7bda2676f04 100644 (file)
@@ -37,6 +37,7 @@
 #include "BKE_packedFile.h"
 #include "BKE_animsys.h"
 #include "BKE_sequencer.h"
+#include "BKE_scene.h"
 
 // evil global ;-)
 static int sound_cfra;
@@ -656,12 +657,13 @@ void sound_update_scene(struct Scene* scene)
        NlaTrack* track;
        NlaStrip* strip;
        Speaker* speaker;
+       Scene* sce_it;
 
        void* new_set = AUD_createSet();
        void* handle;
        float quat[4];
 
-       for(base = FIRSTBASE; base; base=base->next)
+       for(SETLOOPER(scene, sce_it, base))
        {
                ob = base->object;
                if(ob->type == OB_SPEAKER)
index fb4355d0df7ac389c04475c19643cd436e49b973..e66abffbfd1ac74e61296f8b8f04f734d646829b 100644 (file)
@@ -648,6 +648,13 @@ static int update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op))
 
 void SOUND_OT_update_animation_flags(wmOperatorType *ot)
 {
+       /*
+         This operator is needed to set a correct state of the sound animation
+         System. Unfortunately there's no really correct place to call the exec
+         function, that's why I made it an operator that's only visible in the
+         search menu. Apart from that the bake animation operator calls it too.
+       */
+
        /* identifiers */
        ot->name= "Update animation";
        ot->description= "Update animation flags";
index 50cb62c79e5f090aadab4f2b8cb067bb6259e8b9..fecc65885c509a89fb3bce1b336c32c4b24407c9 100644 (file)
@@ -39,9 +39,6 @@ typedef struct Speaker {
 
        struct bSound *sound;
 
-       short flag;
-       short pad1[3];
-
        // not animatable properties
        float volume_max;
        float volume_min;
@@ -55,6 +52,10 @@ typedef struct Speaker {
        // animatable properties
        float volume;
        float pitch;
+
+       // flag
+       short flag;
+       short pad1[3];
 } Speaker;
 
 /* **************** SPEAKER ********************* */