本文整理汇总了C++中KX_GameObject::RemoveMeshes方法的典型用法代码示例。如果您正苦于以下问题:C++ KX_GameObject::RemoveMeshes方法的具体用法?C++ KX_GameObject::RemoveMeshes怎么用?C++ KX_GameObject::RemoveMeshes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KX_GameObject
的用法示例。
在下文中一共展示了KX_GameObject::RemoveMeshes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FreeBlendFile
//.........这里部分代码省略.........
}
//scene->FreeTagged(); /* removed tagged objects and meshes*/
CListValue *obj_lists[] = {scene->GetObjectList(), scene->GetInactiveList(), NULL};
for (int ob_ls_idx=0; obj_lists[ob_ls_idx]; ob_ls_idx++)
{
CListValue *obs= obj_lists[ob_ls_idx];
RAS_MeshObject* mesh;
for (int ob_idx = 0; ob_idx < obs->GetCount(); ob_idx++)
{
KX_GameObject* gameobj = (KX_GameObject*)obs->GetValue(ob_idx);
if (IS_TAGGED(gameobj->GetBlenderObject())) {
int size_before = obs->GetCount();
/* Eventually calls RemoveNodeDestructObject
* frees m_map_gameobject_to_blender from UnregisterGameObject */
scene->RemoveObject(gameobj);
if (size_before != obs->GetCount())
ob_idx--;
else {
printf("ERROR COULD NOT REMOVE \"%s\"\n", gameobj->GetName().ReadPtr());
}
}
else {
/* free the mesh, we could be referecing a linked one! */
int mesh_index= gameobj->GetMeshCount();
while(mesh_index--) {
mesh= gameobj->GetMesh(mesh_index);
if (IS_TAGGED(mesh->GetMesh())) {
gameobj->RemoveMeshes(); /* XXX - slack, should only remove meshes that are library items but mostly objects only have 1 mesh */
break;
}
}
/* make sure action actuators are not referencing tagged actions */
for (unsigned 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);
}
}
}
}
}
}
}
int size;
// delete the entities of this scene
/* TODO - */
#if 0
vector<pair<KX_Scene*,KX_WorldInfo*> >::iterator worldit;
size = m_worldinfos.size();
for (i=0, worldit=m_worldinfos.begin(); i<size; ) {
if ((*worldit).second) {
delete (*worldit).second;
*worldit = m_worldinfos.back();
示例2: FreeBlendFile
//.........这里部分代码省略.........
}
}
}
//scene->FreeTagged(); /* removed tagged objects and meshes*/
CListValue *obj_lists[] = {scene->GetObjectList(), scene->GetInactiveList(), NULL};
for (int ob_ls_idx = 0; obj_lists[ob_ls_idx]; ob_ls_idx++) {
CListValue *obs = obj_lists[ob_ls_idx];
RAS_MeshObject *mesh;
for (int ob_idx = 0; ob_idx < obs->GetCount(); ob_idx++) {
KX_GameObject *gameobj = (KX_GameObject*)obs->GetValue(ob_idx);
if (IS_TAGGED(gameobj->GetBlenderObject())) {
int size_before = obs->GetCount();
/* Eventually calls RemoveNodeDestructObject
* frees m_map_gameobject_to_blender from UnregisterGameObject */
scene->RemoveObject(gameobj);
if (size_before != obs->GetCount())
ob_idx--;
else {
printf("ERROR COULD NOT REMOVE \"%s\"\n", gameobj->GetName().ReadPtr());
}
}
else {
gameobj->RemoveTaggedActions();
/* free the mesh, we could be referecing a linked one! */
int mesh_index = gameobj->GetMeshCount();
while (mesh_index--) {
mesh = gameobj->GetMesh(mesh_index);
if (IS_TAGGED(mesh->GetMesh())) {
gameobj->RemoveMeshes(); /* XXX - slack, should only remove meshes that are library items but mostly objects only have 1 mesh */
break;
}
else {
/* also free the mesh if it's using a tagged material */
int mat_index = mesh->NumMaterials();
while (mat_index--) {
if (IS_TAGGED(mesh->GetMeshMaterial(mat_index)->m_bucket->GetPolyMaterial()->GetBlenderMaterial())) {
gameobj->RemoveMeshes(); /* XXX - slack, same as above */
break;
}
}
}
}
/* make sure action actuators are not referencing tagged actions */
for (unsigned 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);
}
}
}
}
}
}
}
int size;
// delete the entities of this scene
/* TODO - */