Show drag movements of objects in multiple scene managers.

loadfix
cc9cii 10 years ago
parent d6e67b248f
commit e51d532795

@ -525,7 +525,9 @@ void CSVRender::WorldspaceWidget::mouseMoveEvent (QMouseEvent *event)
pos.z += mZOffset; pos.z += mZOffset;
getSceneManager()->getSceneNode(mGrabbedSceneNode)->setPosition(pos+planeResult.second-mOrigMousePos); getSceneManager()->getSceneNode(mGrabbedSceneNode)->setPosition(pos+planeResult.second-mOrigMousePos);
mCurrentMousePos = planeResult.second; mCurrentMousePos = planeResult.second;
flagAsModified(); CSVWorld::PhysicsSystem::instance()->moveSceneNodes(mGrabbedSceneNode,
pos+planeResult.second-mOrigMousePos);
emit signalAsModified();
} }
} }
} }
@ -744,7 +746,9 @@ void CSVRender::WorldspaceWidget::wheelEvent (QWheelEvent *event)
Ogre::Vector3 pos = mOrigObjPos; Ogre::Vector3 pos = mOrigObjPos;
pos.z += mZOffset; pos.z += mZOffset;
getSceneManager()->getSceneNode(mGrabbedSceneNode)->setPosition(pos+mCurrentMousePos-mOrigMousePos); getSceneManager()->getSceneNode(mGrabbedSceneNode)->setPosition(pos+mCurrentMousePos-mOrigMousePos);
flagAsModified(); CSVWorld::PhysicsSystem::instance()->moveSceneNodes(mGrabbedSceneNode,
pos+mCurrentMousePos-mOrigMousePos);
emit signalAsModified();
} }
break; break;
} }

@ -159,6 +159,24 @@ namespace CSVWorld
position, rotation); position, rotation);
} }
void PhysicsSystem::moveSceneNodeImpl(const std::string sceneNodeName,
const std::string referenceId, const Ogre::Vector3 &position)
{
std::list<Ogre::SceneManager *>::const_iterator iter = mSceneManagers.begin();
for(; iter != mSceneManagers.end(); ++iter)
{
std::string name = refIdToSceneNode(referenceId, *iter);
if(name != sceneNodeName && (*iter)->hasSceneNode(name))
{
(*iter)->getSceneNode(name)->setPosition(position);
}
}
}
void PhysicsSystem::moveSceneNodes(const std::string sceneNodeName, const Ogre::Vector3 &position)
{
moveSceneNodeImpl(sceneNodeName, sceneNodeToRefId(sceneNodeName), position);
}
void PhysicsSystem::addHeightField(Ogre::SceneManager *sceneManager, void PhysicsSystem::addHeightField(Ogre::SceneManager *sceneManager,
float* heights, int x, int y, float yoffset, float triSize, float sqrtVerts) float* heights, int x, int y, float yoffset, float triSize, float sqrtVerts)
{ {

@ -63,6 +63,8 @@ namespace CSVWorld
void moveObject(const std::string &sceneNodeName, void moveObject(const std::string &sceneNodeName,
const Ogre::Vector3 &position, const Ogre::Quaternion &rotation); const Ogre::Vector3 &position, const Ogre::Quaternion &rotation);
void moveSceneNodes(const std::string sceneNodeName, const Ogre::Vector3 &position);
void addHeightField(Ogre::SceneManager *sceneManager, void addHeightField(Ogre::SceneManager *sceneManager,
float* heights, int x, int y, float yoffset, float triSize, float sqrtVerts); float* heights, int x, int y, float yoffset, float triSize, float sqrtVerts);
@ -80,6 +82,9 @@ namespace CSVWorld
private: private:
void moveSceneNodeImpl(const std::string sceneNodeName,
const std::string referenceId, const Ogre::Vector3 &position);
void updateSelectionHighlight(std::string sceneNode, const Ogre::Vector3 &position); void updateSelectionHighlight(std::string sceneNode, const Ogre::Vector3 &position);
std::string refIdToSceneNode(std::string referenceId, Ogre::SceneManager *sceneMgr); std::string refIdToSceneNode(std::string referenceId, Ogre::SceneManager *sceneMgr);
}; };

Loading…
Cancel
Save