BGE: Second fix for #34330 "Action Actuator "caching" the previous ran actions" repor...
authorMitchell Stokes <mogurijin@gmail.com>
Sat, 23 Feb 2013 00:46:58 +0000 (00:46 +0000)
committerMitchell Stokes <mogurijin@gmail.com>
Sat, 23 Feb 2013 00:46:58 +0000 (00:46 +0000)
source/gameengine/Ketsji/BL_Action.cpp

index eb5d8844b6ca8464cc7e203d81a3652e8d6c8800..f55d1120a50b2eab21618cd1b7cb63af3a42ca50 100644 (file)
@@ -152,40 +152,37 @@ bool BL_Action::Play(const char* name,
                        && m_priority == priority && m_speed == playback_speed)
                return false;
 
-       if (prev_action != m_action)
-       {
-               // First get rid of any old controllers
-               ClearControllerList();
+       // First get rid of any old controllers
+       ClearControllerList();
 
-               // Create an SG_Controller
-               SG_Controller *sg_contr = BL_CreateIPO(m_action, m_obj, kxscene->GetSceneConverter());
+       // Create an SG_Controller
+       SG_Controller *sg_contr = BL_CreateIPO(m_action, m_obj, kxscene->GetSceneConverter());
+       m_sg_contr_list.push_back(sg_contr);
+       m_obj->GetSGNode()->AddSGController(sg_contr);
+       sg_contr->SetObject(m_obj->GetSGNode());
+
+       // Try obcolor
+       sg_contr = BL_CreateObColorIPO(m_action, m_obj, kxscene->GetSceneConverter());
+       if (sg_contr) {
                m_sg_contr_list.push_back(sg_contr);
                m_obj->GetSGNode()->AddSGController(sg_contr);
                sg_contr->SetObject(m_obj->GetSGNode());
+       }
 
-               // Try obcolor
-               sg_contr = BL_CreateObColorIPO(m_action, m_obj, kxscene->GetSceneConverter());
-               if (sg_contr) {
-                       m_sg_contr_list.push_back(sg_contr);
-                       m_obj->GetSGNode()->AddSGController(sg_contr);
-                       sg_contr->SetObject(m_obj->GetSGNode());
-               }
-
-               // Extra controllers
-               if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_LIGHT)
-               {
-                       sg_contr = BL_CreateLampIPO(m_action, m_obj, kxscene->GetSceneConverter());
-                       m_sg_contr_list.push_back(sg_contr);
-                       m_obj->GetSGNode()->AddSGController(sg_contr);
-                       sg_contr->SetObject(m_obj->GetSGNode());
-               }
-               else if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_CAMERA)
-               {
-                       sg_contr = BL_CreateCameraIPO(m_action, m_obj, kxscene->GetSceneConverter());
-                       m_sg_contr_list.push_back(sg_contr);
-                       m_obj->GetSGNode()->AddSGController(sg_contr);
-                       sg_contr->SetObject(m_obj->GetSGNode());
-               }
+       // Extra controllers
+       if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_LIGHT)
+       {
+               sg_contr = BL_CreateLampIPO(m_action, m_obj, kxscene->GetSceneConverter());
+               m_sg_contr_list.push_back(sg_contr);
+               m_obj->GetSGNode()->AddSGController(sg_contr);
+               sg_contr->SetObject(m_obj->GetSGNode());
+       }
+       else if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_CAMERA)
+       {
+               sg_contr = BL_CreateCameraIPO(m_action, m_obj, kxscene->GetSceneConverter());
+               m_sg_contr_list.push_back(sg_contr);
+               m_obj->GetSGNode()->AddSGController(sg_contr);
+               sg_contr->SetObject(m_obj->GetSGNode());
        }
        
        m_ipo_flags = ipo_flags;
@@ -467,4 +464,7 @@ void BL_Action::Update(float curtime)
 
                m_obj->UpdateIPO(m_localtime, m_ipo_flags & ACT_IPOFLAG_CHILD);
        }
+
+       if (m_done)
+               ClearControllerList();
 }