//-------------------------------------------------------------------------------- void CMultiSelEditor::_createModifyList() { mWorldAABB = Ogre::AxisAlignedBox::BOX_NULL; mModifyList.clear(); NameObjectPairList::const_iterator it = mSelectedObjects.begin(); while(it != mSelectedObjects.end()) { CBaseEditor *add = it->second; Ogre::AxisAlignedBox box = add->getWorldAABB(); mWorldAABB.merge(box); Ogre::String name = add->getName(); if(mModifyList.find(name) == mModifyList.end()) mModifyList.insert(NameObjectPairList::value_type(add->getName(), add)); it++; } Ogre::String remname; Ogre::StringVector removeList; removeList.clear(); it = mModifyList.begin(); while(it != mModifyList.end()) { remname = it->second->getParent()->getName(); if(mModifyList.find(remname) != mModifyList.end()) removeList.push_back(it->first); it++; } for(unsigned int x = 0;x < removeList.size(); x++) { mModifyList.erase(mModifyList.find(removeList[x])); } Ogre::Vector3 xTot = Ogre::Vector3::ZERO; Ogre::Vector3 yTot = Ogre::Vector3::ZERO; Ogre::Vector3 zTot = Ogre::Vector3::ZERO; int count = 0; it = mModifyList.begin(); while(it != mModifyList.end()) { xTot += it->second->getDerivedOrientation() * Ogre::Vector3::UNIT_X; yTot += it->second->getDerivedOrientation() * Ogre::Vector3::UNIT_Y; zTot += it->second->getDerivedOrientation() * Ogre::Vector3::UNIT_Z; count++; it++; } if(count) { xTot /= ((float)count); yTot /= ((float)count); zTot /= ((float)count); Ogre::Vector3 normal = Ogre::Vector3::UNIT_Z; Ogre::Quaternion q; q.FromAxes(xTot,yTot,zTot); mNode->setPosition(mWorldAABB.getCenter()); mNode->setOrientation(q); } else { mNode->setPosition(Ogre::Vector3::ZERO); mNode->setOrientation(Ogre::Quaternion::IDENTITY); } mNode->setScale(1,1,1); if(mSelectedObjects.size() == 0) { mSystem->SelectTreeItem(mOgitorsRoot->GetRootEditor()); mSystem->PresentPropertiesView(0); } else if(mSelectedObjects.size() == 1) { mSystem->SelectTreeItem(mSelectedObjects.begin()->second); mSystem->PresentPropertiesView(mSelectedObjects.begin()->second); } else { mSystem->SelectTreeItem(this); mSystem->PresentPropertiesView(this); } SelectionChangeEvent evt(this); EventManager::getSingletonPtr()->sendEvent(this, 0, &evt); }