Changeset View
Changeset View
Standalone View
Standalone View
source/gameengine/Ketsji/BL_Action.cpp
| Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_animsys.h" | #include "BKE_animsys.h" | ||||
| #include "BKE_action.h" | #include "BKE_action.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| // Needed for material IPOs | // Needed for material IPOs | ||||
| #include "BKE_material.h" | #include "BKE_material.h" | ||||
| #include "DNA_material_types.h" | #include "DNA_material_types.h" | ||||
| #include "DNA_scene_types.h" | |||||
| } | } | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "BKE_library.h" | #include "BKE_library.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| BL_Action::BL_Action(class KX_GameObject* gameobj) | BL_Action::BL_Action(class KX_GameObject* gameobj) | ||||
| : | : | ||||
| ▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | bool BL_Action::Play(const char* name, | ||||
| // then this fix may have to be re-evaluated. | // then this fix may have to be re-evaluated. | ||||
| if (!IsDone() && m_action == prev_action && m_startframe == start && m_endframe == end | if (!IsDone() && m_action == prev_action && m_startframe == start && m_endframe == end | ||||
| && m_priority == priority && m_speed == playback_speed) | && m_priority == priority && m_speed == playback_speed) | ||||
| return false; | return false; | ||||
| // Keep a copy of the action for threading purposes | // Keep a copy of the action for threading purposes | ||||
| if (m_tmpaction) { | if (m_tmpaction) { | ||||
| BKE_libblock_free(G.main, m_tmpaction); | BKE_libblock_free(G.main, m_tmpaction); | ||||
| m_tmpaction = NULL; | m_tmpaction = NULL; | ||||
moguri: Your BL_ConvertWorldIpos() will always return a non-NULL pointer, which means every single… | |||||
| } | } | ||||
| m_tmpaction = BKE_action_copy(m_action); | m_tmpaction = BKE_action_copy(m_action); | ||||
| // First get rid of any old controllers | // First get rid of any old controllers | ||||
| ClearControllerList(); | ClearControllerList(); | ||||
| // Create an SG_Controller | // Create an SG_Controller | ||||
| SG_Controller *sg_contr = BL_CreateIPO(m_action, m_obj, kxscene->GetSceneConverter()); | SG_Controller *sg_contr = BL_CreateIPO(m_action, m_obj, kxscene->GetSceneConverter()); | ||||
| m_sg_contr_list.push_back(sg_contr); | m_sg_contr_list.push_back(sg_contr); | ||||
| m_obj->GetSGNode()->AddSGController(sg_contr); | m_obj->GetSGNode()->AddSGController(sg_contr); | ||||
| sg_contr->SetObject(m_obj->GetSGNode()); | sg_contr->SetObject(m_obj->GetSGNode()); | ||||
| // World | |||||
| sg_contr = BL_CreateWorldIPO(m_action, kxscene->GetBlenderScene()->world, 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 | // Try obcolor | ||||
| sg_contr = BL_CreateObColorIPO(m_action, m_obj, kxscene->GetSceneConverter()); | sg_contr = BL_CreateObColorIPO(m_action, m_obj, kxscene->GetSceneConverter()); | ||||
| if (sg_contr) { | if (sg_contr) { | ||||
| m_sg_contr_list.push_back(sg_contr); | m_sg_contr_list.push_back(sg_contr); | ||||
| m_obj->GetSGNode()->AddSGController(sg_contr); | m_obj->GetSGNode()->AddSGController(sg_contr); | ||||
| sg_contr->SetObject(m_obj->GetSGNode()); | sg_contr->SetObject(m_obj->GetSGNode()); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 327 Lines • Show Last 20 Lines | |||||
Your BL_ConvertWorldIpos() will always return a non-NULL pointer, which means every single action the BGE will also try to play a world IPO, which isn't what we want. Take a look at BL_CreateObColorIPO() or BL_CreateMaterialIpo() for examples of how to fix this.