|
|
|
@@ -40,6 +40,7 @@
|
|
|
|
|
#include "KX_KetsjiEngine.h"
|
|
|
|
|
#include "KX_IPhysicsController.h"
|
|
|
|
|
#include "BL_Material.h"
|
|
|
|
|
#include "BL_ActionActuator.h"
|
|
|
|
|
#include "KX_BlenderMaterial.h"
|
|
|
|
|
#include "KX_PolygonMaterial.h"
|
|
|
|
|
|
|
|
|
@@ -960,7 +961,7 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
|
|
|
|
|
static char err_local[255];
|
|
|
|
|
|
|
|
|
|
/* only scene and mesh supported right now */
|
|
|
|
|
if(idcode!=ID_SCE && idcode!=ID_ME) {
|
|
|
|
|
if(idcode!=ID_SCE && idcode!=ID_ME &&idcode!=ID_AC) {
|
|
|
|
|
snprintf(err_local, sizeof(err_local), "invalid ID type given \"%s\"\n", group);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@@ -1018,6 +1019,16 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
|
|
|
|
|
kx_scene->GetLogicManager()->RegisterMeshName(meshobj->GetName(),meshobj);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(idcode==ID_AC) {
|
|
|
|
|
/* Convert all actions */
|
|
|
|
|
ID *action;
|
|
|
|
|
KX_Scene *kx_scene= m_currentScene;
|
|
|
|
|
|
|
|
|
|
for(action= (ID *)main_newlib->action.first; action; action= (ID *)action->next) {
|
|
|
|
|
printf("ActionName: %s\n", action->name);
|
|
|
|
|
kx_scene->GetLogicManager()->RegisterActionName(action->name+2, action);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(idcode==ID_SCE) {
|
|
|
|
|
/* Merge all new linked in scene into the existing one */
|
|
|
|
|
ID *scene;
|
|
|
|
@@ -1093,6 +1104,23 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now unregister actions */
|
|
|
|
|
{
|
|
|
|
|
GEN_Map<STR_HashedString,void*> &mapStringToActions = scene->GetLogicManager()->GetActionMap();
|
|
|
|
|
|
|
|
|
|
for(int i=0; i<mapStringToActions.size(); i++)
|
|
|
|
|
{
|
|
|
|
|
ID *action= (ID*) *mapStringToActions.at(i);
|
|
|
|
|
|
|
|
|
|
if(IS_TAGGED(action))
|
|
|
|
|
{
|
|
|
|
|
STR_HashedString an = action->name+2;
|
|
|
|
|
mapStringToActions.remove(an);
|
|
|
|
|
i--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//scene->FreeTagged(); /* removed tagged objects and meshes*/
|
|
|
|
|
CListValue *obj_lists[] = {scene->GetObjectList(), scene->GetInactiveList(), NULL};
|
|
|
|
|
|
|
|
|
@@ -1128,6 +1156,17 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* make sure action actuators are not referencing tagged actions */
|
|
|
|
|
for (int act_idx=0; act_idx<gameobj->GetActuators().size(); act_idx++)
|
|
|
|
|
{
|
|
|
|
|
if (gameobj->GetActuators()[act_idx]->IsType(SCA_IActuator::KX_ACT_ACTION))
|
|
|
|
|
{
|
|
|
|
|
BL_ActionActuator *act = (BL_ActionActuator*)gameobj->GetActuators()[act_idx];
|
|
|
|
|
if(IS_TAGGED(act->GetAction()))
|
|
|
|
|
act->SetAction(NULL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|