mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 19:36:43 +00:00
Show drag movements of objects in multiple scene managers.
This commit is contained in:
parent
d6e67b248f
commit
e51d532795
3 changed files with 29 additions and 2 deletions
|
@ -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…
Reference in a new issue