diff --git a/apps/opencs/view/render/worldspacewidget.cpp b/apps/opencs/view/render/worldspacewidget.cpp index 4d64c7775..f25a24158 100644 --- a/apps/opencs/view/render/worldspacewidget.cpp +++ b/apps/opencs/view/render/worldspacewidget.cpp @@ -525,7 +525,9 @@ void CSVRender::WorldspaceWidget::mouseMoveEvent (QMouseEvent *event) pos.z += mZOffset; getSceneManager()->getSceneNode(mGrabbedSceneNode)->setPosition(pos+planeResult.second-mOrigMousePos); 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; pos.z += mZOffset; getSceneManager()->getSceneNode(mGrabbedSceneNode)->setPosition(pos+mCurrentMousePos-mOrigMousePos); - flagAsModified(); + CSVWorld::PhysicsSystem::instance()->moveSceneNodes(mGrabbedSceneNode, + pos+mCurrentMousePos-mOrigMousePos); + emit signalAsModified(); } break; } diff --git a/apps/opencs/view/world/physicssystem.cpp b/apps/opencs/view/world/physicssystem.cpp index 7272552b6..58d8e7662 100644 --- a/apps/opencs/view/world/physicssystem.cpp +++ b/apps/opencs/view/world/physicssystem.cpp @@ -159,6 +159,24 @@ namespace CSVWorld position, rotation); } + void PhysicsSystem::moveSceneNodeImpl(const std::string sceneNodeName, + const std::string referenceId, const Ogre::Vector3 &position) + { + std::list::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, float* heights, int x, int y, float yoffset, float triSize, float sqrtVerts) { diff --git a/apps/opencs/view/world/physicssystem.hpp b/apps/opencs/view/world/physicssystem.hpp index b5b765883..0742bbf47 100644 --- a/apps/opencs/view/world/physicssystem.hpp +++ b/apps/opencs/view/world/physicssystem.hpp @@ -63,6 +63,8 @@ namespace CSVWorld void moveObject(const std::string &sceneNodeName, const Ogre::Vector3 &position, const Ogre::Quaternion &rotation); + void moveSceneNodes(const std::string sceneNodeName, const Ogre::Vector3 &position); + void addHeightField(Ogre::SceneManager *sceneManager, float* heights, int x, int y, float yoffset, float triSize, float sqrtVerts); @@ -80,6 +82,9 @@ namespace CSVWorld private: + void moveSceneNodeImpl(const std::string sceneNodeName, + const std::string referenceId, const Ogre::Vector3 &position); + void updateSelectionHighlight(std::string sceneNode, const Ogre::Vector3 &position); std::string refIdToSceneNode(std::string referenceId, Ogre::SceneManager *sceneMgr); };