| 3397 | |
| 3398 | |
| 3399 | void CEntity::UpdateHierarchy( SEntityUpdateContext &ctx ) |
| 3400 | { |
| 3401 | |
| 3402 | if (!m_lstBindings.empty()) |
| 3403 | { |
| 3404 | ENTITY_PROFILER |
| 3405 | |
| 3406 | //[kirill] |
| 3407 | // when we update child - it can unbind itself - so m_lstBindings changes - let's keep a copy |
| 3408 | static std::vector<EntityId> binds; |
| 3409 | binds.resize(0); |
| 3410 | //this does not work on AMD64 |
| 3411 | // binds.insert( binds.end(),m_lstBindings.begin(),m_lstBindings.end() ); |
| 3412 | |
| 3413 | BINDLISTItor bi; |
| 3414 | for (bi = m_lstBindings.begin(); bi != m_lstBindings.end(); ++bi) |
| 3415 | binds.push_back((*bi)); |
| 3416 | |
| 3417 | for(std::vector<EntityId>::iterator bndItr=binds.begin();bndItr!=binds.end();++bndItr ) |
| 3418 | { |
| 3419 | |
| 3420 | CEntity *pEntity =(CEntity *)m_pEntitySystem->GetEntity((*bndItr)); |
| 3421 | |
| 3422 | if (pEntity) |
| 3423 | { |
| 3424 | //OPTIMISED_BY_IVO |
| 3425 | Matrix44 mat=Matrix34::CreateRotationXYZ( Deg2Rad(m_angles),m_center); |
| 3426 | mat=GetTransposed44(mat); //TODO: remove this after E3 and use Matrix34 instead of Matrix44 |
| 3427 | |
| 3428 | //pEntity->SetParentLocale(m_center, m_angles); |
| 3429 | pEntity->SetParentLocale(mat); |
| 3430 | |
| 3431 | bool bNeedUpdate = (pEntity->m_bUpdate && !pEntity->m_bSleeping) || (pEntity->m_awakeCounter > 0); |
| 3432 | if (bNeedUpdate) |
| 3433 | { |
| 3434 | pEntity->Update(ctx); |
| 3435 | } |
| 3436 | // If have childs. |
| 3437 | if (pEntity->m_bUpdateBinds) |
| 3438 | { |
| 3439 | // If not updated. |
| 3440 | pEntity->UpdateHierarchy( ctx ); |
| 3441 | } |
| 3442 | } |
| 3443 | else |
| 3444 | { |
| 3445 | // this entity was deleted. Lets release its ID so it can be reused |
| 3446 | // m_pEntitySystem->ReleaseMark((*bi)); |
| 3447 | GetISystem()->GetILog()->LogToFile( "UpdateHierarchy <%s> has dead bind id >> %d",GetName(), (*bndItr) ); |
| 3448 | } |
| 3449 | } |
| 3450 | } |
| 3451 | |
| 3452 | /* |
| 3453 | if (!m_lstBindings.empty()) |
| 3454 | { |
| 3455 | ENTITY_PROFILER |
| 3456 |
no test coverage detected