diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2013-02-23 06:47:22 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2013-02-23 06:47:22 +0400 |
commit | e4febef1fb659199b4ab73e3c6ef93edf54243dc (patch) | |
tree | 8c51b902f4a529def6f0180d98bad4e2b015b4cd /source/gameengine/Ketsji/BL_Action.cpp | |
parent | f924750463b40aa10caf5070543937d326f5605f (diff) |
BGE: Finally moving material IPOs to the 2.60 BGE animation system (BL_Action). It was kind of a fluke that they worked before.
Diffstat (limited to 'source/gameengine/Ketsji/BL_Action.cpp')
-rw-r--r-- | source/gameengine/Ketsji/BL_Action.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp index f55d1120a50..ff1f800a626 100644 --- a/source/gameengine/Ketsji/BL_Action.cpp +++ b/source/gameengine/Ketsji/BL_Action.cpp @@ -43,6 +43,10 @@ extern "C" { #include "BKE_action.h" #include "RNA_access.h" #include "RNA_define.h" + +// Needed for material IPOs +#include "BKE_material.h" +#include "DNA_material_types.h" } BL_Action::BL_Action(class KX_GameObject* gameobj) @@ -169,6 +173,31 @@ bool BL_Action::Play(const char* name, sg_contr->SetObject(m_obj->GetSGNode()); } + // Now try materials + if (m_obj->GetBlenderObject()->totcol==1) { + Material *mat = give_current_material(m_obj->GetBlenderObject(), 1); + sg_contr = BL_CreateMaterialIpo(m_action, mat, 0, 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()); + } + } else { + Material *mat; + STR_HashedString matname; + + for (int matidx = 1; matidx <= m_obj->GetBlenderObject()->totcol; ++matidx) { + mat = give_current_material(m_obj->GetBlenderObject(), matidx); + matname = mat->id.name; + sg_contr = BL_CreateMaterialIpo(m_action, mat, matname.hash(), 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) { |